1.12.1: undefined reference to `nc_get_var_text' etc.

Sebastian Schubert schubert.seb at gmail.com
Mon Dec 7 09:22:27 CST 2020


Hi all

I try to compile the NetCDF library with pnetcdf support. For that, I 
first compile the NetCDF library without pnetcdf and then pnetcdf with

MPICC=mpiicc MPICXX=mpiicpc MPIF77=mpiifort MPIF90=mpiifort ./configure 
--prefix=/programs/intel-2019.5/pnetcdf/1.12.1 --enable-netcdf4 
--enable-shared

using the Intel compiler suite 2019 update 5. All tests were successful.

Now I try to recompile NetCDF with pnetcdf support. The configure script 
fails, though, running

mpiicc -o conftest conftest.c -lpnetcdf  -lhdf5_hl -lhdf5 -lm -lz -lcurl

with conftest.c being

#ifdef __cplusplus
extern "C"
#endif
char ncmpi_create ();
int
main ()
{
return ncmpi_create ();
   ;
   return 0;
}

The error:

/programs/intel-2019.5/pnetcdf/1.12.1/lib/libpnetcdf.so: undefined 
reference to `nc_get_var_text'
/programs/intel-2019.5/pnetcdf/1.12.1/lib/libpnetcdf.so: undefined 
reference to `nc_get_varm_ulonglong'
/programs/intel-2019.5/pnetcdf/1.12.1/lib/libpnetcdf.so: undefined 
reference to `nc_put_att_uchar'
/programs/intel-2019.5/pnetcdf/1.12.1/lib/libpnetcdf.so: undefined 
reference to `nc_put_vara_uint'
...

Obviously, this refers to the NetCDF library. Adding -lnetcdf fixes 
this. However, I get other errors during the compilation.

Now the strange thing is that I was able to compile everything with a 
more recent version of the Intel compiler using the very same approach.

Do you have any idea what is happening? Sorry if I did something stupid...

Thanks a lot
Sebastian


More information about the parallel-netcdf mailing list