How to compile httpd using gcc in RHEL?

Hi All,

  I am trying to compile httpd2.2.19 in RHEL5.5 using gcc version 4.1.2. This is first time I am trying to compile httpd in RHEL.

  I ran configure with below option

  ./configure --prefix=/usr/local/apache --enable-rewrite --enable-ssl=shared --with-ssl=/usr/local/openssl

  I am getting the below error message when I run the command make.
     make[4]: Entering directory \`/home/sudo/kalai/httpd-2.2.19/modules/ssl'

/home/sudo/kalai/httpd-2.2.19/srclib/apr/libtool --silent --mode=link gcc -g -O2 -pthread -L/usr/local/openssl/lib -o mod_ssl.la -rpath /usr/local/apache/modules -module -avoid-version mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo ssl_engine_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_expr.lo ssl_expr_eval.lo ssl_expr_parse.lo ssl_expr_scan.lo ssl_scache.lo ssl_scache_dbm.lo ssl_scache_shmcb.lo ssl_scache_dc.lo ssl_util.lo ssl_util_ssl.lo -lssl -lcrypto -ldl -export-symbols-regex ssl_module

  /usr/bin/ld: /usr/local/openssl/lib/libssl.a\(s2_srvr.o\): relocation R\_X86\_64_32 against \`a local symbol' can not be used when making a shared object; recompile with -fPIC

/usr/local/openssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[4]: *** [mod_ssl.la] Error 1

  Could you please help me in compiling httpd in RHEL using gcc.

Regards,
Kalai

---------- Post updated at 01:33 AM ---------- Previous update was at 12:58 AM ----------

I have fixed this error by running the configure with below option

[ CFLAGS="-fPIC -g -O2" ./configure --prefix=/usr/local/apache --enable-rewrite --enable-ssl=shared --with-ssl=/usr/local/openssl ]

Regards,
Kalai

1 Like