Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 775305 - sci-libs/hdf5-1.10.5-r1[fortran] with slibtool: relocation R_X86_64_PC32 against symbol `__h5fortran_types_MOD_fortran_integer_avail_kinds' can not be used when making a shared object; recompile with -fPIC
Summary: sci-libs/hdf5-1.10.5-r1[fortran] with slibtool: relocation R_X86_64_PC32 agai...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: slibtool
  Show dependency tree
 
Reported: 2021-03-10 21:32 UTC by Alessandro Barbieri
Modified: 2021-03-22 15:54 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
buildlog (hdf5-1.10.5-r1:20210310-193350.tar.xz,100.36 KB, application/x-xz)
2021-03-10 21:35 UTC, Alessandro Barbieri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Barbieri 2021-03-10 21:32:17 UTC
slibtool --tag=FC   --mode=compile mpif90  -I. -I../../src     -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising -Wno-c-binding-type  -s -O2 -I../../src -I../../fortran/src -Os -pipe -march=native -c -o HDF5.lo HDF5.F90
slibtool: compile: mpif90 -I. -I../../src -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising -Wno-c-binding-type -s -O2 -I../../src -I../../fortran/src -Os -pipe -march=native -c HDF5.F90 -DPIC -o .libs/HDF5.o
slibtool: compile: mpif90 -I. -I../../src -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising -Wno-c-binding-type -s -O2 -I../../src -I../../fortran/src -Os -pipe -march=native -c HDF5.F90 -o HDF5.o
slibtool  --tag=FC   --mode=link mpif90 -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising -Wno-c-binding-type  -s -O2 -I../../src -I../../fortran/src -Os -pipe -march=native -version-info 102:0:0  -Wl,-O1 -Wl,--as-needed -lmpi -o libhdf5_fortran.la -rpath /usr/lib64 H5f90global.lo H5fortran_types.lo H5_ff.lo H5Aff.lo H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Off.lo H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo H5_gen.lo H5fortkit.lo H5f90kit.lo H5_f.lo H5Af.lo H5Df.lo H5Ef.lo H5Ff.lo H5Gf.lo H5If.lo H5Lf.lo H5Of.lo H5Pf.lo H5Rf.lo H5Sf.lo H5Tf.lo H5Zf.lo HDF5.lo ../../src/libhdf5.la -lsz -lz -ldl -lm 
slibtool: link: x86_64-pc-linux-gnu-ar crs .libs/libhdf5_fortran.a .libs/H5f90global.o .libs/H5fortran_types.o .libs/H5_ff.o .libs/H5Aff.o .libs/H5Dff.o .libs/H5Eff.o .libs/H5Fff.o .libs/H5Gff.o .libs/H5Iff.o .libs/H5Lff.o .libs/H5Off.o .libs/H5Pff.o .libs/H5Rff.o .libs/H5Sff.o .libs/H5Tff.o .libs/H5Zff.o .libs/H5_gen.o .libs/H5fortkit.o .libs/H5f90kit.o .libs/H5_f.o .libs/H5Af.o .libs/H5Df.o .libs/H5Ef.o .libs/H5Ff.o .libs/H5Gf.o .libs/H5If.o .libs/H5Lf.o .libs/H5Of.o .libs/H5Pf.o .libs/H5Rf.o .libs/H5Sf.o .libs/H5Tf.o .libs/H5Zf.o .libs/HDF5.o
slibtool: link: mpif90 .libs/H5f90global.o .libs/H5fortran_types.o .libs/H5_ff.o .libs/H5Aff.o .libs/H5Dff.o .libs/H5Eff.o .libs/H5Fff.o .libs/H5Gff.o .libs/H5Iff.o .libs/H5Lff.o .libs/H5Off.o .libs/H5Pff.o .libs/H5Rff.o .libs/H5Sff.o .libs/H5Tff.o .libs/H5Zff.o .libs/H5_gen.o .libs/H5fortkit.o .libs/H5f90kit.o .libs/H5_f.o .libs/H5Af.o .libs/H5Df.o .libs/H5Ef.o .libs/H5Ff.o .libs/H5Gf.o .libs/H5If.o .libs/H5Lf.o .libs/H5Of.o .libs/H5Pf.o .libs/H5Rf.o .libs/H5Sf.o .libs/H5Tf.o .libs/H5Zf.o .libs/HDF5.o -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising -Wno-c-binding-type -s -O2 -I../../src -I../../fortran/src -Os -pipe -march=native -Wl,-O1 -Wl,--as-needed -lmpi -L../../src/.libs -lhdf5 -lmpi -lsz -lz -ldl -lm -lsz -lz -ldl -shared -fPIC -Wl,-soname -Wl,libhdf5_fortran.so.102 -o .libs/libhdf5_fortran.so.102.0.0
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/H5_ff.o: warning: relocation against `__h5global_MOD_h5fd_mpio_f' in read-only section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/H5_ff.o: relocation R_X86_64_PC32 against symbol `__h5fortran_types_MOD_fortran_integer_avail_kinds' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
slibtool: exec error upon slbt_exec_link_create_library(), line 1446: (see child process error messages).
slibtool: < returned to > slbt_exec_link(), line 1836.
make[3]: *** [Makefile:971: libhdf5_fortran.la] Error 2
make[3]: Leaving directory '/var/tmp/portage/sci-libs/hdf5-1.10.5-r1/work/hdf5-1.10.5/fortran/src'
make[2]: *** [Makefile:876: all] Error 2
make[2]: Leaving directory '/var/tmp/portage/sci-libs/hdf5-1.10.5-r1/work/hdf5-1.10.5/fortran/src'
make[1]: *** [Makefile:816: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/sci-libs/hdf5-1.10.5-r1/work/hdf5-1.10.5/fortran'
make: *** [Makefile:658: all-recursive] Error 1
 * ERROR: sci-libs/hdf5-1.10.5-r1::gentoo failed (compile phase):
 *   emake failed
Comment 1 Alessandro Barbieri 2021-03-10 21:35:09 UTC
Created attachment 690591 [details]
buildlog
Comment 2 Ionen Wolkens gentoo-dev 2021-03-12 07:41:34 UTC
(please avoid using tar when compressing >1MB build.log)
Comment 3 orbea 2021-03-20 00:06:38 UTC
Easiest way to fix this is by appending -fPIC to FCFLAGS in the ebuild, GNU libtool seems to be doing it automatically for some reason...
Comment 4 Larry the Git Cow gentoo-dev 2021-03-20 02:20:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efb09755aa2d0231c64b1564593345d160e9ad05

commit efb09755aa2d0231c64b1564593345d160e9ad05
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-03-20 02:20:10 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-03-20 02:20:10 +0000

    sci-libs/hdf5: fix build with slibtool
    
    It's not completely clear how slibtool should've
    known to append -fPIC, but let's not worry too much
    for now.
    
    Closes: https://bugs.gentoo.org/775305
    Signed-off-by: Sam James <sam@gentoo.org>

 sci-libs/hdf5/hdf5-1.10.5-r1.ebuild | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 5 orbea 2021-03-22 15:54:47 UTC
I don't fully understand how, but I strongly suspect GNU libtool implicitly adds -fPIC itself for --tag=FC. Probably the best that can be done is enable it for those builds when it is truly needed, do all fortran builds actually need it?

In /usr/bin/libtool there is this line:

  # ### BEGIN LIBTOOL TAG CONFIG: FC

And shortly below it:

  # Additional compiler flags for building library objects.
  pic_flag=" -fPIC"