安裝GD前需要安裝jpeg-6b,libpng,zlib,freetype。以下是下载网址:
http://www.libgd.org/DownloadsGD下载
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gzJPEG下载
http://www.libpng.org/pub/png/libpng.htmlpng下载
http://www.zlib.net/zlib-1.2.3.tar.gzzlib下载
http://www.freetype.org/freetype下载
1.安装zlib
tarzxvfzlib-1.2.3.tar.gz
cdzlib-1.2.3
./configure
make
makeinstall
2.安装libpng
tarzxvflibpng-1.2.29.tar.gz
cdlibpng-1.2.29
cdscripts/
mvmakefile.linux../makefile
cd..
make
makeinstall
注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个
3.安装freetype
tarzxvffreetype-2.1.10.tar.gz
cdfreetype-2.1.10
./configure
make
makeinstall
4.安装Jpeg
tarzxvfjpegsrc.v6b.tar.gz
cdjpeg-6b/
./configure--enable-shared
make
maketest
makeinstall
注意,这里configure一定要带--enable-shared参数,不然,不会生成共享库
5.安装GD
tarzxvfgd-2.0.33.tar.gz
cdgd-2.0.33
./configure--with-png--with-freetype--with-jpeg
makeinstall
如果GD报错:configure.ac:64:warning:macro`AM_ICONV'notfoundinlibrary
你就makeclean一下,然后再make
如果你安装别的出现libtool没有找到,你就从/usr/bin/libtoolcp一个过来用就好了!
在64位下编译GD如果/usr/bin/ld:/usr/local/lib/libz.a(compress.o):relocationR_X86_64_32against`alocalsymbol'cannotbeusedwhenmakingasharedobject;recompilewith-fPIC
这说明zlib没用用-fPIC进行编译修改zlib的MakefileCFLAGS=-O3-DUSE_MMAP-fPIC
make;makeinstall然后再编译gd就过去了!