Installing GD under Linux

Time:2022-5-5

Before installing Gd, you need to install jpeg-6b, libpng, zlib and freetype. The following is the download URL:

http://www.libgd.org/DownloadsGD Download

ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gzJPEG Download

http://www.libpng.org/pub/png/libpng.htmlPng Download

http://www.zlib.net/zlib-1.2.3.tar.gzZlib Download

http://www.freetype.org/Freetype Download

1.installzlib

tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install

2.installlibpng

tar zxvf libpng-1.2.29.tar.gz
cd libpng-1.2.29
cd scripts/
mv makefile.linux ../makefile
cd ..
make
make install
Note that the makefile here is not used/ Configure is generated, but directly copy one from scripts /

3.installfreetype

tar zxvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure
make
make install

4.installJpeg

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure –enable-shared

make
make test
make install
Note that configure here must take the — enable shared parameter, otherwise the shared library will not be generated

5.installGD

tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure –with-png –with-freetype –with-jpeg

make install

If GD reports an error: configure ac:64: warning: macro `AM_ ICONV’ not found in library
Just make clean and then make

If youinstallIf other libtools are not found, you can use them from / usr / bin / libtool CP!

Compile Gd in 64 bit if / 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
This indicates that zlib does not use – FPIC to compile and modify zlib’s makefile cflags = – O3 – Duse_ MMAP -fPIC
make; Make install and then compile GD!