/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(ecp_nistz256.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value
Rebuild your local copy of OpenSSL with -fPIC
. The local copy is the one located in /usr/local/ssl/lib/
.
I've seen this issue on Fedora, too. Sometimes you can fix it with export CFLAGS=-fPIC
. Other times you have to modify Makefile.org
so its present.
64 bit Linux/Ubuntu and openssl issue (could not read symbols: Bad value)
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.
Manually compile OpenSSL: symbol can not be used when making a shared object; recompile with -fPIC
The linker error:
/usr/bin/ld: libcrypto.a(rsaz_exp.o): relocation R_X86_64_32 against `.rodata'
can not be used when making a shared object; recompile with -fPIC
is saying that the object file rsaz_exp.o
in the archive libcrypto.a
has not been compiled as Position Independent Code, and it must be to be
linked into a shared object. It suggests you recompile that object file with-fPIC
. Which would mean rebuilding your libcrypto.a
from source, with
the -fPIC
compilation option.
If you don't want to do that, provide your linkage with a shared libcrypto.so
to link against instead.
relocation R_X86_64_32 against a local symbol' error
I figured out that the problem was with the openssl install. Reinstalling openssl with enable-shared worked.
how to build libcrypto.so with gcc 4.8.5 toolchain
The error is more or less clear on what to do now: recompile with -fPIC
. So make sure that -fPIC
is included in your CFLAGS
(e.g. CFLAGS=-fPIC make ...
).
The underlying problem is, that you (most likely unintentionally) try to mix relocatable and not relocatable code.
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Update: As of December 2020 and beyond, brew switch
does not work, so use the other answer by @angabriel:
brew install rbenv/tap/openssl@1.0
ln -sfn /usr/local/Cellar/openssl@1.0/1.0.2t /usr/local/opt/openssl
Original Answer:
Switch to an older openssl package
brew switch openssl 1.0.2s
Or, depending on your exact system configuration, you may need to switch to a different version. Check the output of ls -al /usr/local/Cellar/openssl
for the version number to switch to.
brew switch openssl 1.0.2q
# or
brew switch openssl 1.0.2r
# or
brew switch openssl 1.0.2s
# or
brew switch openssl 1.0.2t
# etc...
shared object compilation error
It's telling you libcrypto.a was not compiled with fPIC
.
You should either rebuild it with -fPIC
, or drop the use of -fPIC
when compiling your stuff.
Erlang can't find OpenSSL library in Windows
If I remember correctly you want the windows OpenSSL install, not the Cygwin one. It should be downloadable from the OpenSSL website.
Related Topics
Set Environment Variable in Gdb from Output of Command
Conditional Awk Hashmap Match Lookup
Openldap + Dynlist + Posixgroup
How to Install Xclip on an Ec2 Instance
How to Disable Tcp Slow Start in Linux
Drop/Rewrite/Generate Keyboard Events Under Linux
How to Get Exit Code of Remote Command Through Ssh
Change The Default Find-Grep Command in Emacs
How Is Preemptive Scheduling Implemented for User-Level Threads in Linux
Delete Line from Text File with Line Numbers from Another File
Why Do I Get The Information of "Suspended (Tty Input)" When I Run My Script in The Background
Git Post-Receive Checkout to Remote Machine
Unattended Install of Krb5-User on Ubuntu 16.04
How to Setup Cron Job on Amazon Linux Ami
How to Export a Symbol from an External Module
Atomically Swap Contents of Two Files on Linux
Core Dump of Multithreaded Application Shows Only One Thread