[原创]FreeBSD下手动编译php53-gd找不到freetype.h的解决_VMware, Unix及操作系统讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  VMware, Unix及操作系统讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3171 | 回复: 0   主题: [原创]FreeBSD下手动编译php53-gd找不到freetype.h的解决        下一篇 
wulcan
版主
等级:中校
经验:1795
发帖:124
精华:0
注册:2014-3-19
状态:离线
发送短消息息给wulcan 加好友    发送短消息息给wulcan 发消息
发表于: IP:您无权察看 2014-10-21 9:00:45 | [全部帖] [楼主帖] 楼主

一个WEB系统,需要给图片加水印,这需要libgd支持Freetype。并且图形验证码也大都需要Freetype的支持才行,否则会不显示字符或空白。

但是默认的系统没有添加这个支持,一直用的是php53-28,当我再用ports编译的时候,发现已经升级为php53-29,和原来的ports,却发现有安全提示——Ports系统有时就这么麻烦!

无奈之好手动处理吧,重新编译php53-gb,前提需要安装好freetype和libgd,并支持jpeg和png。

进入/usr/ports/distfiles,解压原来的php53-28:

# tar php-5.3.28.tar.bz2


再进入解压后的gd目录,并且产生phpize,产生相应的configure :

# cd php-5.3.28/ext/gd/ && phpize


然后进入关键的步骤了:

# ./configure -- --with-jpeg-dir=/usr/local/ --with-png-dir=/usr/local/ --with-freetype-dir=/usr/local/


但是问题来了,提示找不到freetype:

checking for FreeType 2... /usr/local/
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese&nbspfontnbsp&support in GD... no
checking for fabsf... no
checking for floorf... no
checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype.h not found.


花了很长时间,用尽了各种方法,也没有解决。在config.log里面,也只有上面的几句,根本没有利用的价值。

网上的资料都清一色为linux下的,路径稍有不同。

实在闲着无聊,就顺手读了一下configure脚本,发现了其中的问题:

5486 if test "$PHP_FREETYPE_DIR" != "no"; then
5487
5488 for i in $PHP_FREETYPE_DIR /usr/local /usr; do
5489 if test -f "$i/include/freetype2/freetype/freetype.h"; then
5490 FREETYPE2_DIR=$i
5491 FREETYPE2_INC_DIR=$i/include/freetype2
5492 break
5493 fi
5494 done


竟然在configure里面写上了路径!!

路径检测为/usr/local/include/freetype2/freetype,但是ports安装的freetype2的默认目录在/usr/local/include/freetype2,没有最后一级目录freetype,这就是导致configure找不到头文件的原因。

找到原因就好办了,最简单的办法就是新建一个:

# ll /usr/local/include/freetype2/
total 1096
drwxr-xr-x 2 root wheel 512 Jul 19 16:03 config/
drwxr-xr-x 2 root wheel 1536 Oct 16 10:32 freetype/
-r--r--r-- 1 root wheel 255266 Jul 19 16:03 freetype.h
-r--r--r-- 1 root wheel 2383 Jul 19 16:03 ft2build.h
-r--r--r-- 1 root wheel 10576 Jul 19 16:03 ftadvanc.h
-r--r--r-- 1 root wheel 14660 Jul 19 16:03 ftautoh.h
-r--r--r-- 1 root wheel 5245 Jul 19 16:03 ftbbox.h


 再来看config.log,这次终于找到了:

configure:4071: checking for GD support
configure:4111: result: yes, shared
configure:4121: checking for the location of libjpeg
configure:4136: result: /usr/local/
configure:4147: checking for the location of libpng
configure:4162: result: no
configure:4173: checking for the location of libz
configure:4188: result: no
configure:4198: checking for the location of libXpm
configure:4213: result: no
configure:4222: checking for FreeType 2
configure:4237: result: /usr/local/
configure:4246: checking for T1lib support
configure:4261: result: no
configure:4270: checking whether to enable truetype string function in GD
configure:4284: result: yes


该贴被wulcan编辑于2014-10-21 9:01:19

该贴由hui.chen转至本版2014-11-5 17:04:53



赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论