64bit and PIC

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

64bit and PIC

Alexandre Hannud Abdo
Ni!

 I had the problem below when compiling graph-tool on a 64 bit amd machine.
 It's seems a problem generating position independent code while
linking the libraries.

 The linker asks me to compile with -fPIC, but doing that changes
nothing (by adding "-fPIC" to CXXFLAGS in the Makefile, should I have
done someting different?)

 One thing I notice is that the last call, to "g++ -shared", does not
include -fPIC.
 All others do, so this might be expected (as in "it's just linking")

 I remember someone on the list successfully compiled on a 64 bit
machine, did you have to do something special?

 []s
ale
~~

/bin/bash ../../libtool --tag=CXX --mode=link g++ -Wall -I/usr/include/python2.4
-I/usr/include -ftemplate-depth-150 -fvisibility=hidden
-fvisibility-inlines-hidden
-O99 -fPIC   -o libgraph_tool.la -rpath /usr/local/lib/python2.4/site-packages
graph.lo graph_properties.lo graph_correlations.lo
graph_correlations_combined.lo
graph_correlations_neighbours.lo graph_assortativity.lo graph_clustering.lo
graph_extended_clustering.lo graph_generation.lo graph_distance.lo
graph_distance_sampled.lo graph_reciprocity.lo graph_minimum_spanning_tree.lo
graph_community.lo graph_community_network.lo graph_line_graph.lo graph_io.lo
graph_bind.lo graphml.lo read_graphviz_spirit.lo -L/usr/lib/python2.4
-lpython2.4
-L/usr/lib -lboost_python -lboost_iostreams -lexpat

g++ -shared -nostdlib
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtbeginS.o  .libs/graph.o
.libs/graph_properties.o
 .libs/graph_correlations.o .libs/graph_correlations_combined.o
.libs/graph_correlations_neighbours.o .libs/graph_assortativity.o
.libs/graph_clustering.o .libs/graph_extended_clustering.o
.libs/graph_generation.o
.libs/graph_distance.o .libs/graph_distance_sampled.o .libs/graph_reciprocity.o
.libs/graph_minimum_spanning_tree.o .libs/graph_community.o
.libs/graph_community_network.o .libs/graph_line_graph.o .libs/graph_io.o
.libs/graph_bind.o .libs/graphml.o .libs/read_graphviz_spirit.o
-L/usr/lib/python2.4
-lpython2.4 -L/usr/lib -lboost_python -lboost_iostreams /usr/lib/libexpat.so
-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2
-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtendS.o
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crtn.o  -Wl,-soname
-Wl,libgraph_tool.so.0 -o .libs/libgraph_tool.so.0.0.0


/usr/bin/ld: .libs/graph.o: relocation R_X86_64_PC32 against
`std::basic_string<char,
 std::char_traits<char>, std::allocator<char> >::~basic_string()@@GLIBCXX_3.4'
can not be used when making a shared object; recompile with -fPIC


/usr/bin/ld: final link failed: Bad value

collect2: ld returned 1 exit status
make[3]: *** [libgraph_tool.la] Error 1
make[3]: Leaving directory `/scratch/abdo/svn/graph-tool/src/graph'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/scratch/abdo/svn/graph-tool/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/scratch/abdo/svn/graph-tool'
make: *** [all] Error 2

Reply | Threaded
Open this post in threaded view
|

Re: 64bit and PIC

Tiago de Paula Peixoto
On 11/16/2006 06:01 PM, Alexandre Hannud Abdo wrote:
>  I had the problem below when compiling graph-tool on a 64 bit amd machine.
>  It's seems a problem generating position independent code while
> linking the libraries.

[...]

> /usr/bin/ld: .libs/graph.o: relocation R_X86_64_PC32 against
> `std::basic_string<char,
>  std::char_traits<char>, std::allocator<char> >::~basic_string()@@GLIBCXX_3.4'
> can not be used when making a shared object; recompile with -fPIC

Well, this certainly has nothing to do with graph-tool... I noticed you
were using GCC 4.1.2, which is not yet released, and is probably a
pre-release or something. Do you get the same error when you compile
with a stable GCC (eg. 4.1.1)?

--
Tiago de Paula Peixoto <[hidden email]>


signature.asc (307 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 64bit and PIC

Alexandre Hannud Abdo
Ni!

On 11/16/06, Tiago de Paula Peixoto <[hidden email]> wrote:

> On 11/16/2006 06:01 PM, Alexandre Hannud Abdo wrote:
> >  I had the problem below when compiling graph-tool on a 64 bit amd machine.
> >  It's seems a problem generating position independent code while
> > linking the libraries.
>
> [...]
>
> > /usr/bin/ld: .libs/graph.o: relocation R_X86_64_PC32 against
> > `std::basic_string<char,
> >  std::char_traits<char>, std::allocator<char> >::~basic_string()@@GLIBCXX_3.4'
> > can not be used when making a shared object; recompile with -fPIC
>
> Well, this certainly has nothing to do with graph-tool... I noticed you
> were using GCC 4.1.2, which is not yet released, and is probably a
> pre-release or something. Do you get the same error when you compile
> with a stable GCC (eg. 4.1.1)?

Removing, as you suggested,

-fvisibility=hidden -fvisibility-inlines-hidden

from CXXFLAGS works around the compiler bug.

tx!
ale