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

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.


Was this article helpful?

mood_bad Dislike 1
mood Like 0
visibility Views: 12716