Boost logo

Boost-Build :

From: Jürgen Hunold (hunold_at_[hidden])
Date: 2005-05-27 01:19:58

Hi !

I'm having problems compiling the BGL graphiv parser on amd64.

The error message is:
/usr/bin/ld: bin.v2/libs/graph/build/gcc-3.4/debug/graphviz_graph_parser.o:
relocation R_X86_64_32 can not be used when making a shared object; recompile
with -fPIC
bin.v2/libs/graph/build/gcc-3.4/debug/graphviz_graph_parser.o: could not read
symbols: Bad value
collect2: ld returned 1 exit status

The problem is that the compiler flag -fPIC is not added to the command line
when compiling the file graphviz_graph_parser.cpp

The please find a full compile command attached.

I found the logic to add -fPIC in gcc.jam at line 88 but it seems to add -fPIC
when _linking_ the shared library.

The following patch corrects this and adds -fPIC to the compiler command line
when compiling object files for shared libraries.

I can vaguely remember that -fPIC was removed from the command line because
gcc _always_ created relocatable code, at least on 32-bit cpu's.



* Dipl.-Math. Jürgen Hunold ! Institut für Verkehrswesen, Eisenbahnbau
* voice: ++49 511 762-2529 ! und -betrieb, Universität Hannover 
* fax : ++49 511 762-3001 ! Appelstrasse 9a, D-30167 Hannover
* hunold_at_[hidden] !
 --Boundary-00=_OwrlCECB981EpKO Content-Type: application/x-gzip;
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
[Attachment content not displayed.] --Boundary-00=_OwrlCECB981EpKO Content-Type: text/x-diff;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
Index: tools/build/v2/tools/gcc.jam
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/gcc.jam,v
retrieving revision 1.49
diff -u -3 -p -r1.49 gcc.jam
--- tools/build/v2/tools/gcc.jam	22 Mar 2005 08:06:02 -0000	1.49
+++ tools/build/v2/tools/gcc.jam	27 May 2005 06:15:06 -0000
@@ -87,7 +87,7 @@ flags gcc.compile OPTIONS <profiling>on 
# inside 'init'.
if [ ] != CYGWIN && [ ] != NT
- flags gcc.compile OPTIONS <link>shared/<main-target-type>LIB : -fPIC ;
+ flags gcc.compile OPTIONS <link>shared : -fPIC ;
if [ ] != NT

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at