INSTALL - FIX - Make bundled-dependency builds honour FC/CC and embed rpath - #279
Open
krystophny wants to merge 1 commit into
Open
INSTALL - FIX - Make bundled-dependency builds honour FC/CC and embed rpath#279krystophny wants to merge 1 commit into
krystophny wants to merge 1 commit into
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building the bundled
netcdf/hdf5stack with a compiler other than the one that first configured it fails in three ways. All three are ininstall/only; no source file changes.1.
configureis skipped and never told which compiler to usenetcdf-c,netcdf-fortranandhdf5run./configureonly when noMakefileis present, and do not passFC/CC. A tree first built with gfortran keeps its gfortran configuration afterFCis changed, and the Fortran codes then fail withfollowed by a long cascade of
The second message is misleading —
r8is aPARAMETERinequil/local.fand is valid. The kind errors are collateral damage from the failed module read and vanish once the module matches the compiler. This cost a fair amount of debugging, so theconfigurecalls now passCC,FCandF77explicitly.2.
cannot compute sizeof (off_t)netcdf-fortran's configure links and runs test programs against the freshly installednetcdf-c. Without the installlibdirectory on the runtime search path those tests build but abort, and configure stops withThe configure calls now add
-Wl,-rpathalongside the existing-L.3.
undefined symbol: netcdf_mp_nf90_create_The codes linked with
-L$(NETCDFDIR)but no rpath, so they resolved against whicheverlibnetcdffthe loader found first.NETCDF_EXTRA_LIBSnow carries-Wl,-rpathfor the Fortran and C library directories.Also
Adds a
depscleantarget. Plaincleanleaves the dependency configuration in place, so there was no supported way to switch toolchains.Testing
Full stack plus
dcon,gpecandpentrcbuilt from scratch on Linux withFC=ifx CC=icx(oneAPI 2026.0) and separately withFC=gfortran CC=gcc.One note for anyone hitting a
SIGSEGVingpecright after "100% iterations complete" with an Intel build: that one is not addressed here, andulimit -s unlimitedworks around it. Happy to open it separately if useful.