Apache编译make问题[mod_deflate.la] 错误 1

在Linux Redhat6.3下面安装apache server的时候,执行完./configure命令后在执行make命令的时候报如下错误:/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against .rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[4]: *** [mod_deflate.la] 错误 1
make[4]: Leaving directory
/usr/local/httpd-2.4.3/modules/filters’
make[3]: * [shared-build-recursive] 错误 1
make[3]: Leaving directory /usr/local/httpd-2.4.3/modules/filters'
make[2]: *** [shared-build-recursive] 错误 1
make[2]: Leaving directory
/usr/local/httpd-2.4.3/modules’
make[1]: * [shared-build-recursive] 错误 1
make[1]: Leaving directory `/usr/local/httpd-2.4.3’
make: * [all-recursive] 错误 1

**解决办法:
下载zlib-1.2.3.tar.gz放在/usr/local目录下执行以下命令:
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
make && make install**

然后再进入/usr/local/httpd-2.4.3这个目录执行下面的语句:
./configure –prefix=/usr/local/apache2 –with-apr=/usr/local/apr/bin/apr-1-config –with-apr-util=/usr/local/apr-util/bin/apu-1-config –with-pcre=/usr/local/pcre/bin/pcre-config –with-zlib-1.2.3=/usr/local/zlib-1.2.3 –enable-so

你可能感兴趣的:(linux)