Bug#608902: FTBFS with binutils-gold or ld --no-add-needed (and ld --as-needed)
Matthias Klose
doko at ubuntu.com
Tue Jan 4 14:04:30 UTC 2011
Package: petsc
Version: 3.1.dfsg-10
Severity: important
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu natty ubuntu-patch
User: debian-gcc at lists.debian.org
Usertags: ld-as-needed
User: peter.fritzsche at gmx.de
Usertags: no-add-needed
for the background, please see http://wiki.debian.org/ToolChain/DSOLinking
The package fails in the configury when built with -Wl,--no-add-needed
$ mpicxx -Wl,--no-add-needed -save-temps -o conftest hyp.c -Wall
-Wwrite-strings -Wno-strict-aliasing -g -L/usr/lib -L/usr/lib -lHYPRE -llapack
-lblas -L/usr/lib/openmpi/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.5.2 -ldl -lmpi
-lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -lmpi_f90 -lmpi_f77
-lgfortran -lm -lm -lm -lm -L/usr/lib/openmpi/lib
-L/usr/lib/gcc/x86_64-linux-gnu/4.5.2 -ldl -lmpi -lopen-rte -lopen-pal -lnsl
-lutil -lgcc_s -lpthread -ldl
/usr/bin/ld: hyp.o: undefined reference to symbol 'HYPRE_IJMatrixCreate'
/usr/bin/ld: note: 'HYPRE_IJMatrixCreate' is defined in DSO
/usr/lib64/libHYPRE_IJ_mv-2.4.0.so so try adding it to the linker command line
/usr/lib64/libHYPRE_IJ_mv-2.4.0.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
libHYPRE_IJ_mv needs explict linking.
$ mpicxx -Wl,--as-needed -save-temps -o conftest hyp.c -Wall -Wwrite-strings
-Wno-strict-aliasing -g -L/usr/lib -L/usr/lib -lHYPRE -llapack -lblas
-L/usr/lib/openmpi/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.5.2 -ldl -lmpi
-lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -lmpi_f90 -lmpi_f77
-lgfortran -lm -lm -lm -lm -L/usr/lib/openmpi/lib
-L/usr/lib/gcc/x86_64-linux-gnu/4.5.2 -ldl -lmpi -lopen-rte -lopen-pal -lnsl
-lutil -lgcc_s -lpthread -ldl
hyp.o: In function `main':
/scratch/packages/tmp/petsc-3.1.dfsg/hyp.c:16: undefined reference to
`HYPRE_IJMatrixCreate'
collect2: ld returned 1 exit status
the reason is that libHYPRE.so is just a "dependency" library. Is there an easy
way to add particular flags to link some libraries with? like
-Wl,--no-as-needed -lHYPRE -Wl,--as-needed ?
for now, I just added all HYPRE libs to work around this.
The last change in debian/rules fixes the link order and another build failure
with ld --as-needed.
patch at:
http://launchpadlibrarian.net/61585886/petsc_3.1.dfsg-10_3.1.dfsg-10ubuntu1.diff.gz
the change to framework.py is unrelated, couldn't find another way to include
the source and compiler flags in the log file.
There is another link failure in the mpi test, reported in #608901, not yet
understood.
More information about the debian-science-maintainers
mailing list