dev-libs/hdf4.2.0-r3 needs -fPIC on amd64. It compiles without, but then gives problems when being linked with another application. Reproducible: Always Steps to Reproduce: 1. 2. 3. Portage 2.0.51-r3 (default-linux/amd64/2004.3, gcc-3.4.3, glibc-2.3.4.20040808-r1, 2.6.9-gentoo-r9n x86_64) ================================================================= System uname: 2.6.9-gentoo-r9n x86_64 AMD Athlon(tm) 64 Processor 3200+ Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r5 Automake: sys-devel/automake-1.8.5-r1 Binutils: sys-devel/binutils-2.15.90.0.1.1-r3 Headers: sys-kernel/linux26-headers-2.6.8.1-r1 Libtools: sys-devel/libtool-1.5.2-r7 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://ftp.easynet.nl/mirror/gentoo/ ftp://212.219.56.152/sites/www.ibiblio.org/gentoo/ ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X Xaw3d acpi alsa apache2 arts audiofile avi berkdb bitmap-fonts blas bzlib cdparanoia cdr crypt cscope cups dbase dga directfb divx4linux dvd dvdr escreen esd etwin exif f2c f77 fam fbcon fftw flac fortran ftp gd gdbm ggi gif gimpprint gphoto2 gpm gps gtk gtk2 gtkhtml imagemagick imlib ipv6 java javascript jikesjp2 jpeg junit kde lapack libgda libwww lzw lzw-tiff lzw-tiffmad mad mbox mime mng motif mozilla mpeg mpi mysql ncurses netcdf nls odbc oggvorbis opengl pam pdflib perl plotutils png postgres ppds python qt quicktime readline samba scanner sdl session slang sndfile spell ssl svg szip tcltk tcpd tetex threads tidy tiff truetype unicode usb userlocales wmf wxwindows xine xml xml2 xmms xpm xrandr xv xvid zlib"
I could test on other platform but I'd first need to know "another" application that uses it and what type of failure are we talking about ... doesn't compile, doesn't return good data , doesn't ...
I'm using a library called GDAL (http://www.gdal.org/index.html) which can link against libHDF. If libhdf has not been compiled using -fPIC, the linking fails and the final GDAL shared library file will not be built. I get an message saying I should recompile with -fPIC. This is the only app that I use that uses libhdf, and I know it is not in portage (and I am always using the cvs version, so for me it makes no sense to put it in portage too), but it is a library I am using almost daily and relying on to read satellite data in HDF format, so it is quite important for me. If you don't want to change the compile options of libhdf just for this case, maybe a -fpic use flag could be considered? Or is there already one?
Created attachment 49375 [details, diff] Patch against hdf-4.2 Makefiles for shared library support
Created attachment 49376 [details, diff] Patch against hdf-4.2.0-r3.ebuild to enable above patch + a little cleanup (e.g. fortan.eclass) Please test these 2 patches and report back ;-) The first one goes to /usr/portage/sci-libs/hdf/files, the second one has to be applied on the ebuild itself.
Doesn't even compile for me now (with the above 2 patches applied): g77 -shared .libs/atom.o .libs/bitvect.o .libs/cdeflate.o .libs/cnbit.o .libs/cnone.o .libs/crle.o .libs/cskphuff.o .libs/cszip.o .libs/df24.o .libs/df24f.o .libs/dfan.o .libs/dfcomp.o .libs/dfconv.o .libs/dfgr.o.libs/dfgroup.o .libs/dfimcomp.o .libs/dfjpeg.o .libs/dfkconv.o .libs/dfkcray.o .libs/dfkfuji.o .libs/dfknat.o .libs/dfkswap.o .libs/dfkvms.o .libs/dfp.o .libs/dfr8.o .libs/dfrle.o .libs/dfsd.o .libs/dfstubs.o .libs/dfufp2i.o .libs/dfunjpeg.o .libs/dfutil.o .libs/dynarray.o .libs/glist.o .libs/hbitio.o .libs/hblocks.o .libs/hbuffer.o .libs/hchunks.o .libs/hcomp.o .libs/hcompri.o .libs/hdfalloc.o .libs/herr.o .libs/hextelt.o.libs/hfile.o .libs/hfiledd.o .libs/hkit.o .libs/linklist.o .libs/mcache.o .libs/mfan.o .libs/mfgr.o .libs/mstdio.o .libs/tbbt.o .libs/vattr.o .libs/vconv.o .libs/vg.o .libs/vgp.o .libs/vhi.o .libs/vio.o .libs/vparse.o .libs/vrw.o .libs/vsfld.o .libs/df24ff.o .libs/dfanf.o .libs/dfanff.o .libs/dff.o .libs/dfff.o .libs/dfpf.o .libs/dfpff.o .libs/dfr8f.o .libs/dfr8ff.o .libs/dfsdf.o .libs/dfsdff.o .libs/dfufp2if.o .libs/dfutilf.o .libs/herrf.o .libs/hfilef.o .libs/hfileff.o .libs/mfanf.o .libs/mfgrf.o .libs/mfgrff.o .libs/vattrf.o.libs/vattrff.o .libs/vgf.o .libs/vgff.o -Wl,--rpath -Wl,/usr/lib -Wl,--rpath -Wl,/usr/lib -lm -lsz /usr/lib/libjpeg.so -lz -Wl,-soname -Wl,libdf.so.0 -o .libs/libdf.so.0.0.0 /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.3/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/df24ff.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC .libs/df24ff.o: could not read symbols: Bad value collect2: ld returned 1 exit status make[3]: *** [libdf.la] Error 1 make[3]: Leaving directory `/var/tmp/portage/hdf-4.2.0-r3/work/hdf4.2r0/hdf/src' make[2]: *** [all] Error 2 make[2]: Leaving directory `/var/tmp/portage/hdf-4.2.0-r3/work/hdf4.2r0/hdf/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/hdf-4.2.0-r3/work/hdf4.2r0/hdf' make: *** [all-recursive] Error 1
Would you please try again after upgrading libtool to testing version 1.5.10-r3 ?
you need to pass -fPIC (and -DPIC) to g77 (see LLFLAGS in hdf/src/Makefile)
Stkn pointed me on a flaw during ./configure. Vincent: please attach the config.log file generated during ./configure from /var/tmp/portage/hdf-4.2.0-r2/work/hdf-4.2r0/
Created attachment 49475 [details] config.log configure reports: checking for g77 option to produce PIC... -fPIC checking if g77 PIC flag -fPIC works... no
> checking if g77 PIC flag -fPIC works... no That's what I found too. I thought I did post that to this bug, but somehow it has disappeared somewhere on in between my pc and bugzilla... Indeed the configure script finds that g77 doesn't support -fPIC. However, when manually setting FFLAGS to -fPIC before emerging, the emerge finishes without errors. So the configure test for g77 supporting -fPIC is wrong.
Created attachment 49478 [details, diff] Patch against hdf-4.2.0-r3.ebuild to enable above patch + a little cleanup (e.g. fortan.eclass) + sed magic to disallow -Wsign-compare for g77 in FFLAGS Vincent + stkn: Please test this new patch against hdf-4.2.0-r3.ebuild
Works for me. Thanks.
InCVS now