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.
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 against
H5Iget_type' in read-only section `.text' collect2: error: ld returned 1 exit statusAdding this line that sets CMAKE_POSITION_INDEPENDENT_CODE ON in CMakeLists.txt fixes the link error.