koichi_sakaguchi@pnnl_gov
Member
Hi forum members,
I'd like to know if there are ways to build dynamically linked libraries for each model component (libatm.so, liblnd.so, ... etc.) instead of statically linked ones (libatm.a, liblnd.a).
I am trying to compile CESM1.5 with our custom modifications to CAM for the NERSC Cori system. With ifort version 19.0 or later, we get a compile-time error that has been reported in this forum (relocation truncated to fit: R_X86_64_PC32 against `.bss'). But after the March 2022 update at NERSC, older ifort versions are not available anymore.
A reported solution in this forum is either use certain versions of PIO1 (we are using version 1.9.10 according to the ChangeLog in our cesm1.5 code) or to build the model with '-mcmodel=medium' option
relocation truncated to fit error for compset C
CESM1.2 build problem on cheyenne, relocation truncated to fit
relocation truncated to fit: R_X86_64_32 against `.bss'
Focusing on the mcmodel flag, ifort compiler also requires the model being built as dynamically linked executable by adding '-shared -fpic' flags. But even with these flags, we still get the same error (but from different functions); relocation truncated to fit: R_X86_64_32 against symbol `rrlw_kg03_mp_kao_' defined in LARGE_COMMON section in ... /bld/lib//libatm.a(rrlw_kg03.o). The error happens when cesm.exe is being built by linking to component model libraries, e.g., libatm.a, libice.a.
According to the NERSC user support and the ifort manual,
With those specifications, we still get statically linked model components (libatm.a, libice.a).
Could anyone tell me how to make dynamically linked model libraries? Or any other solutions to avoid the "relocation truncated to fit" error?
Please note that we need to use the CESM1.5 code with our modifications to finish on-going long-term climate simulations.
Best regards,
Koichi
I'd like to know if there are ways to build dynamically linked libraries for each model component (libatm.so, liblnd.so, ... etc.) instead of statically linked ones (libatm.a, liblnd.a).
I am trying to compile CESM1.5 with our custom modifications to CAM for the NERSC Cori system. With ifort version 19.0 or later, we get a compile-time error that has been reported in this forum (relocation truncated to fit: R_X86_64_PC32 against `.bss'). But after the March 2022 update at NERSC, older ifort versions are not available anymore.
A reported solution in this forum is either use certain versions of PIO1 (we are using version 1.9.10 according to the ChangeLog in our cesm1.5 code) or to build the model with '-mcmodel=medium' option
relocation truncated to fit error for compset C
CESM1.2 build problem on cheyenne, relocation truncated to fit
relocation truncated to fit: R_X86_64_32 against `.bss'
Focusing on the mcmodel flag, ifort compiler also requires the model being built as dynamically linked executable by adding '-shared -fpic' flags. But even with these flags, we still get the same error (but from different functions); relocation truncated to fit: R_X86_64_32 against symbol `rrlw_kg03_mp_kao_' defined in LARGE_COMMON section in ... /bld/lib//libatm.a(rrlw_kg03.o). The error happens when cesm.exe is being built by linking to component model libraries, e.g., libatm.a, libice.a.
According to the NERSC user support and the ifort manual,
So we like to try building each model component as shard library instead of static libraries, which are then linked to produce dynamically linked cesm.exe. We tried to enforce dynamic linking by setting environmental variable CRAYPE_LINK_TYPE=dynamic in env_mach_specific.xml, in addition to the '-shared' option in FFLAGS, CFLAGS, and LDFLAGS in "Macros.make" for a working case, and also to the fact that the default is to build dynamically linked libraries/executables in the current NERSC environment."shared libraries must not be linked with archive libraries" (in the section "Creating Shared Libraries" in the ifort manual, https://cdrdv2.intel.com/v1/dl/getContent/671552?explicitVersion=true&wapkw=ifort 19.0).
With those specifications, we still get statically linked model components (libatm.a, libice.a).
Could anyone tell me how to make dynamically linked model libraries? Or any other solutions to avoid the "relocation truncated to fit" error?
Please note that we need to use the CESM1.5 code with our modifications to finish on-going long-term climate simulations.
Best regards,
Koichi