Skip to content

ubuntu linux下编译安装gd-2.0.11出错

2010 五月 15
by 荒野无灯
1
2
3
4
5
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0.11.tar.gz
cd gd-2.0.11
sudo ./configure --prefix=/usr/local/gd2
sudo make

make时出错了:

1
2
3
4
5
6
7
8
9
10
11
12
cc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF  .deps/gdft.Tpo -c gdft.c  -fPIC -DPIC -o .libs/gdft.lo
In file included from gdft.c:56:
/usr/local/include/freetype2/freetype/freetype.h:20:2: error: #error "`ft2build.h' hasn't been included yet!"
/usr/local/include/freetype2/freetype/freetype.h:21:2: error: #error "Please always use macros to include FreeType header files."
/usr/local/include/freetype2/freetype/freetype.h:22:2: error: #error "Example:"
/usr/local/include/freetype2/freetype/freetype.h:23:2: error: #error "  #include <ft2build.h>"
/usr/local/include/freetype2/freetype/freetype.h:24:2: error: #error "  #include FT_FREETYPE_H"
make[2]: *** [gdft.lo] Error 1
make[2]: Leaving directory `/home/soft/gd-2.0.11'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/soft/gd-2.0.11'

make: *** [all] Error 2

在网上搜索了一下,没有解决办法,有人说是注释掉 /usr/local/include/freetype2/freetype/freetype.h 文件中那几行预处理指令,我觉得那样不妥,经过我的分析,应该是gdft.c使用了freetype库,但是忘记包含其中一个必需包含的头文件 ft2build.h了,于是就报错了。
我的做法是:
vim gdft.c
增加:

1
2
3
#ifndef FT_FREETYPE_H
#include <ft2build.h>
#endif


这样以后,再make ,然后make install ,再也没有报错了。 :mrgreen: 这里证明我的判断是正确的,这很可能是程序的一个bug。

喜欢这篇文章吗?

请订阅本站 RSS feed填写您的邮件地址,订阅我们的精彩内容:,欢迎点击这里捐赠以支持荒野无灯转播到腾讯微博 转播到腾讯微博

作者:荒野无灯
出处:Hacklog【Hacklog】

声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议. 转载请注明转自Hacklog【荒野无灯weblog】

本文链接: http://ihacklog.com/?p=3802

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <q cite=""> <strong>

 :wink:  :-|  :-x  :twisted:  :)  8-O  :(  :roll:  :-P  :oops:  :-o  :mrgreen:  :lol:  :idea:  :-D  :evil:  :cry:  8)  :arrow:  :-?  :?:  :!:

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS