为arm 编译包含gd的php5

1) 下载gd的各种依赖包。 但是不要下载gd本身,因为这是包含在php里的。

探索的时候也下载了 libvpx freetype,可惜最后的编译没过,就没有用上

2)编译各种(编译前记得把各种环境变量设上,这里我就直接用以前写好的cross-env.sh)

-- libvpx

xz -d libvpx-v1.3.0.tar.xz
tar -xvf libvpx-v1.3.0.tar
cd libvpx-v1.3.0
./configure --prefix=/h1root/usr/libvpx --target=armv7-linux-gcc
make && make install

-- tiff(后来没用上)

./configure --prefix=/h1root/usr/tiff --host=arm-linux 

-- libpng(花了非常多的时间调查,这两个环境变量不设的话,似乎永远找不到zlib)

export LDFLAGS="-L/h1root/usr/zlib128/lib"
export CPPFLAGS="-I /h1root/usr/zlib128/include"
./configure --prefix=/h1root/usr/libpng --host=arm-linux 

-- freetype

./configure --prefix=/h1root/usr/freetype --host=arm-linux  --without-png

-- gd的单独编译应该不需要。不要下载gd

3) 编译php

千万要注意, --with-gd后不要跟任何东西。这样,就会利用php自带的gd source编译。

如果不这么做,最后连接时会产生错误。

ext/gd/gd.o: In function `zif_imageloadfont':
gd.c:(.text.zif_imageloadfont+0x1d0): undefined reference to `overflow2'
gd.c:(.text.zif_imageloadfont+0x1ec): undefined reference to `overflow2'
ext/gd/gd.o: In function `zif_imagecreatefromstring':
gd.c:(.text.zif_imagecreatefromstring+0x1b8): undefined reference to `gdGetC'
gd.c:(.text.zif_imagecreatefromstring+0x1bc): undefined reference to `gdGetC'
gd.c:(.text.zif_imagecreatefromstring+0x1c0): undefined reference to `getmbi'
gd.c:(.text.zif_imagecreatefromstring+0x1d0): undefined reference to `gdGetC'
gd.c:(.text.zif_imagecreatefromstring+0x1d4): undefined reference to `skipheader'
collect2: ld returned 1 exit status
make[1]: *** [sapi/cgi/php-cgi] Fehler 1
make[1]: Leaving directory `/home/user/freetz/source/target-mips_gcc-4.6.4_uClibc-0.9.32.1/php-5.4.16'
./configure --prefix=/h1root/usr/php --host=arm-linux --enable-libxml --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib=/h1root/usr/zlib128 --without-iconv  --with-libxml-dir=/h1root/usr/libxml2 --without-pear --without-sqlite3 --with-gd --without-pdo_sqlite --with-jpeg-dir=/h1root/usr/jpeg --with-png-dir=/h1root/usr/libpng 

4) 把编译好的程序放到运行环境执行, php --version.

一般会告诉你缺 libpng.so , libjpeg.so , 把这些连接库也考过去就可以了。

5)写个phpinfo的php,在浏览器里执行之后,就会知道php.ini具体该放哪里。 php源程序里有示例php.ini,拿过去用就行。