Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to build static library even with -DBUILD_SHARED_LIBS=OFF #2917

Closed
rhaas80 opened this issue Oct 20, 2021 · 0 comments · Fixed by #2919
Closed

failed to build static library even with -DBUILD_SHARED_LIBS=OFF #2917

rhaas80 opened this issue Oct 20, 2021 · 0 comments · Fixed by #2919

Comments

@rhaas80
Copy link
Contributor

rhaas80 commented Oct 20, 2021

We ask the community to always report bugs. Please open a new issue if some other comes up in the conversation. It will help us stay on topic and manage tasks more efficiently.

Describe the bug
I tried to build with -DBUILD_SHARED_LIBS=OFF and -DADIOS2_USE_HDF5=ON with only a static HDF5 library installed. The build aborted with:

[ 80%] Linking CXX shared library ../../lib/libadios2_h5vol.so
/usr/bin/ld: /data/rhaas/tmp/ADIOS2_Test/hdf5/lib/libhdf5.a(H5Pint.o): warning: relocation against `H5P_CLS_VOL_INITIALIZE_g' in read-only section `.text'
/usr/bin/ld: /data/rhaas/tmp/ADIOS2_Test/hdf5/lib/libhdf5.a(H5FL.o): relocation R_X86_64_PC32 against symbol `H5FL_init_g' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [source/h5vol/CMakeFiles/adios2_h5vol.dir/build.make:223: lib/libadios2_h5vol.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:705: source/h5vol/CMakeFiles/adios2_h5vol.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

while trying to link a shared library ../../lib/libadios2_h5vol.so .

To Reproduce
Building HDF5 and ADIOS2 to ensure only static HDF5 is present:

mkdir ADIOS2_Test
cd ADIOS2_Test
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.1/src/hdf5-1.12.1.tar.gz
tar -xf hdf5-1.12.1.tar.gz
cd hdf5-1.12.1/
./configure --prefix=$PWD/../hdf5 --enable-shared=no --enable-static=yes
make
make install
cd ../
wget https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.7.1.tar.gz
tar -xf v2.7.1.tar.gz
cd ADIOS2-2.7.1
mkdir build
cd build
cmake -DHDF5_ROOT=$PWD/../../hdf5 -DADIOS2_USE_HDF5=ON -DBUILD_SHARED_LIBS=OFF -DADIOS2_USE_Python=OFF -DADIOS2_USE_ZeroMQ=OFF -DADIOS2_USE_SST=OFF -DBUILD_TESTING=OFF -DADIOS2_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$PWD/../../adios2 -DCMAKE_INSTALL_LIBDIR=lib ..
make

Expected behavior
Code should compile and produce onlys static libraries.

Desktop (please complete the following information):

  • OS/Platform: Debian Bullseye
  • Build: gcc 11, cmake 3.21.3 build option see above, OpenMPI 4.1.2 (found by ADIOS), HDF5 self-compiled, static only (see above)

Additional context
Only happens when hdf5_vol is used ie hdf5 is newer than 1.11.

Following up
Was the issue fixed? Please report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant