netcdf-c icon indicating copy to clipboard operation
netcdf-c copied to clipboard

Cannot link with libraries: /usr/bin/ld: cannot find -lhwloc /usr/bin/ld: cannot find -levent_core /usr/bin/ld: cannot find -levent_pthreads

Open feiliuesmf opened this issue 1 year ago • 2 comments

To report a non-security related issue, please provide:

  • the version of the software with which you are encountering an issue 4.9.2
  • environmental information (i.e. Operating System, compiler info, java version, python version, etc.) Linux, gnu 8.5.0
  • a description of the issue with the steps needed to reproduce it

Cannot find link libraries. Is there a way to not link with the specific libraries that are missing. It's not a system I can configure myself. Thanks,

/bin/sh ../libtool --tag=CC --mode=link mpicc -fPIC -g -O3 -I/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/include -Wimplicit-function-declaration -fno-strict-aliasing -version-info 21:2:2 -L/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib -o libnetcdf.la -rpath /p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/netcdf-c-4.9.2-install/lib libnetcdf_la-nc_initialize.lo ../libdispatch/libnetcdf2.la ../libdispatch/libdispatch.la ../libsrc/libnetcdf3.la ../libhdf5/libnchdf5.la ../libsrc4/libnetcdf4.la ../libnczarr/libnczarr.la ../libncpoco/libncpoco.la -lm -ldl -lbz2 -lzstd -lcurl -lhdf5 -lhdf5_hl -lz libtool: link: mpicc -shared -fPIC -DPIC .libs/libnetcdf_la-nc_initialize.o -Wl,--whole-archive ../libdispatch/.libs/libnetcdf2.a ../libdispatch/.libs/libdispatch.a ../libsrc/.libs/libnetcdf3.a ../libhdf5/.libs/libnchdf5.a ../libsrc4/.libs/libnetcdf4.a ../libnczarr/.libs/libnczarr.a ../libncpoco/.libs/libncpoco.a -Wl,--no-whole-archive -Wl,-rpath -Wl,/opt/scyld/openmpi/4.0.7/gnu/lib -Wl,-rpath -Wl,/opt/scyld/pbs/lib -Wl,-rpath -Wl,/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib -Wl,-rpath -Wl,/opt/scyld/openmpi/4.0.7/gnu/lib -Wl,-rpath -Wl,/opt/scyld/pbs/lib -Wl,-rpath -Wl,/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib -L/opt/scyld/pbs/lib/.libs -L/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib /opt/scyld/openmpi/4.0.7/gnu/lib/libmpi.so -L/opt/scyld/pbs/lib -L/opt/scyld/slurm/lib64 -L/opt/scyld/openmpi/4.0.7/gnu/lib /opt/scyld/openmpi/4.0.7/gnu/lib/libopen-rte.so /opt/scyld/openmpi/4.0.7/gnu/lib/libopen-pal.so -lucp -luct -lucm -lucs -lpmi2 -lpmi /opt/scyld/pbs/lib/libpbs.so -lcrypt -lpthread -lcrypto -lrt -lutil -lhwloc -levent_core -levent_pthreads -lstdc++ -lbz2 -lzstd -lcurl /p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib/libhdf5_hl.so /p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib/libhdf5.so -ldl -lm -lz -g -O3 -Wl,-soname -Wl,libnetcdf.so.19 -o .libs/libnetcdf.so.19.2.2 /usr/bin/ld: cannot find -lhwloc /usr/bin/ld: cannot find -levent_core /usr/bin/ld: cannot find -levent_pthreads collect2: error: ld returned 1 exit status gmake[2]: *** [Makefile:618: libnetcdf.la] Error 1 gmake[2]: Leaving directory '/p/app/projects/espc/software/gnu-8.5.0/openmpi-4.0.7/netcdf-c-4.9.2/liblib' gmake[1]: *** [Makefile:769: all-recursive] Error 1 gmake[1]: Leaving directory '/p/app/projects/espc/software/gnu-8.5.0/openmpi-4.0.7/netcdf-c-4.9.2' gmake: *** [Makefile:614: all] Error 2

