HDFGroup / hdf5-iotest

HDF5 Performance Analysis Checklist
Other
12 stars 9 forks source link

hdf5iotest recipe does not compile with mpicc or supply libmpi to linker -> error adding symbols: DSO missing from command line #29

Open Noerr opened 1 year ago

Noerr commented 1 year ago

Following the spack install instructions, I arrive at the following error regarding undefined reference to ompi_mpi_byte and libmpi.so.40: error adding symbols: DSO missing from command line If we look at the gcc command line it seem odd that neither mpicc is used or -lmpi is explicitly linked.

mv -f .deps/hdf5_iotest.Tpo .deps/hdf5_iotest.Po
mv -f .deps/write_test.Tpo .deps/write_test.Po
/home/noah/spack/lib/spack/env/gcc/gcc  -g -O2   -o hdf5_iotest configuration.o dataset.o hdf5_iotest.o ini.o read_test.o utils.o write_test.o -lhdf5 -luuid
/usr/bin/ld: hdf5_iotest.o: undefined reference to symbol 'ompi_mpi_byte'
/usr/bin/ld: /home/noah/spack/opt/spack/linux-ubuntu22.04-icelake/gcc-11.3.0/openmpi-4.1.5-yofs4yotlug5xwx4lgkndha4jvwdcnsk/lib/libmpi.so.40: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:365: hdf5_iotest] Error 1
make[1]: Leaving directory '/tmp/noah/spack-stage/spack-stage-hdf5iotest-master-vrzqpeiaqi4rlery3yjdxms43gsykkuc/spack-src/src'
make: *** [Makefile:333: all-recursive] Error 1
Noerr commented 1 year ago

I was able to complete the build of hdf5_iotest executable by starting from this failed spack install, chdir into the /tmp spack build staging. Rexecute the final link command using mpicc.

/home/noah/spack/opt/spack/linux-ubuntu22.04-icelake/gcc-11.3.0/openmpi-4.1.5-yofs4yotlug5xwx4lgkndha4jvwdcnsk/bin/mpicc -g -O2   -o hdf5_iotest configuration.o dataset.o hdf5_iotest.o ini.o read_test.o utils.o write_test.o  -L /home/noah/spack/opt/spack/linux-ubuntu22.04-icelake/gcc-11.3.0/util-linux-uuid-2.38.1-mutzzr33dylliaew3ftjs2ksge4vtsmi/lib/ -L/home/noah/spack/opt/spack/linux-ubuntu22.04-icelake/gcc-11.3.0/hdf5-1.14.0-atpncwlkmdpd4ir53ladkxm2txpl77pr/lib/  -lhdf5 -luuid

Unlike other libraries, rpath doesn't get set so I have to set LD_LIBRARY_PATH

export LD_LIBRARY_PATH=/home/noah/spack/opt/spack/linux-ubuntu22.04-icelake/gcc-11.3.0/util-linux-uuid-2.38.1-mutzzr33dylliaew3ftjs2ksge4vtsmi/lib/:/home/noah/spack/opt/spack/linux-ubuntu22.04-icelake/gcc-11.3.0/hdf5-1.14.0-atpncwlkmdpd4ir53ladkxm2txpl77pr/lib/:${LD_LIBRARY_PATH}