CESM case_build error: linking to Fortran libraries from C fails

Jeline

New Member
Dear CESM scientists,

I am a beginner and I am compiling CESM on my personal workstation. I encountered problems during the case_build stage. The code version I used is release-cesm2.1.5-0-g7a6c5b0 and the compiler is Intel icx, icpx, and ifx.


This part is my description of the problem

I used the command as follows:
  1. ./create_newcase --compset FWHIST --res f09_f09_mg17 --case $HOME/cases/my_fates_case --run-unsupported
  2. ./case.setup
  3. ./case.build
error occurred in the step "./case.build", it shows:
ERROR: /home/loopy/my_cesm_sandbox/cime/src/build_scripts/buildlib.mct FAILED, cat /home/loopy/cesm_files/output/my_fates_case/bld/mct.bldlog.250705-152404

Then I used the command "cat /home/loopy/cesm_files/output/my_fates_case/bld/mct.bldlog.250705-152404", it shows:

configure: error: in /home/loopy/cesm_files/output/my_fates_case/bld/intel/impi/nodebug/nothreads/mct:
configure: error: linking to Fortran libraries from C fails


I checked the compiler configuration and it seems to be fine.:
  • "which ifx" shows "/opt/intel/oneapi/compiler/2025.1/bin/ifx"
  • "which icx" shows "/opt/intel/oneapi/compiler/2025.1/bin/icx"
  • "mpif90 --version" shows ifx (IFX) 2025.1.1 20250418 Copyright (C) 1985-2025 Intel Corporation. All rights reserved
Why is this error being reported? How can I resolve it?
The following are some potentially helpful pieces of information.

This part represents the modifications I made in the source tree

I modified the 4 files config_machines.xml, config_compilers.xml, config_batch.xml, env_mach_specific.xml as follows:

1- Add at the end of config_machines.xml:
<machine MACH="DESKTOP-P88ELI9">
<DESC>test</DESC>
<OS>LINUX</OS>
<COMPILERS>intel</COMPILERS>
<MPILIBS>impi</MPILIBS>
<PROJECT>none</PROJECT>
<NODENAME_REGEX>.*</NODENAME_REGEX>
<MAX_TASKS_PER_NODE>48</MAX_TASKS_PER_NODE>
<MAX_MPITASKS_PER_NODE>48</MAX_MPITASKS_PER_NODE>
<DIN_LOC_ROOT>/home/loopy/my_cesm_sandbox/inputdata</DIN_LOC_ROOT>
<DIN_LOC_ROOT_CLMFORC>/home/loopy/my_cesm_sandbox/inputdata/atm/datm7</DIN_LOC_ROOT_CLMFORC>
<DOUT_S_ROOT>/home/loopy/cesm_files/output/${CASE}</DOUT_S_ROOT>
<BASELINE_ROOT>/home/loopy/cesm_files/output/cesm_baselines</BASELINE_ROOT>
<CCSM_CPRNC>/home/loopy/cesm_files/output/cprnc</CCSM_CPRNC>
<GMAKE>make</GMAKE>
<GMAKE_J>8</GMAKE_J>
<BATCH_SYSTEM>none</BATCH_SYSTEM>
<SUPPORTED_BY>loopy</SUPPORTED_BY>
<PROJECT_REQUIRED>FALSE</PROJECT_REQUIRED>
<mpirun mpilib="impi">
<executable>mpirun</executable>
<arguments>
<arg name="num_tasks" > -n {{ total_tasks }}</arg>
</arguments>
</mpirun>
<module_system type="none"></module_system>
<environment_variables>
<env name="OMP_STACKSIZE">256M</env>
<env name="NETCDF_C_PATH">/home/loopy/cesm_deps_intel/netcdf-c</env>
<env name="NETCDF_FORTRAN_PATH">/home/loopy/cesm_deps_intel/netcdf-fortran</env>
<env name="INC_NETCDF">/home/loopy/cesm_deps_intel/netcdf-fortran/include</env>
<env name="LIB_NETCDF">/home/loopy/cesm_deps_intel/netcdf-fortran/lib:/home/loopy/cesm_deps_intel/netcdf-c/lib</env>
<env name="PNETCDF_PATH">/home/loopy/cesm_deps_intel/pnetcdf</env>
<env name="HDF5_PATH">/home/loopy/cesm_deps_intel/hdf5</env>
<env name="ZLIB_PATH">/home/loopy/cesm_deps_intel/zlib</env>
<env name="ESMF_PATH">/home/loopy/esmf-8.8.1</env>
</environment_variables>
</machine>

