Dear all,
I want to install NEMO mode on my laptop but got a few problems in the process.
I am trying to build XIOS2 with parallel NetCDF support on Ubuntu, but the compilation fails during the linking stage with multiple undefined reference to nc_* errors.
I would greatly appreciate your guidance.
Below I provide full system and dependency information for verification.
hidayatmn378@OCEAN-BRIN:~/XIOS2$ which mpicc
which mpif90
mpicc --version
mpif90 --version
mpirun --version
/usr/bin/mpicc
/usr/bin/mpif90
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mpirun (Open MPI) 4.1.6
Report bugs to http://www.open-mpi.org/community/help/
hidayatmn378@OCEAN-BRIN:~/XIOS2$ mpicc -show
mpif90 -show
gcc -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi
gfortran -I/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib/fortran/gfortran -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lopen-rte -lopen-pal -lhwloc -levent_core -levent_pthreads -lm -lz
hidayatmn378@OCEAN-BRIN:~/XIOS2$ /opt/nemo_libs/netcdf/bin/nc-config --version
/opt/nemo_libs/netcdf/bin/nc-config --has-parallel
/opt/nemo_libs/netcdf/bin/nc-config --has-parallel4
/opt/nemo_libs/netcdf/bin/nc-config --cflags
/opt/nemo_libs/netcdf/bin/nc-config --libs
netCDF 4.9.2
yes
yes
-I/opt/nemo_libs/netcdf/include -I/opt/nemo_libs/hdf5/include
-L/opt/nemo_libs/netcdf/lib -lnetcdf
hidayatmn378@OCEAN-BRIN:~/XIOS2$ /opt/nemo_libs/netcdf/bin/nf-config --version
/opt/nemo_libs/netcdf/bin/nf-config --flibs
/opt/nemo_libs/netcdf/bin/nf-config --fflags
netCDF-Fortran 4.6.1
-L/opt/nemo_libs/netcdf/lib -lnetcdff -L/opt/nemo_libs/netcdf/lib -L/opt/nemo_libs/hdf5/lib -lnetcdf -lnetcdf -lm
-I/opt/nemo_libs/netcdf/include -I/opt/nemo_libs/netcdf/include
hidayatmn378@OCEAN-BRIN:~/XIOS2$ /opt/nemo_libs/hdf5/bin/h5cc -showconfig | grep -i parallel
Parallel HDF5: ON
Parallel Filtered Dataset Writes: ON
Large Parallel I/O: ON
hidayatmn378@OCEAN-BRIN:~/XIOS2$ /opt/nemo_libs/hdf5/bin/h5pcc -showconfig | grep -i parallel
Parallel HDF5: ON
Parallel Filtered Dataset Writes: ON
Large Parallel I/O: ON
hidayatmn378@OCEAN-BRIN:~/XIOS2$ ls -l /opt/nemo_libs/netcdf/include/netcdf_par.h
-rw-r--r-- 1 hidayatmn378 hidayatmn378 1636 Feb 12 21:15 /opt/nemo_libs/netcdf/include/netcdf_par.h
hidayatmn378@OCEAN-BRIN:~/XIOS2$ ls -l /opt/nemo_libs/netcdf/lib/libnetcdf*
-rw-r--r-- 1 hidayatmn378 hidayatmn378 3075326 Feb 12 21:15 /opt/nemo_libs/netcdf/lib/libnetcdf.a
-rw-r--r-- 1 hidayatmn378 hidayatmn378 2474112 Feb 12 21:22 /opt/nemo_libs/netcdf/lib/libnetcdff.a
-rwxr-xr-x 1 hidayatmn378 hidayatmn378 1085 Feb 12 21:22 /opt/nemo_libs/netcdf/lib/libnetcdff.la
-rw-r--r-- 1 hidayatmn378 hidayatmn378 1268 Feb 12 21:22 /opt/nemo_libs/netcdf/lib/libnetcdff.settings
lrwxrwxrwx 1 hidayatmn378 hidayatmn378 19 Feb 12 21:22 /opt/nemo_libs/netcdf/lib/libnetcdff.so -> libnetcdff.so.7.2.0
lrwxrwxrwx 1 hidayatmn378 hidayatmn378 19 Feb 12 21:22 /opt/nemo_libs/netcdf/lib/libnetcdff.so.7 -> libnetcdff.so.7.2.0
-rwxr-xr-x 1 hidayatmn378 hidayatmn378 1650928 Feb 12 21:22 /opt/nemo_libs/netcdf/lib/libnetcdff.so.7.2.0
-rwxr-xr-x 1 hidayatmn378 hidayatmn378 1015 Feb 12 21:15 /opt/nemo_libs/netcdf/lib/libnetcdf.la
-rw-r--r-- 1 hidayatmn378 hidayatmn378 1296 Feb 12 21:15 /opt/nemo_libs/netcdf/lib/libnetcdf.settings
lrwxrwxrwx 1 hidayatmn378 hidayatmn378 19 Feb 12 21:15 /opt/nemo_libs/netcdf/lib/libnetcdf.so -> libnetcdf.so.19.2.2
lrwxrwxrwx 1 hidayatmn378 hidayatmn378 19 Feb 12 21:15 /opt/nemo_libs/netcdf/lib/libnetcdf.so.19 -> libnetcdf.so.19.2.2
-rwxr-xr-x 1 hidayatmn378 hidayatmn378 2194480 Feb 12 21:15 /opt/nemo_libs/netcdf/lib/libnetcdf.so.19.2.2
hidayatmn378@OCEAN-BRIN:~/XIOS2$ echo "NETCDF: $NETCDF"
echo "NETCDF_DIR: $NETCDF_DIR"
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
echo "PATH: $PATH"
NETCDF:
NETCDF_DIR:
LD_LIBRARY_PATH: /opt/nemo_libs/netcdf/lib:/opt/nemo_libs/hdf5/lib:
PATH: /opt/nemo_libs/netcdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
hidayatmn378@OCEAN-BRIN:~/XIOS2$ gcc --version
g++ --version
gfortran --version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Build Failure
The build fails at the linking stage with errors such as:
hidayatmn378@OCEAN-BRIN:~/XIOS2$ tail -50 xios_build.log
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutAttType<int>(int, int, char const*, unsigned long, int const*)': netCdfInterface.cpp:(.text+0xb0): undefined reference to nc_put_att_int’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutAttType<long>(int, int, char const*, unsigned long, long const*)': netCdfInterface.cpp:(.text+0xd0): undefined reference to nc_put_att_long’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutAttType<short>(int, int, char const*, unsigned long, short const*)': netCdfInterface.cpp:(.text+0xf0): undefined reference to nc_put_att_short’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutAttType<char>(int, int, char const*, unsigned long, char const*)': netCdfInterface.cpp:(.text+0x105): undefined reference to nc_put_att_text’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncGetVaraType<double>(int, int, unsigned long const*, unsigned long const*, double*)': netCdfInterface.cpp:(.text+0x115): undefined reference to nc_get_vara_double’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncGetVaraType<float>(int, int, unsigned long const*, unsigned long const*, float*)': netCdfInterface.cpp:(.text+0x125): undefined reference to nc_get_vara_float’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncGetVaraType<int>(int, int, unsigned long const*, unsigned long const*, int*)': netCdfInterface.cpp:(.text+0x135): undefined reference to nc_get_vara_int’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncGetVaraType<short>(int, int, unsigned long const*, unsigned long const*, short*)': netCdfInterface.cpp:(.text+0x145): undefined reference to nc_get_vara_short’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncGetVaraType<char>(int, int, unsigned long const*, unsigned long const*, char*)': netCdfInterface.cpp:(.text+0x155): undefined reference to nc_get_vara_text’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutVaraType<double>(int, int, unsigned long const*, unsigned long const*, double const*)': netCdfInterface.cpp:(.text+0x165): undefined reference to nc_put_vara_double’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutVaraType<float>(int, int, unsigned long const*, unsigned long const*, float const*)': netCdfInterface.cpp:(.text+0x175): undefined reference to nc_put_vara_float’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutVaraType<int>(int, int, unsigned long const*, unsigned long const*, int const*)': netCdfInterface.cpp:(.text+0x185): undefined reference to nc_put_vara_int’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutVaraType<short>(int, int, unsigned long const*, unsigned long const*, short const*)': netCdfInterface.cpp:(.text+0x195): undefined reference to nc_put_vara_short’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface.o): in function int xios::CNetCdfInterface::ncPutVaraType<char>(int, int, unsigned long const*, unsigned long const*, char const*)': netCdfInterface.cpp:(.text+0x1a5): undefined reference to nc_put_vara_text’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface_decl.o): in function int xios::CNetCdfInterface::getAttType<double>(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double*)': netCdfInterface_decl.cpp:(.text._ZN4xios16CNetCdfInterface10getAttTypeIdEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_[_ZN4xios16CNetCdfInterface10getAttTypeIdEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_]+0x29c): undefined reference to nc_strerror’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface_decl.o): in function int xios::CNetCdfInterface::putAttType<double>(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, double const*)': netCdfInterface_decl.cpp:(.text._ZN4xios16CNetCdfInterface10putAttTypeIdEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPKT_[_ZN4xios16CNetCdfInterface10putAttTypeIdEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPKT_]+0x2c7): undefined reference to nc_strerror’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface_decl.o): in function int xios::CNetCdfInterface::getAttType<float>(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float*)': netCdfInterface_decl.cpp:(.text._ZN4xios16CNetCdfInterface10getAttTypeIfEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_[_ZN4xios16CNetCdfInterface10getAttTypeIfEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_]+0x29c): undefined reference to nc_strerror’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface_decl.o): in function int xios::CNetCdfInterface::putAttType<float>(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, float const*)': netCdfInterface_decl.cpp:(.text._ZN4xios16CNetCdfInterface10putAttTypeIfEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPKT_[_ZN4xios16CNetCdfInterface10putAttTypeIfEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPKT_]+0x2c7): undefined reference to nc_strerror’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface_decl.o): in function int xios::CNetCdfInterface::getAttType<int>(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int*)': netCdfInterface_decl.cpp:(.text._ZN4xios16CNetCdfInterface10getAttTypeIiEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_[_ZN4xios16CNetCdfInterface10getAttTypeIiEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_]+0x29c): undefined reference to nc_strerror’
/usr/bin/ld: /home/hidayatmn378/XIOS2/lib/lib__fcm__generic_testcase.a(netcdfinterface_decl.o):netCdfInterface_decl.cpp:(.text.ZN4xios16CNetCdfInterface10putAttTypeIiEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPKT[ZN4xios16CNetCdfInterface10putAttTypeIiEEiiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPKT]+0x2c7): more undefined references to `nc_strerror’ follow
collect2: error: ld returned 1 exit status
fcm_internal load failed (256)
make: *** [/home/hidayatmn378/XIOS2/Makefile:7181: xios_server.exe] Error 1
make: *** Waiting for unfinished jobs…
collect2: error: ld returned 1 exit status
fcm_internal load failed (256)
make: *** [/home/hidayatmn378/XIOS2/Makefile:6020: generic_testcase.exe] Error 1
make -f /home/hidayatmn378/XIOS2/Makefile -j 8 all failed (2) at /home/hidayatmn378/XIOS2/tools/FCM_OLD/bin/../lib/Fcm/Build.pm line 597.
Build failed on Sat Feb 28 09:09:02 2026.
->Make: 344 seconds
->TOTAL: 353 seconds
Full build log attached as xios_build.log as well as my arch-linux_openmpi.fcm
Any guidance would be greatly appreciated.
Thank you very much for your time and assistance.
Best regards,
Dr. Muh. Nur Hidayat
Postdoctoral Researcher/BRIN Indonesia