Errors while compiling Apache 2.4.1 openssl 1.0.1 on Linux

Started by shishir, April 24, 2012, 12:01:03 PM

Previous topic - Next topic

shishir

Hi,

I am trying to compile Apache 2.4.1 with openssl 1.0.1 on Linux 2.6.32-71.el6.x86_64.
Following is the last block of the 'make' command of apache.

make[4]: Entering directory `/root/shishir/httpd-2.4.1/modules/ssl'
/root/shishir/httpd-2.4.1/srclib/apr/libtool --silent --mode=link gcc -std=gnu99 -g -O2 -pthread -o mod_ssl.la -rpath /usr/pw/apache/modules -module -avoid-version mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo ssl_eng
ine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo ssl_engine_mutex.lo ssl_engine_pphrase.lo ssl_engine_rand.lo ssl_engine_vars.lo ssl_scache.lo ssl_util_stapling.lo ssl_util.lo ssl_util_ssl.lo ssl_engine_ocsp.lo
ssl_util_ocsp.lo -L/usr/pw/apache/openssl/lib -lssl -lcrypto -lrt -lcrypt -lpthread -export-symbols-regex ssl_module
/usr/bin/ld: /usr/pw/apache/openssl/lib/libssl.a(s3_srvr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/pw/apache/openssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[4]: *** [mod_ssl.la] Error 1
make[4]: Leaving directory `/root/shishir/httpd-2.4.1/modules/ssl'



Please note, make test for openssl came successful.

Please suggest what can be wrong while reading libssl.a?

Thanks,
Shishir

mario

For me it worked only when I installed OpenSSL in the system and used that.

See in your error message? /usr/pw/apache/openssl/lib/libssl.a that is not /root/shishir/httpd-2.4.1/srclib/openssl


wget http://openssl.org/source/openssl-1.0.1.tar.gz
tar xfz openssl-1.0.1.tar.gz
cd openssl-*
./config --prefix=/usr zlib-dynamic --openssldir=/etc/ssl shared
make
sudo make install



./buildconf
./configure --prefix=/opt/apache2 --enable-pie --enable-mods-shared=all --enable-so --disable-include --enable-deflate --enable-headers --enable-expires --enable-ssl=shared --enable-mpms-shared=all --with-mpm=event --enable-rewrite --with-z=/home/mario/apache24/httpd-2.4.2/srclib/zlib --enable-module=ssl --enable-fcgid --with-included-apr

shishir

i have used the following..
for openssl
./config no-threads --prefix=/usr/pw/apache/openssl
make
make install

for httpd2.4.1
./configure --prefix=/usr/pw/apache --with-ssl=/usr/pw/apache/openssl --enable-ssl=shared --enable-mods-shated=most
--with-expat=builtin --with-included-apr --with-pcre=/root/shishir/pcre-8.30/pcre-config

is this wrong? or require some correction?
is zlib required here?

mario

zlib is for mod deflate needed.

For openssl you may try

./config no-threads shared --prefix=/usr/pw/apache/openssl

cause your error message says: recompile with -fPIC that is the shared option for gcc

shishir

Thanks for the inputs, tried as suggest
./config no-threads shared --prefix=/usr/pw/apache/openssl

and got a new error

/usr/bin/ld: libcrypto.a(e_4758cca.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
libcrypto.a(e_4758cca.o): could not read symbols: Bad value

mario

Did you run make clean before trying?

by the way, which Linux are you using?

shishir

yea it worked for that phase..thanks for the tip.

but this time i can see mod_ssl.so in my \apache\modules list but when i try to start the apache it is throwing the below error.

httpd: Syntax error on line 155 of /usr/pw/apache/conf/httpd.conf: Cannot load /usr/pw/apache/modules/mod_ssl.so into server: /usr/pw/apache/modules/mod_ssl.so: undefined symbol: SSL_SESSION_get_compress_id

Any suggestions on this?

shishir

Hi,

Any suggestions on


httpd: Syntax error on line 155 of /usr/pw/apache/conf/httpd.conf: Cannot load /usr/pw/apache/modules/mod_ssl.so into server: /usr/pw/apache/modules/mod_ssl.so: undefined symbol: SSL_SESSION_get_compress_id

Thanks,
Shishir

paulnorwich

I'm seeing this same error on RHEL6.2, with openssl 1.0.1c and Apache 2.4.1:

httpd: Syntax error on line 33 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/mod_ssl.so into server: /usr/local/apache/modules/mod_ssl.so: undefined symbol: SSL_SESSION_get_compress_id

Does anyone have any idea what I can do to solve this?

Thanks,
Paul

paulnorwich

I discovered my problem was that at runtime this was linking to my OS's openssl libraries rather than the openssl I'd built in /usr/local/openssl

export LD_LIBRARY_PATH=/usr/local/openssl/lib

then running apache fixed it.

eriddles

#10
Quote from: shishir on May 23, 2012, 11:41:09 AM
Hi,

Any suggestions on


httpd: Syntax error on line 155 of /usr/pw/apache/conf/httpd.conf: Cannot load /usr/pw/apache/modules/mod_ssl.so into server: /usr/pw/apache/modules/mod_ssl.so: undefined symbol: SSL_SESSION_get_compress_id

Thanks,
Shishir

Hi Shishir, I'm getting this error too. I found your post after pasting the error into google. Do you know what this code means and how to get rid of it? Thanks.

mario

Yes the issue can be solved by export LD_LIBRARY_PATH=/usr/local/openssl/lib

You can see an example in https://github.com/JBlond/debian_build_apache24

tomahawk

#12
Quote from: mario on March 28, 2016, 09:43:50 PM
Yes the issue can be solved by reading about the 4 Minutes Fighter Abs export LD_LIBRARY_PATH=/usr/local/openssl/lib

You can see an example in https://github.com/JBlond/debian_build_apache24

Thank you very much Mario, github very useful. Thanks

sarajames

Thank you, yes! Finally figured out how to solve my compiling issue with Apache!

Much appreciated, Sara

mario

Quote from: lordoftheflies on July 09, 2016, 10:17:22 AM
I found this post by searching google for my problem, i used the github recommendation to solve the problem but now my computer is freezing everytime i run anything, i'm starting to think this is beyond me  ???

how is your folder structure? How did you configure your apache build?

it seems that your apache is compiled against a different OpenSSL version than it was compiled against.