安装GD库 GD库安装全过程详解

所需的源码包及下载:(也可以下载最新的安装包)

gd-2.0.35.tar.gz
http://www.libgd.org/releases/

jpegsrc.v6b.tar.gz
http://www.ijg.org/files/

libpng-1.2.24.tar.tar
http://sourceforge.net/projects/libpng/

zlib-1.2.3.tar.gz
http://sourceforge.net/projects/libpng/

freetype-2.3.5.tar.gz
http://sourceforge.net/projects/freetype/

安装步骤:

先安装zlib,freetype,libpng,jpeg,再装GD

  1. 装zlib

    1
    2
    3
    4
    5
    tar zxvf zlib-1.2.3.tar.gz
    cd zlib-1.2.3
    ./configure
    make
    make install
  2. 安装libpng

    1
    2
    3
    4
    5
    6
    7
    tar zxvf libpng-1.2.24.tar.tar
    cd libpng-1.2.24
    cd scripts/
    mv makefile.linux ../makefile
    cd ..
    make
    make install

注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个

  1. 安装freetype

    1
    2
    3
    4
    5
    tar zxvf freetype-2.3.5.tar.gz
    cd freetype-2.3.5
    ./configure
    make
    make install
  2. 安装Jpeg

    1
    2
    3
    4
    5
    6
    tar zxvf jpegsrc.v6b.tar.gz
    cd jpeg-6b/
    ./configure –enable-shared
    make
    make test
    make install

注意,这里configure一定要带–enable-shared参数,不然,不会生成共享库

  1. 安装GD
    1
    2
    3
    4
    tar zxvf gd-2.0.35.tar.gz
    cd gd-2.0.35
    ./configure -with-png -with-freetype -with-jpeg
    make install