libmodbus icon indicating copy to clipboard operation
libmodbus copied to clipboard

Fix portable build of libmodbus (upstream)

Open jimklimov opened this issue 10 months ago • 6 comments

Upstream the work done for NUT fork of libmodbus, without the RTU USB pieces at the moment - see https://github.com/networkupstools/libmodbus/pull/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 https://github.com/networkupstools/libmodbus/pull/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 avatar Jan 26 '25 12:01 jimklimov

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...

cla-bot[bot] avatar Jan 26 '25 12:01 cla-bot[bot]

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...

cla-bot[bot] avatar Jan 26 '25 20:01 cla-bot[bot]

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...

cla-bot[bot] avatar Jan 27 '25 16:01 cla-bot[bot]

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...

cla-bot[bot] avatar Jan 27 '25 17:01 cla-bot[bot]

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...

cla-bot[bot] avatar Jan 27 '25 17:01 cla-bot[bot]

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...

cla-bot[bot] avatar Jan 28 '25 15:01 cla-bot[bot]