当前位置: 首页 > 工具软件 > libgd > 使用案例 >

【LINUX】libgd-GD库安装

姚建树
2023-12-01

  • 近日帮朋友安装GD库一直失败,安装所需要的依赖库很多。本来放弃了,今天发现自己想要circos画图,也需要GD模块。在此记录自己的安装过程,以防下次安装碰到安装问题。
  • 按照以下步骤按照依赖库就可以,报错信息一般都是上一步的库未安装。

GD依赖库-zlib

wget  http://www.zlib.net/zlib-1.2.11.tar.gz
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=`pwd` --enable-shared
make && make install

GD依赖库-libpng

安装libpng库的时候,需要指定zlib库的位置。

wget  https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.gz/download
mv download libpng-1.6.37.tar.gz
tar zxvf libpng-1.6.37.tar.gz
cd libpng-1.6.37
./configure --prefix=`pwd` --enable-shared
make && make install

GD依赖库-libjpeg

wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure --prefix=`pwd` -enable-shared
make && make install

GD依赖库-freetype

wget  http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.5.5.tar.gz
tar zxvf freetype-2.5.5.tar.gz
cd freetype-2.5.5
./configure --prefix=`pwd` -enable-shared
make && make install

make 的时候如果报错了以下信息,原因是因为libpng的库版本不同,可以重新安装对应版本的libpng,或者对新版本的libpng建软链改为旧版本的名字。

/.conda/envs/py2.7/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lpng15
collect2: error: ld returned 1 exit status
make: *** [config.mk:55: /lustre/home/acct-argwx/argwx-gcc/software/freetype-2.5.5/objs/libfreetype.la] Error 1

GD依赖库-liblzma

wget https://nchc.dl.sourceforge.net/project/lzmautils/xz-5.2.5.tar.gz
tar zxvf xz-5.2.5.tar.gz
cd xz-5.2.5/
./configure --prefix=`pwd` --enable-shared
make && make install

GD依赖库-libxml2

wget http://xmlsoft.org/sources/libxml2-2.9.8.tar.gz
tar zxvf libxml2-2.9.8.tar.gz
cd libxml2-2.9.8
./configure --prefix=`pwd` --enable-shared
make && make install
  1. make的时候报错的话,是缺少lzma库,需要安装xz。
/.conda/envs/py2.7/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -llzma
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:971: libxml2.la] Error 1
make[2]: Leaving directory '/lustre/home/acct-argwx/argwx-gcc/software/libxml2-2.9.8'
make[1]: *** [Makefile:1442: all-recursive] Error 1
make[1]: Leaving directory '/lustre/home/acct-argwx/argwx-gcc/software/libxml2-2.9.8'
make: *** [Makefile:861: all] Error 2
  1. make的时候以下报错的话,是缺少python库,需要安装xz。
libxml.c:14:10: fatal error: Python.h: No such file or directory

GD依赖库-fontconfig

wget http://freedesktop.org/software/fontconfig/release/fontconfig-2.10.93.tar.gz
tar zxvf fontconfig-2.10.93.tar.gz
cd fontconfig-2.10.93
./configure --prefix=`pwd` -enable-shared --enable-libxml2
make && make install

GD安装–第一次安装

安装完上面之后,发现configure的时候还是报错了。

wget https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz
tar zxvf libgd-2.2.5.tar.gz
cd libgd-2.2.5
./configure --prefix=`pwd` -enable-shared
make && make install

报错信息如下,发现是缺少fontconfig库。

/.conda/envs/py2.7/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lfontconfig
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:673: libgd.la] Error 1
make[2]: Leaving directory '/lustre/home/acct-argwx/argwx-gcc/software/libgd-2.2.5/src'
make[1]: *** [Makefile:588: all] Error 2
make[1]: Leaving directory '/lustre/home/acct-argwx/argwx-gcc/software/libgd-2.2.5/src'
make: *** [Makefile:419: all-recursive] Error 1

安装很不容易,涉及的依赖包太多了。

 类似资料: