Skip to content

INSTALL - FIX - Make bundled-dependency builds honour FC/CC and embed rpath - #279

Open
krystophny wants to merge 1 commit into
PrincetonUniversity:developfrom
krystophny:agent/ifx-build-fixes
Open

INSTALL - FIX - Make bundled-dependency builds honour FC/CC and embed rpath#279
krystophny wants to merge 1 commit into
PrincetonUniversity:developfrom
krystophny:agent/ifx-build-fixes

Conversation

@krystophny

Copy link
Copy Markdown
Collaborator

Building the bundled netcdf/hdf5 stack with a compiler other than the one that first configured it fails in three ways. All three are in install/ only; no source file changes.

1. configure is skipped and never told which compiler to use

netcdf-c, netcdf-fortran and hdf5 run ./configure only when no Makefile is present, and do not pass FC/CC. A tree first built with gfortran 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 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 the configure calls now pass CC, FC and F77 explicitly.

2. cannot compute sizeof (off_t)

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

configure: error: cannot compute sizeof (off_t)

The configure calls now add -Wl,-rpath alongside the existing -L.

3. undefined symbol: netcdf_mp_nf90_create_

The codes linked with -L$(NETCDFDIR) but no rpath, so they resolved against whichever libnetcdff the loader found first. NETCDF_EXTRA_LIBS now carries -Wl,-rpath for the Fortran and C library directories.

Also

Adds a depsclean target. Plain clean leaves the dependency configuration in place, so there was no supported way to switch toolchains.

Testing

Full stack plus dcon, gpec and pentrc built from scratch on Linux with FC=ifx CC=icx (oneAPI 2026.0) and separately with FC=gfortran CC=gcc.

One note for anyone hitting a SIGSEGV in gpec right after "100% iterations complete" with an Intel build: that one is not addressed here, and ulimit -s unlimited works around it. Happy to open it separately if useful.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants