Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Error during CESM 1.2.2 build phase due to netcdf library path

bastien.cozian

Bastien Cozian
New Member
Dear CESM community,
I have been trying to port CESM 1.2.2 on a new machine (the Irene machine of the TGCC in France, in case anyone knows it).
I encounter an error during the build phase. I have been trying to solve this problem for more than 10 days, but now I am totally stuck. I would really appreciate if anyone could help me to find a solution

I explain below my issue and what I have tried to do to find a solution.
I attach to this post my log files, my Macros and env_mach_specific files, and the script I use to create, set up and build a case.

I am following the CESM1.2 User Guide. I use a simple set up with compset=X and res=f45_g37. During the "build" phase, I enconter the following issue:


-------------------------------------------------------------------------
CESM BUILDEXE SCRIPT STARTING
rm: No match.
COMPILER is intel
- Build Libraries: mct gptl pio csm_share
Mon Jul 18 14:59:15 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/mct.bldlog.220718-145911
Mon Jul 18 15:00:08 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/gptl.bldlog.220718-145911
Mon Jul 18 15:00:12 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio.bldlog.220718-145911
ERROR: buildlib.pio failed, see /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio.bldlog.220718-145911
ERROR: cat /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio.bldlog.220718-145911


In this file "pio.bldlog.220718-145911" log file, I get the following error message:


[ 86%] Linking Fortran executable piotest
cd /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio/pio/unittests && /ccc/products2/cmake-3.9.1/Atos_7__x86_64/system/default/bin/cmake -E cmake_link_script CMakeFiles/piotest.dir/link.txt --verbose=1
/ccc/products/openmpi-4.0.5/intel--20.0.0/default/bin/mpif90 -fp-model source -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -O2 -DLINUX -DNDEBUG -DMCT_INTERFACE -DHAVE_MPI -DFORTRANUNDERSCORE -DNO_R16 -DLINUX -DCPRINTEL -DHAVE_SLASHPROC -I. -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/include -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/MCT/noesmf/a1l1r1i1o1g1w1/csm_share -I/ccc/products/netcdf-fortran-4.4.4/intel--20.0.0/hdf5__serial/include -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/include -I/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/csm_share/shr CMakeFiles/piotest.dir/basic_tests.F90.o CMakeFiles/piotest.dir/driver.F90.o CMakeFiles/piotest.dir/global_vars.F90.o CMakeFiles/piotest.dir/ncdf_tests.F90.o CMakeFiles/piotest.dir/nc_set_log_level2.c.o -o piotest -L/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/utils/pio/pio -L/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio/pio -L/ccc/products2/icc-20.0.0/Atos_7__x86_64/system/default/compilers_and_libraries_2020.0.166/linux/compiler/lib/intel64_lin -Wl,-rpath,/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/utils/pio/pio:/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio/pio ../libpio.a -LNETCDF_LIB_DIR-NOTFOUND -lnetcdff -LNETCDF_LIB_DIR-NOTFOUND -lnetcdf -lirng -ldecimal -lcilkrts -lstdc++
ld: cannot find -lnetcdff
ld: cannot find -lnetcdf
gmake[2]: *** [pio/unittests/piotest] Error 1
gmake[2]: Leaving directory `/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio'
gmake[1]: *** [pio/unittests/CMakeFiles/piotest.dir/all] Error 2
gmake[1]: Leaving directory `/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio'
gmake: *** [all] Error 2
exit 2


Clearly, this is because the path to the netcdf libraries is not found and it is replaced with "-LNETCDF_LIB_DIR-NOTFOUND". However, I believe that I define correctly the path to these libraries. Indeed, in my Macros file, I give the following variables:

NETCDF_PATH:=$(NETCDFFORTRAN_ROOT)
SLIBS+=-L$(NETCDFFORTRAN_ROOT)/lib -lnetcdf -L$(NETCDFC_ROOT)/lib -lnetcdff

where NETCDFFORTRAN_ROOT=/ccc/products/netcdf-fortran-4.4.4/intel--20.0.0/hdf5__serial is the environment variable leading to the netcdf-fortran library,
and NETCDFC_ROOT=/ccc/products/netcdf-c-4.6.0/intel--20.0.0/hdf5__serial/ is the analog for netcdf-c.

These variables are correctly read: when I write $(info NETCDF_PATH is $(NETCDF_PATH)) in the Makefile, the correct path is printed.

I tried several variable definition: write the absolute path instead of the environment variable, putting the path to the /lib of each library, remove the $(NETCDFC_ROOT) in SLIBS, define directly in Macros some variables that exist in Tools/Makefile but are not requested in the original Macros file (like NETCDF_LIB_DIR, LIB_NETCDF, etc.).
However, i still get the same error message.

The command line that causes the error message come from a "link.txt" file located in "$CASE/bld/intel/openmpi/nodebug/nothreads/pio/pio/unittests/CMakeFiles/piotest.dir/link.txt". I found another "link.txt" file located in "$CASE/bld/intel/openmpi/nodebug/nothreads/pio/pio/testpio/CMakeFiles/testpio.dir/link.txt". These "link.txt" files are created during the build phase and only contain one command line with the "-LNETCDF_LIB_DIR-NOTFOUND" options.
I tried to replace these "-LNETCDF_LIB_DIR-NOTFOUND" with the correct path. In that case, the build continues but raises anther error message :


-------------------------------------------------------------------------
CESM BUILDEXE SCRIPT STARTING
rm: No match.
COMPILER is intel
- Build Libraries: mct gptl pio csm_share
Mon Jul 18 15:01:03 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/mct.bldlog.220718-150059
Mon Jul 18 15:01:04 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/gptl.bldlog.220718-150059
Mon Jul 18 15:01:04 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/pio.bldlog.220718-150059
Mon Jul 18 15:01:11 CEST 2022 /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/csm_share.bldlog.220718-150059
ERROR: buildlib.csm_share failed, see /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/csm_share.bldlog.220718-150059
ERROR: cat /ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/csm_share.bldlog.220718-150059


In this file "csm_share.bldlog.220718-150059" log file, I get the following error message:


mpif90 -c -I. -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/include -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/MCT/noesmf/a1l1r1i1o1g1w1/csm_share -I/ccc/products/netcdf-fortran-4.4.4/intel--20.0.0/hdf5__serial/include -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/intel/openmpi/nodebug/nothreads/include -I/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/csm_share/shr -I. -I/ccc/scratch/cont003/gen10575/cozianba/test19/SourceMods/src.share -I/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/drv/shr -I/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/dead_share -I/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/csm_share/shr -I/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/utils/esmf_wrf_timemgr -I/ccc/scratch/cont003/gen10575/cozianba/test19/bld/lib/include -fp-model source -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -O2 -DNUM_COMP_INST_ATM=1 -DNUM_COMP_INST_LND=1 -DNUM_COMP_INST_OCN=1 -DNUM_COMP_INST_ICE=1 -DNUM_COMP_INST_GLC=1 -DNUM_COMP_INST_WAV=1 -DNUM_COMP_INST_ROF=1 -DLINUX -DNDEBUG -DMCT_INTERFACE -DHAVE_MPI -DFORTRANUNDERSCORE -DNO_R16 -DLINUX -DCPRINTEL -DHAVE_SLASHPROC -free /ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/drv/shr/seq_io_mod.F90
/ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/drv/shr/seq_io_mod.F90(1170): error #6404: This name does not have a type, and must have an explicit type. [PIO_UNLIMITED]
rcode = pio_def_dim(cpl_io_file,'time',PIO_UNLIMITED,dimid(1))
---------------------------------------------^
compilation aborted for /ccc/cont003/dsku/blanchet/home/user/enslyon/cozianba/cesm1_2_2/models/drv/shr/seq_io_mod.F90 (code 1)
gmake: *** [seq_io_mod.o] Error 1
gmake complib -j 1 MODEL=csm_share COMPLIB=libcsm_share.a USER_CPPDEFS=" -DNUM_COMP_INST_ATM=1 -DNUM_COMP_INST_LND=1 -DNUM_COMP_INST_OCN=1 -DNUM_COMP_INST_ICE=1 -DNUM_COMP_INST_GLC=1 -DNUM_COMP_INST_WAV=1 -DNUM_COMP_INST_ROF=1" -f /ccc/scratch/cont003/gen10575/cozianba/test19/Tools/Makefile returned non-zero exit status 2


I do not understand this error message, and I am afraid that perhaps my "fix" on the "link.txt" files hide the fact that CESM cannot access the correct path to the netcdf library.

In case it is usefull, here are the netcdf versions that I use :
- netcdf-fortran/4.4.4
- netcdf-c/4.6.0

Any help to move forward would be very much appreciated. Thanks!

Bastien
 

Attachments

  • create_case_test.log.txt
    8.7 KB · Views: 3
  • create_case_test.txt
    4 KB · Views: 2
  • csm_share.bldlog.220718-150059.txt
    59.3 KB · Views: 3
  • Macros.txt
    1.5 KB · Views: 3
  • env_mach_specific.txt
    799 bytes · Views: 3
  • pio.bldlog.220718-145911.txt
    75 KB · Views: 2

Cherry

Song Yuanjing
New Member
I met the same problem ‘buildlib.csm_share failed'. Have you solved it?
error #6404: This name does not have a type, and must have an explicit type. [PIO_UNLIMITED]
 
Top