You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build_old.yml fails on ubuntu-26.04 runners: PnetCDF 1.12.1 ncmpidump.h does not compile as C23 #1526
Since 2026-11-12 the "Build and Test Linux with older netcdf-c" job (.github/workflows/build_old.yml) fails while building PnetCDF, before netCDF-C or netCDF4 is built. ubuntu-latest now gives the ubuntu-26.04 image, whose gcc compiles C23 by default, and PnetCDF 1.12.1 declares enum {false=0, true=1}; in src/utils/ncmpidump/ncmpidump.h (line 19). false and true are keywords in C23:
ncmpidump.h:19:7: error: cannot use keyword 'false' as enumeration constant
ncmpidump.h:19:7: note: 'false' is a keyword with '-std=c23' onwards
The last green run of this workflow (run 43013384607, attempt 2, 11-12 00:57 UTC) used ubuntu-24.04. Both runs since then used ubuntu-26.04 and stop at this line: a later PR run of #1525 (run 43182242794, 11-12) and the master push that merged it (run 43647820478, 11-14). The workflow runs on every push and pull request, so new PRs will show it red too.
Reproduction with gcc 15 (its default dialect is C23):
printf 'enum {false=0, true=1};\n' | gcc-15 -fsyntax-only -x c - # the error above
printf 'enum {false=0, true=1};\n' | gcc-15 -std=gnu17 -fsyntax-only -x c - # compiles
A fix that works on my fork is to compile the two old libraries as C17. These three lines go in build_old.yml just before the PnetCDF download:
sudo apt-get install openmpi-common libopenmpi-dev openmpi-bin libhdf5-openmpi-dev libcurl4-openssl-dev bzip2 libsnappy-dev libblosc-dev libzstd-dev
+ # PnetCDF 1.12.1 and netCDF-C 4.7.4 are C17-era sources; ubuntu-26.04's gcc+ # defaults to C23, where `enum {false=0, true=1}` (ncmpidump.h) no longer compiles.+ export CFLAGS="-std=gnu17"
echo "Download and build PnetCDF version ${PNETCDF_VERSION}"
The export only lasts for the "Install Ubuntu Dependencies" step, so it covers the PnetCDF and netCDF-C builds and not the netCDF4 build. On my fork, master as it is fails at the same line (run 43965538171, two attempts). The branch with these three lines passes the whole job on ubuntu-26.04, including the 140 serial tests and the MPI tests (run 43965538267, two attempts, commit glaziermag/netcdf4-python@53d64e3). Setting runs-on: ubuntu-24.04 for this job would also work, but only until that image is retired.
Written with the help of an AI agent (Claude); the runs above were carried out as described.
Activity