在安装 php 时,需要先安装 gd-2.0.33.tar.gz , 但在编译 gd-2.0.33.tar.gz 时出现了如下错误:
/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' 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[2]: *** [libgd.la] 错误 1
make[2]: Leaving directory `/usr/local/src/gd-2.0.33'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/usr/local/src/gd-2.0.33'
make: *** [all] 错误 2
[root@localhost gd-2.0.33]#
解决办法 : 重新安装 zlib-1.2.3.tar.gz
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
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lgh2008/archive/2007/10/18/1831184.aspx