[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #AQT-880974]: shared library build fails, missing symbols



Hello,

This is very odd; can you provide the 'config.log' file generated when you run 
configure for the shared library?

-Ward

> libnetcdf.so is missing some symbols (see error below). However, libnetcdf.a 
> contains the missing symbols.
> 
> 
> Error reported during make
> ```
> /bin/bash ../libtool  --tag=CC   --mode=link h5pcc  -fPIC -O0 -g  
> -L/usr/lib/x86_64-linux-gnu/hdf5/mpich/ -lhdf5_hl -lhdf5 -o ncgen3 main.o 
> load.o escapes.o getfill.o init.o genlib.o ncgentab.o ../liblib/libnetcdf.la 
> -lm
> libtool: link: h5pcc -fPIC -O0 -g -o .libs/ncgen3 main.o load.o escapes.o 
> getfill.o init.o genlib.o ncgentab.o  -L/usr/lib/x86_64-linux-gnu/hdf5/mpich/ 
> ../liblib/.libs/libnetcdf.so -lhdf5_hl -lhdf5 -lm -Wl,-rpath 
> -Wl,/home/user/netcdf-c-4.7.4-install/lib
> /usr/bin/ld: main.o: in function `usage':
> /home/user/netcdf-c-4.7.4/ncgen3/main.c:83: undefined reference to 
> `nc_inq_libvers'
> /usr/bin/ld: load.o: in function `gen_load_c':
> /home/user/netcdf-c-4.7.4/ncgen3/load.c:104: undefined reference to `strlcat'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:276: undefined reference 
> to `strlcat'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:277: undefined reference 
> to `strlcat'
> /usr/bin/ld: load.o: in function `load_netcdf':
> /home/user/netcdf-c-4.7.4/ncgen3/load.c:547: undefined reference to 
> `nc_put_vara_schar'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:551: undefined reference 
> to `nc_put_vara_text'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:554: undefined reference 
> to `nc_put_vara_short'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:557: undefined reference 
> to `nc_put_vara_int'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:560: undefined reference 
> to `nc_put_vara_float'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/load.c:563: undefined reference 
> to `nc_put_vara_double'
> /usr/bin/ld: genlib.o: in function `gen_netcdf':
> /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:45: undefined reference to 
> `nc_create'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:50: undefined 
> reference to `nc_def_dim'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:56: undefined 
> reference to `nc_def_var'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:70: undefined 
> reference to `nc_put_att_schar'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:75: undefined 
> reference to `nc_put_att_text'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:80: undefined 
> reference to `nc_put_att_short'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:85: undefined 
> reference to `nc_put_att_int'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:90: undefined 
> reference to `nc_put_att_float'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:95: undefined 
> reference to `nc_put_att_double'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:106: undefined 
> reference to `nc_set_fill'
> /usr/bin/ld: /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:110: undefined 
> reference to `nc_enddef'
> /usr/bin/ld: genlib.o: in function `cl_netcdf':
> /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:1260: undefined reference to 
> `nc_close'
> /usr/bin/ld: genlib.o: in function `check_err':
> /home/user/netcdf-c-4.7.4/ncgen3/genlib.c:1617: undefined reference to 
> `nc_strerror'
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:717: ncgen3] Error 1
> make[2]: Leaving directory '/home/user/netcdf-c-4.7.4/ncgen3'
> make[1]: *** [Makefile:707: all-recursive] Error 1
> make[1]: Leaving directory '/home/user/netcdf-c-4.7.4'
> make: *** [Makefile:552: all] Error 2
> ```
> 
> here is my configure line
> ```
> export HDF5_USE_SHLIB=yes; ./configure CC=h5pcc CFLAGS="-fPIC -O0 -g" 
> LDFLAGS="-L/usr/lib/x86_64-linux-gnu/hdf5/mpich/ -lhdf5_hl -lhdf5" 
> --enable-shared  --enable-static --disable-dap --enable-parallel-4 
> --prefix=/home/user/netcdf-c-4.7.4-install
> ```
> 
> The use of h5pcc was because hdf5 libraries are installed from the apt 
> package manager in a spot where they cannot be found by netcdf. The use of 
> and HDF5_USE_SHLIB=yes was because the hdf5 installed from the apt package 
> manager was not linked with -fPIC and hence had to force it to use shared 
> libraries.
> 
> 
> 


Ticket Details
===================
Ticket ID: AQT-880974
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.