Repository navigation
INSTALL - FIX - Make bundled-dependency builds honour FC/CC and embed rpath - #279
Conversation
… rpath
Three related build failures when the bundled netcdf/hdf5 stack is used with a
compiler other than the one that first configured it.
1. The netcdf-c, netcdf-fortran and hdf5 rules run ./configure only when no
Makefile is present, and never pass FC or CC to it. A tree first built with
gfortran therefore keeps its gfortran configuration after FC is changed,
and the Fortran codes then fail with
error #7013: This module file was not generated by any release of this
compiler. [NETCDF]
followed by a long cascade of
error #6683: A kind type parameter must be a compile-time constant. [R8]
The second message is misleading: r8 is a PARAMETER in equil/local.f and is
perfectly valid. The kind errors are collateral damage from the failed
module read, and disappear once the module matches the compiler. This cost
real debugging time, so the configure calls now pass CC, FC and F77
explicitly.
2. netcdf-fortran's configure links and *runs* test programs against the
freshly installed netcdf-c. Without the install lib directory on the
runtime search path those tests build but abort, and configure stops with
the unhelpful
configure: error: cannot compute sizeof (off_t)
The configure calls now add -Wl,-rpath alongside the existing -L.
3. The codes themselves linked with -L$(NETCDFDIR) but no rpath, so they
resolved against whatever libnetcdff the loader found first. That produced
symbol lookup error: undefined symbol: netcdf_mp_nf90_create_
when a system netcdf shadowed the bundled one. NETCDF_EXTRA_LIBS now
carries -Wl,-rpath for the Fortran and C library directories.
A depsclean target is added, since plain clean leaves the dependency
configuration in place and there was no supported way to switch toolchains.
Verified by building the full stack and dcon, gpec and pentrc from scratch
with FC=ifx CC=icx on Linux, and separately with FC=gfortran CC=gcc.
|
@claude review this pr |
|
Claude finished @logan-nc's task in 35s —— View job Review of PR #279: honour FC/CC and embed rpath for bundled depsThe three fixes match the failure modes in the description. I read the diff only and did not build or run anything. Things that look right
Issues and suggestions
No changes to |
|
@krystophny please assign a reviewer to get merged more promptly interested future 🙏 |
|
I approve if the Claude review point 1 is fixed and @matt-pharr approves (I 100% deferred to @matt-pharr 's superior knowledge of these installation details) |
|
done |
matt-pharr
left a comment
There was a problem hiding this comment.
See comments. Very useful contributions but should be cleaned up.
| if [ -f ../deps/src/netcdf-fortran/Makefile ]; then cd ../deps/src/netcdf-fortran && make clean; fi | ||
|
|
||
| # Remove the autotools configuration of the bundled dependencies. The netcdf | ||
| # and hdf5 rules only run ./configure when no Makefile is present, so a plain |
There was a problem hiding this comment.
Comments like this should be in the PR, not the code. A terse two-liner would do fine here.
| cd ../; git submodule update --init deps/src/netcdf-c; | ||
| if [ ! -f ../deps/src/netcdf-c/Makefile ]; then \ | ||
| cd ../deps/src/netcdf-c; \ | ||
| CC="$(CC)" FC="$(FC)" F77="$(FC)" \ |
There was a problem hiding this comment.
CC="$(CC)" FC="$(FC)" can go, these are already set in DEFAULTS.inc. You could consider adding export F77="$(FC)" to DEFAULTS.inc since that is where we set all these sorts of variables. This applies to the lines below as well.
| # headers and tools are replaced on installation. Other installed libraries, | ||
| # including OpenBLAS, are retained. | ||
| .PHONY: depsclean | ||
| depsclean: |
There was a problem hiding this comment.
we don't really need this to be its own target, I would just change make clean to make distclean for the libraries in the realclean target.
|
@krystophny please let me know if you disagree with any of this |
|
@matt-pharr Updated as suggested: shorter comments, All five CI checks pass. Local GNU and ifx/MKL builds and netCDF round trips pass, including a One existing limitation remains: |
Bundled HDF5/netCDF builds can retain a previous compiler's configuration when switching
FC/CC. Their configure probes and the GPEC executables can also fail to load the intended netCDF libraries at runtime.FC,CCandF77centrally frominstall/DEFAULTS.inc, so dependency configure scripts receive the selected toolchain.realcleantarget rundistcleanfor HDF5, netCDF-C and netCDF-Fortran. It removes their configuration and compiler-dependent installed libraries/modules, including those under a customDEPSINSTALLDIR. Runmake realcleanbefore switching compilers; toolchain changes are not detected automatically.No Fortran source changes. Current
developis merged, including the fork-PR CI checkout fix.Validation:
make checkdeps, workflow lint andgit diff --checkpass.dcon,gpecandpentrcbuild with GNU (gfortran/gcc16.2.1, system LAPACK), followed bymake realcleanand a rebuild with Intel (ifx/icx2026.0, MKL 2026.0).Remaining limitation:
ifxwithLAPACKHOME=/usrcan still select a system GNUnetcdf.mod, because existingRULES.incplaces the math include directory beforeNETCDFINC. This was reproduced locally; include-path precedence is unchanged by this PR. Intel validation above uses MKL.