Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix portable build of libmodbus (upstream) #793

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant