#2123 closed Bugs (fixed)
link against libexpat.a of graph lib fails on 64 bit Linux
Reported by: | Owned by: | Douglas Gregor | |
---|---|---|---|
Milestone: | Component: | graph | |
Version: | Boost 1.35.0 | Severity: | Problem |
Keywords: | gcc-4.3 linux 64bit graph graphml expat | Cc: | gcc, Vladimir Prus |
Description
Error from build:
---
bash> EXPAT_INCLUDE=/home/micha/external-builds/xgen-externals/install/Linux-x86_64/expat-2.0.1/include EXPAT_LIBPATH=/home/micha/external-builds/xgen-externals/install/Linux-x86_64/expat-2.0.1/lib make
./tools/jam/src/bin.linuxx86_64/bjam -sICU_PATH=/home/micha/external-builds/xgen-externals/install/Linux-x86_64/icu-3.8.1 --user-config=user-config.jam --without-python --without-mpi --without-test --without-wave
Building Boost.Regex with Unicode/ICU support enabled
Using ICU in /home/micha/external-builds/xgen-externals/install/Linux-x86_64/icu-3.8.1/include
...patience...
...patience...
...found 3188 targets...
...updating 1 target...
gcc.link.dll bin.v2/libs/graph/build/gcc-4.3/release/threading-multi/libboost_graph-gcc43-mt-1_35.so.1.35.0
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: /home/micha/external-builds/xgen-externals/install/Linux-x86_64/expat-2.0.1/lib/libexpat.a(xmlparse.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/home/micha/external-builds/xgen-externals/install/Linux-x86_64/expat-2.0.1/lib/libexpat.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
"g++" -L"/home/micha/external-builds/xgen-externals/install/Linux-x86_64/expat-2.0.1/lib" -o "bin.v2/libs/graph/build/gcc-4.3/release/threading-multi/libboost_graph-gcc43-mt-1_35.so.1.35.0" -Wl,-h -Wl,libboost_graph-gcc43-mt-1_35.so.1.35.0 -shared -Wl,--start-group "bin.v2/libs/graph/build/gcc-4.3/release/threading-multi/read_graphviz_spirit.o" "bin.v2/libs/graph/build/gcc-4.3/release/threading-multi/graphml.o" -Wl,-Bstatic -lexpat -Wl,-Bdynamic -lrt -Wl,--end-group -Wl,--strip-all -pthread
...failed gcc.link.dll
bin.v2/libs/graph/build/gcc-4.3/release/threading-multi/libboost_graph-gcc43-mt-1_35.so.1.35.0...
...failed updating 1 target...
Not all Boost libraries built properly.
---
Build was with gcc 4.3 on OpenSuSE 11 (x86_64).
The link error occurres with both the (native) expat lib from openSUSE and the expat lib I build myself (the example above tries to link against the latter)
Change History (7)
follow-up: 2 comment:1 by , 14 years ago
comment:2 by , 14 years ago
Yes there is. But even if I rename the static libexpat.a the build system cannot link and complains that it does not find libexpat.a, instead of linking with the libexpat.so (which is in the same lib folder).
comment:3 by , 14 years ago
I believe I've found the issue, but I can't test it myself at the moment. If you make this change to libs/graph/build/Jamfile.v2, it should link against the shared expat:
Index: Jamfile.v2 =================================================================== --- Jamfile.v2 (revision 47135) +++ Jamfile.v2 (working copy) @@ -26,7 +26,7 @@ if [ modules.peek : EXPAT_INCLUDE ] && [
optional_sources += graphml.cpp ; optional_reqs += <include>$(EXPAT_INCLUDE)
<library-path>$(EXPAT_LIBPATH)
- <find-static-library>expat
+ <find-shared-library>expat
;
} else
comment:4 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 14 years ago
Cc: | added |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Should this patch have used <find-library> instead? Please feel free to close if not.
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
<find-library> doesn't seem to exist:
unknown feature "<find-library>"
We can't build a shared library against a static library that hasn't been compiled with -fPIC. It sounds like expat is being built incorrectly. Is there a shared-library version of expat (ibexpat.so)?