HDFGroup / vol-async

Asynchronous I/O for HDF5
https://hdf5-vol-async.readthedocs.io
Other
21 stars 13 forks source link

Set CMAKE_POSITION_INDEPENDENT_CODE ON #27

Closed lrknox closed 2 years ago

lrknox commented 2 years ago

When attempting to create a spack package hdf-vol-cache, vol-cache linking to libasynchdf5.a failed. Building vol-async and vol-cache according to instructions in https://github.com/hpc-io/vol-cache/README.md results in this same link error:
[ 18%] Linking C shared library libh5cache_vol.so /usr/bin/ld: /global/homes/l/lrknox/dt-cori/voltest/install/vols/lib/libasynchdf5.a(h5_async_lib.c.o): relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /global/homes/l/lrknox/dt-cori/voltest/install/vols/lib/libasynchdf5.a(h5_async_lib.c.o): warning: relocation againstH5Iget_type' in read-only section `.text' collect2: error: ld returned 1 exit status

Adding this line that sets CMAKE_POSITION_INDEPENDENT_CODE ON in CMakeLists.txt fixes the link error.

lrknox commented 2 years ago

@houjun, please review PR #2, needed for CMake builds of vol-cache with vol-async