Skip to content

Fix portable build of libmodbus (upstream)#793

Open
jimklimov wants to merge 20 commits intostephane:masterfrom
jimklimov:fix-portable-build-upstream
Open

Fix portable build of libmodbus (upstream)#793
jimklimov wants to merge 20 commits intostephane:masterfrom
jimklimov:fix-portable-build-upstream

Conversation

@jimklimov
Copy link

@jimklimov jimklimov commented Jan 26, 2025

Upstream the work done for NUT fork of libmodbus, without the RTU USB pieces at the moment - see networkupstools#4 for the equivalent PR there

This subset of those changes focuses more strictly on passing builds without warnings, due to regressions allegedly due to upstream v3.1.10->v3.1.11 bump, so these fixes could be up-streamed separately:

  • changes in rtu_usb branch not as portable as they should be (printing of int types)
  • casting of setsockopt() pointer to data
  • use of inet_ntop()/inet_pton() absent on Windows (at least MINGW on Linux cross-build environments, MSYS2 does not seem to suffer this one) - configure detection and fallback implementation code imported from NUT
  • ip.h needs in.h explicitly on some platforms

Enhancements:

  • allow to ./configure --enable-Werror in test builds, to fail the build upon any compiler warnings (not enabled by default), allowing to easily iterate on the code fixes
  • enhance some debug printouts, add end-of-lines and and console flushing before/after certain messages

There is a separate stack of commits focused on passing make check as well -- the unit-test changes in networkupstools#3, but those are a bit more questionable even to myself (e.g. should flushing be done between tests and/or if some fail? how much should we rely on tight timings in "7ms > 5ms" tests where OS clock for context switches may be not so precise? etc.)

NOTE: I've posted the form for CLA bot some weeks ago, did not see any master-branch changes about that though. Posted another today, just in case.

jimklimov and others added 13 commits January 26, 2025 13:03
… files Signed-off-by: Jim Klimov <jimklimov@gmail.com>
…string length Signed-off-by: Jim Klimov <jimklimov@gmail.com>
Also define WARNING_CXXFLAGS even if not used at the moment; the script already does juggle CXXFLAGS and detects PROG_CXX anyway. Signed-off-by: Jim Klimov <jimklimov@gmail.com>
…ds (mingw) Signed-off-by: Jim Klimov <jimklimov@gmail.com>
…ntop() from NUT for cross-builds on WIN32 (mingw) Adapted to libmodbus codebase and clang-format Signed-off-by: Jim Klimov <jimklimov@gmail.com>
…uires netinet/in.h explicitly included first Looking at FreeBSD, OpenIndiana et al. Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…e-bracket debug printout Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…, report it as such (not as generic "select()") Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…f() to sync the output Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…tuations Signed-off-by: Jim Klimov <jimklimov@gmail.com>
… contents in the final report Signed-off-by: Jim Klimov <jimklimov@gmail.com>
@cla-bot
Copy link

cla-bot bot commented Jan 26, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Signed-off-by: Jim Klimov <jimklimov@gmail.com>
Signed-off-by: Jim Klimov <jimklimov@gmail.com>
@cla-bot
Copy link

cla-bot bot commented Jan 26, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@cla-bot
Copy link

cla-bot bot commented Jan 27, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

…ementations Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@cla-bot
Copy link

cla-bot bot commented Jan 27, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

…move the old call Signed-off-by: Jim Klimov <jimklimov@gmail.com>
@cla-bot
Copy link

cla-bot bot commented Jan 27, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

… tooling Signed-off-by: Jim Klimov <jimklimov@gmail.com>
@cla-bot
Copy link

cla-bot bot commented Jan 28, 2025

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

@jimklimov jimklimov marked this pull request as draft November 5, 2025 07:58
@jimklimov jimklimov marked this pull request as ready for review November 5, 2025 07:58
…d-upstream Signed-off-by: Jim Klimov <jimklimov@gmail.com>
@cla-bot cla-bot bot added the cla-signed label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant