Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile OpenSSL with the 'shared' option?

Tags:

openssl

apache

On CentOS 5.4, OpenSSL compiles fine without 'shared' option. But when I passed that option the compilation fails with:

/usr/bin/ld: libcrypto.a(x86_64-gcc.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

When I try: ./config shared CFLAGS=-fPIC that doesn't work.

What can I do to get OpenSSL to compile with the 'shared' option?

Thanks

like image 306
Petre Maierean Avatar asked Mar 29 '10 10:03

Petre Maierean


People also ask

How do you cross compile an OpenSSL arm?

Download the ARM GCC toolchain through your package manager; on Ubuntu, sudo apt-get install gcc-arm-linux-gnueabihf . Download a build of the toolchain from Linaro. If you are on Linux, grab the i686 version (non-mingw32). You can find the actual binaries under the bin/ directory after expanding the archive.


2 Answers

Same problem here, BUT usually Makefiles will consider environment variables for compiler or linker options.

So, if you place the -fPIC option before calling the configure script, it should take care of it. You can do it with:

CFLAGS=-fPIC ./config shared --prefix=/your/path 

or

export CFLAGS=-fPIC ./config shared --prefix=/your/path 

It worked for me.

like image 100
AkiRoss Avatar answered Sep 22 '22 02:09

AkiRoss


There is an option -fXXX that you can pass to config so you can do it with:

./config -fPIC shared 
like image 22
marcinH Avatar answered Sep 22 '22 02:09

marcinH