BTW I can link the library explicitly without those 3 libraries, mpicc -shared -fPIC -DPIC .libs/libnetcdf_la-nc_initialize.o -Wl,--whole-archive ../libdispatch/.libs/libnetcdf2.a ../libdispatch/.libs/libdispatch.a ../libsrc/.libs/libnetcdf3.a ../libhdf5/.libs/libnchdf5.a ../libsrc4/.libs/libnetcdf4.a ../libnczarr/.libs/libnczarr.a ../libncpoco/.libs/libncpoco.a -Wl,--no-whole-archive -Wl,-rpath -Wl,/opt/scyld/openmpi/4.0.7/gnu/lib -Wl,-rpath -Wl,/opt/scyld/pbs/lib -Wl,-rpath -Wl,/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib -Wl,-rpath -Wl,/opt/scyld/openmpi/4.0.7/gnu/lib -Wl,-rpath -Wl,/opt/scyld/pbs/lib -Wl,-rpath -Wl,/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib -L/opt/scyld/pbs/lib/.libs -L/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib /opt/scyld/openmpi/4.0.7/gnu/lib/libmpi.so -L/opt/scyld/pbs/lib -L/opt/scyld/slurm/lib64 -L/opt/scyld/openmpi/4.0.7/gnu/lib /opt/scyld/openmpi/4.0.7/gnu/lib/libopen-rte.so /opt/scyld/openmpi/4.0.7/gnu/lib/libopen-pal.so -lucp -luct -lucm -lucs -lpmi2 -lpmi /opt/scyld/pbs/lib/libpbs.so -lcrypt -lpthread -lcrypto -lrt -lutil -lstdc++ -lbz2 -lzstd -lcurl /p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib/libhdf5_hl.so /p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib/libhdf5.so -ldl -lm -lz -g -O3 -Wl,-soname -Wl,libnetcdf.so.19 -o .libs/libnetcdf.so.19.2.2

I am wondering why netcdf-c brings in those 3 unnecessary libraries and is there a way not have link with those 3 libraries by configuring netcdf?

Thanks

If you have a general question about the software, please view our Suggested Support Process.

feiliuesmf avatar Mar 04 '24 15:03 feiliuesmf

I'm not certain where these dependencies are being inherited from, they are not libraries we check for or link against. I would suspect they are dependencies used by mpi, but I cannot say for certain. Linking on my machine (MacOS) does not result in the same dependencies.

What platform are you working on? If it's a standard linux distribution, I can stand up a VM easily enough and see if I can recreate the issue.

WardF avatar Mar 04 '24 17:03 WardF

Thanks, This is on a Linux HPC machine: Linux version 4.18.0-425.19.2.el8_7.x86_64 ([email protected]) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-16) (GCC))

I ran into the same 3 library linking issues with either intel or gnu compilers. In my initial message I meant I could manually link if I remove the 3 libraries so the 3 libraries are not essential. I have no idea how configure picked up the 3 libraries either.

Right now I am using gnu 8.5.0 openmpi 4.0.7, here is how I am setting up configure. I can build netcdf-c with this configure on my local linux machine. Let me know if I can provide any other information.

CXX=mpic++ FC=mpif90 CC=mpicc CFLAGS='-fPIC -g -O3 -I/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/include -Wimplicit-function-declaration' LDFLAGS='-L/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/hdf5-1.14.3-install/lib' LIBS='-lhdf5 -lhdf5_hl -lz' ./configure --prefix=/p/app/projects/espc/software/install/gnu-8.5.0/openmpi-4.0.7/netcdf-c-4.9.2-install --enable-hdf5 --disable-dap -disable-libxml2 --disable-byterange && gmake -j && gmake install

feiliuesmf avatar Mar 04 '24 17:03 feiliuesmf