Curl Compile Error: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » CustomBuild

Curl Compile Error: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPICLast Modified: May 31, 2010, 1:27 pm
If you get the following error during a curl compile with a 64-bit system:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libssl.a(s2_clnt.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../../lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

It means the configure needs to be changed.  Usually, for an -fPIC error like this, the best way is to recompile the source library to resolve the issue, then recompile curl the same way.  However, in this case, the cause is libssl.a, which is part of the OS distribution, so it's better to avoid that, and make everything with the inverse instead.

In this case, the solution is to set curl to not use fPIC or shared libraries.
Edit the build script. In the doCURL section, find the line:

./configure --disable-file

and change it to:

./configure --disable-file --without-pic --disable-shared

Save/exit.
Then type:

./build curl

and that should compile curl for you.
 
Related Helpfiles
LibXML Compile Error: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

2003 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST