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

CI: Fix C/C++ standard customization #2306

Merged
merged 25 commits into from Feb 10, 2024

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Feb 10, 2024

While our NUT CI matrix code allows to pick -std=... settings for CFLAGS and CXXFLAGS, it was found that builds launched allegedly in c99/c++98 mode (or gnu equivalents) did not actually use that, and added flags for C11/C++11 (if supported by compiler) regardless.

This PR fixes the detection we have for caller-specified -std=... or -ansi to avoid slapping on another value, and some fallout of this change per CI findings.

NOTE: Builds in strict-C -ansi mode (aka c89 and c++98) do not pass - unable to find many standard library methods and types in system headers (snprintf, timespec etc.) and complain about // comments that remain abundant in our codebase. So they are not a practical immediate goal. However, builds requested with gnu89 and gnu++98 modes (to whatever extent C++ would be or not be enabled in practice) should pass.

…dy requested by caller

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ations" (are only allowed in C99 or C11 mode)

A little fallout for recent fix of actually doing C89 bulids via ci_build.sh

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…d by default (Strict C seems broken on OS side)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added bug enhancement Windows CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) cross-builds portability We want NUT to build and run everywhere possible labels Feb 10, 2024
@jimklimov jimklimov added this to the 2.8.2 milestone Feb 10, 2024
…NFATAL settings when BUILD_TYPE is empty

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…=..." to also cover "-ansi" option

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
… loop initial declarations" (are only allowed in C99 or C11 mode)

A little fallout for recent fix of actually doing C89 bulids via ci_build.sh

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ilds

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…dards

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…italOcean) [networkupstools#2192]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…tdio.h for snprintf()

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>
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>
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>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member Author

Now CFLAGS='-ansi' CXXFLAGS='-ansi' ./ci_build.sh passes locally again (on an Ubuntu 22.04.3 LTS VM). NUT config summary:

NUT Configuration summary:

  • configured version: 2.8.1.1 (v2.8.1-452-g4d4cf333f)
  • build serial drivers: yes
  • build USB drivers: yes (libusb-1.0)
  • build neon based XML driver: yes
  • enable Avahi support: yes
  • build Powerman PDU client driver: yes
  • build Modbus driver: yes
  • build IPMI driver: yes (FreeIPMI)
  • build GPIO driver: yes libgpiod
  • build Mac OS X meta-driver: no
  • build i2c based drivers: yes
  • enable SSL support: yes (OpenSSL)
  • enable libwrap (tcp-wrappers) support: yes
  • enable libltdl (Libtool dlopen abstraction) support: yes
  • build nut-scanner: yes
  • build CGI programs: yes
  • install NUT-Monitor desktop application: no
  • install PyNUT binding module: yes
  • use default Python interpreter: /usr/bin/python
  • use specific Python2 interpreter: /usr/bin/python2
  • use specific Python3 interpreter: /usr/bin/python3.10
  • build and install documentation: skip
  • build specific documentation format(s): no
  • build and install the development files: yes
  • consider basic SMF support: no
  • consider basic systemd support: yes
  • build with tighter systemd support: yes
  • build C++11 codebase (client library, etc.): no
  • build C++ tests with CPPUNIT: no
  • build SNMP drivers: yes
  • build SNMP drivers with statically linked lib(net)snmp: no
  • User to run as: nobody
  • Group of user to run as: nogroup

NUT Paths:

  • Default installation prefix path: /usr/local/ups
  • State file path: /var/state/ups
  • Unprivileged PID file path: /var/state/ups
  • Privileged PID file path: /run
  • Driver program path: /usr/local/ups/bin
  • CGI program path: /usr/local/ups/cgi-bin
  • HTML file path: /usr/local/ups/html
  • Config file path: /usr/local/ups/etc
  • Data file path: /usr/local/ups/share
  • Tool program path: /usr/local/ups/bin
  • System program path: /usr/local/ups/sbin
  • System library path: /usr/local/ups/lib
  • System exec-library path: /usr/local/ups/libexec

NUT Paths for third-party integrations:

  • Default Python interpreter site-packages: /usr/local/lib/python3.10/dist-packages
  • Specific Python2 interpreter site-packages: /usr/local/lib/python2.7/dist-packages
  • Specific Python3 interpreter site-packages: /usr/local/lib/python3.10/dist-packages
  • pkg-config *.pc directory: ${libdir}/pkgconfig => /usr/local/ups/lib/pkgconfig
  • Service units for systemd: /lib/systemd/system
  • Shutdown hooks for systemd: /lib/systemd/system-shutdown
  • Systemd-tmpfiles configs: /usr/lib/tmpfiles.d
  • Augeas lenses directory: /usr/share/augeas/lenses/dist
  • Udev rules directory: /lib/udev

NUT Build/Target system info:

  • Compact version of C compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • Compact version of C++ compiler: g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • Compact version of C preprocessor: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • host env spec we run on: x86_64-pc-linux-gnu
  • host env spec we built on: x86_64-pc-linux-gnu
  • host env spec we built for: x86_64-pc-linux-gnu
  • host OS short spec we run on: x86_64-linux-gnu
  • host OS short spec we built on: x86_64-linux-gnu
  • host OS short spec we built for: x86_64-linux-gnu
  • host multiarch spec we build for (as suggested by compiler being used): x86_64-linux-gnu
  • ccache namespace tag (if ccache is used and new enough): nut:x86_64-linux-gnu

NUT Compiler settings:

  • CC : gcc
  • CFLAGS : -isystem /usr/local/include -ansi -Wno-reserved-identifier -fdiagnostics-color=always -Wno-unknown-warning-option -Wall -Wsign-compare -Werror
  • CXX : g++
  • CXXFLAGS : -isystem /usr/local/include -ansi -Wno-reserved-identifier -fdiagnostics-color=always -Wno-unknown-warning-option -Wall -Wextra -Werror
  • CPP : gcc -E
  • CPPFLAGS :
  • CONFIG_FLAGS : --enable-Wcolor --enable-warnings --enable-Werror --enable-keep_nut_report_feature --with-all=auto --with-cgi=auto --with-serial=auto --with-dev=auto --with-doc=skip --with-nut_monitor=auto --with-pynut=auto --disable-force-nut-version-header --enable-check-NIT --enable-maintainer-mode --disable-silent-rules

@jimklimov
Copy link
Member Author

jimklimov commented Feb 10, 2024

Ignore the shellcheck fault, CI builder got restarted.

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…wed in C99 or C11 mode) for a WIN32 codepath

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ct C89

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
… mode

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov merged commit 636c3d8 into networkupstools:master Feb 10, 2024
12 checks passed
@jimklimov jimklimov deleted the fix-CI-std branch February 10, 2024 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) cross-builds enhancement portability We want NUT to build and run everywhere possible Windows
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant