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:
------snip-------
gcc.link.dll
bin.v2/libs/graph/build/gcc-3.4/debug/bgl-viz-gcc34-d-1_33.so.1.33.0
/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
--------snap-------------

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.

Yours,

Jürgen

-- 
* 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] ! www.ive.uni-hannover.de
 --Boundary-00=_OwrlCECB981EpKO Content-Type: application/x-gzip;
name="compile.txt.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="compile.txt.gz"
[Attachment content not displayed.] --Boundary-00=_OwrlCECB981EpKO Content-Type: text/x-diff;
charset="iso-8859-1";
name="gcc.jam.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="gcc.jam.diff"
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 [ os.name ] != CYGWIN && [ os.name ] != NT
{ 
- flags gcc.compile OPTIONS <link>shared/<main-target-type>LIB : -fPIC ;
+ flags gcc.compile OPTIONS <link>shared : -fPIC ;
} 
if [ os.name ] != NT
{
 --Boundary-00=_OwrlCECB981EpKO-- 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk