64 bit Linux/Ubuntu and openssl issue (could not r

2019-05-08 09:05发布

问题:

Normally I search a lot and read a lot to fix my issues, but for this particular problem, it has been pretty unproductive.

I am running a 64bit Ubuntu Linux server on which I installed LAMP stack, and had problem with libcurl not having SSL support, while the OS binary does have SSL support. The PHP just cannot read it. When I searched for solutions and tried doing the following to enable ssl support while installing PHP, I got the problem..

./configure .... --with-openssl
...
....
/usr/bin/ld: ext/standard/.libs/info.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
ext/standard/.libs/info.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libphp5.la] Error 1

So, it quit suddenly. I tried doing --enable-shared --without-pic arguments to no avail.

回答1:

Okay, sorry for not search properly in SO itself. One of the related topics had an answer to this problem. relocation R_X86_64_32 against a local symbol' error

All I had to do was do a fresh install of openssl this time with enable-shared option during configure

./config enable-shared

Then I had to do a fresh install of cURL

./configure --with-ssl=/usr/local/ssl --with-zlib

Then I had to do a fresh install of PHP

./configure .... --with-openssl --with-curl ....

..and that did it. The PHP cURL extension has SSL support.



回答2:

As a more generic answer, one typically runs into this problem when the library you are trying to compile is looking for a shared library of a dependency, but the dependency itself was built with only static library support.

The way to fix the problem would be to recompile the dependency with shared library support, usually done by specifying the --enable-shared flag to the configure script.



回答3:

also execute the command,

make clean