SeismicData / asdf-library

Adaptable Seismic Data Format
16 stars 10 forks source link

compile error #27

Closed brioglade closed 3 years ago

brioglade commented 3 years ago

cmake . -DCMAKE_Fortran_COMPILER=h5pfc make

[ 85%] Built target write_example_f90 Scanning dependencies of target write_ASDF [ 92%] Building C object examples/CMakeFiles/write_ASDF.dir/write_ASDF.c.o [100%] Linking CXX executable write_ASDF /usr/bin/ld: cannot find -lhdf5 collect2: error: ld returned 1 exit status make[2]: [examples/CMakeFiles/write_ASDF.dir/build.make:92: examples/write_ASDF] Error 1 make[1]: [CMakeFiles/Makefile2:181: examples/CMakeFiles/write_ASDF.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

➜ asdf-library git:(master) ✗ h5pfc --version
GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 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.

but i have -lhdf5 already. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ufo/opt/hdf5/lib export PATH=$PATH:/home/ufo/opt/hdf5/bin export CPATH=:$CPATH:/home/ufo/opt/hdf5/include

1sbeller commented 3 years ago

Try something like this

cmake . -DCMAKE_Fortran_COMPILER="$HDF5_FC" -DCMAKE_Fortran_FLAGS="$FCFLAGS" \
-DCMAKE_C_COMPILER="$HDF5_CC" -DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CFLAGS"
make

where quoted environement variables are h5pfc for fortran compiler and h5pcc for the C compiler and whatever you need for C, C++ and Fortran flags.

brioglade commented 3 years ago

yee,it works!Thank you very much!