1

I'm trying to build APR-util 1.5.6 for Apache 2.2.32.

I first build OpenSSL 1.0.2k using the following steps:

./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make
make test
make install

I then ran these commands:

export LD_LIBRARY_PATH=/usr/local/lib
export LIBS=-ldl

I attempted to build APR-util using these commands:

./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-crypto --with-openssl=/usr/local/ssl

make

Configure completes successfully, but make fails with the following error:

/bin/sh /usr/local/apr/build-1/libtool --silent --mode=link gcc  -g -O2 -pthread      -L/usr/local/ssl/lib -release 1 -module -rpath /usr/local/apr/lib/apr-util-1 -o crypto/apr_crypto_openssl.la crypto/apr_crypto_openssl.lo -L/usr/local/ssl/lib  -lssl -lcrypto
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(mem.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [crypto/apr_crypto_openssl.la] Error 1

Please advise. Thanks.

jww
  • 97,681
  • 90
  • 411
  • 885
T. Veil
  • 11
  • 1

1 Answers1

1

I first build OpenSSL 1.0.2k using the following steps:

./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make
make test
make install

You are not building a shared object at this step, so the objects are missing relocation data. It eventually leads to:

/usr/local/ssl/lib/libcrypto.a(mem.o): relocation R_X86_64_32S

Configure like the following should clear the issue.

with Shared Object

./config shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl\

In this configuration, OpenSSL will build the shared object. It will enable the -fPIC flag for you.

without Shared Object

./config -fPIC --prefix=/usr/local/ssl --openssldir=/usr/local/ssl

In this configuration, you are not building the shared object. You must enable the -fPIC flag.


There are other OpenSSL configuration flags you should consider, like no-ssl2, no-ssl3 and no-comp. If you are working on a 64-bit Intel machine, then you should also use enable-ec_nistp_64_gcc_128. Also see Compilation and Installation | Options on the OpenSSL wiki.

jww
  • 97,681
  • 90
  • 411
  • 885
  • Earlier you suggested using: "--openssldir=/usr/local/ssl\" What is the significance of the "\" character at the end? – T. Veil May 05 '17 at 00:29