2- Add at the end of config_compilers:
<compiler COMPILER="intel" MACH="DESKTOP-P88ELI9">
<CPPDEFS>
<append>-DLINUX</append>
</CPPDEFS>
<LDFLAGS>
<append compile_threaded="true"> -fopenmp </append>
<append> -mkl </append>
</LDFLAGS>
<CFLAGS>
<append DEBUG="FALSE"> -O2 </append>
</CFLAGS>
<CONFIG_ARGS>
<base> --host=Linux </base>
</CONFIG_ARGS>
<FFLAGS>
<append DEBUG="FALSE"> -O2 </append>
</FFLAGS>

<MPICC> mpiicx </MPICC>
<MPICXX> mpiicpx </MPICXX>
<MPIFC> mpiifx </MPIFC>
<SCC> icx </SCC>
<SCXX> icpx </SCXX>
<SFC> ifx </SFC>
<ESMF_LIBDIR>/home/loopy/cesm_deps_intel/esmf/bin/binO/Linux.intel.64.mpi.default</ESMF_LIBDIR>
<MPI_PATH>/opt/intel/oneapi/mpi/2021.15</MPI_PATH>
<NETCDF_C_PATH>/home/loopy/cesm_deps_intel/netcdf-c</NETCDF_C_PATH>
<NETCDF_FORTRAN_PATH>/home/loopy/cesm_deps_intel/netcdf-fortran</NETCDF_FORTRAN_PATH>
<PNETCDF_PATH>/home/loopy/cesm_deps_intel/pnetcdf</PNETCDF_PATH>

<SLIBS>
<append>-L/home/loopy/cesm_deps_intel/netcdf-c/lib -lnetcdf -L/home/loopy/cesm_deps_intel/netcdf-fortran/lib -lnetcdff -L/home/-L/home/loopy/cesm_deps_intel/hdf5/lib -lhdf5 -lhdf5_hl -L/home/loopy/cesm_deps_intel/zlib/lib -lz -L/opt/intel/oneapi/mkl/2025.1/lib/intel64 -llapack</append>
</SLIBS>
</compiler>

3- Add at the end of config_batch.xml:
<batch_system MACH="DESKTOP-P88ELI9" type="none">
<batch_submit>bash</batch_submit>
</batch_system>

4- Add in the env_mach_specific.xml:
<env name="FC">mpiifx</env>
<env name="F77">mpiifx</env>
<env name="CC">mpiicx</env>
<env name="CXX">mpiicpx</env>
<env name="LDFLAGS">-L/opt/intel/oneapi/mkl/2025.1/lib/intel64 -lifcore -lifport -lstdc++</env>


The attachment includes the mct.bldlog file which shows the compilation error messages, as well as the four modified XML files that I have made. (Except for config_batch.xml, since this error is not related to it.)

Thanks for your help soooooooo much!
 

Attachments

jedwards

CSEG and Liaisons
Staff member
mct will have created a file config.log in directory bld/intel/impi/nodebug/nothreads/mct check that file as suggested in the mct bld log.
 

Jeline

New Member
mct will have created a file config.log in directory bld/intel/impi/nodebug/nothreads/mct check that file as suggested in the mct bld log.
Thanks for the advice. However, it has been suggested to me that there is a possibility that I am using the icx and ifx compilers, which are not suitable for compiling CESM with the newer versions of Intel. so I have uninstalled them all and am going to compile again with icc and ifort, and this config.log no longer exists. But I kept part of the config.log before and uploaded it in the attachment, hopefully it will help in solving this problem. I'm very curious to know why it kept getting stuck before.
Looking forward to your reply, thanks in advance.


Translated with DeepL.com (free version)
 

Attachments

Back
Top