1.zlib编译
zlib库官网网址:http://www.zlib.net/
zlib库源码下载地址:http://www.zlib.net/fossils/
tar -xzvf zlib-1.2.7.tar.gz
cd zlib-1.2.7/
./configure --prefix=../compile_result
vim Makefile # 修改Makefile中的CC并且将其中的gcc全部替换为$(CC)
CC=xxxx-gcc #交叉编译工具链的路径xxxx-gcc
make clean && make && make install
cd ..
2.libpng编译
libpng库官网网址:http://www.libpng.org/pub/png/libpng.html0
libpng库源码地址:https://sourceforge.net/projects/libpng/files/libpng16
通过修改Makefile的方法来编译的,主要是指定编译器、安装目录、zlib库路径。下面是先解压并复制makefile.linux到编译目录。
tar -xzvf libpng-1.5.13.tar.gz
cd libpng-1.5.13/
cp scripts/makefile.linux ./Makefile
然后修改Makefile文件:修改CC、prefix、ZLIBLIB、ZLIBINC这几个变量的值,修改如下:
CC=xxx-gcc #交叉编译工具链的路径xxxx-gcc
prefix=../compile_result
ZLIBLIB=../compile_result/lib
ZLIBINC=../compile_result/include
或者通过设置参数进行编译
#配置STAGING_DIR环境变量。 交叉编译工具路径
export STAGING_DIR="xxx/bin"
#指定交叉编译链工具。
exportCC="xxx/bin/mipsel-openwrt-linux-gcc"
#指定交叉编译参数。
#xxx/output/zlib/lib 编译好的zlib库的lib
#xxx/output/zlib/include 编译好的zlib库的include
./configure--prefix=xx/png --host=mipsel-linux CFLAGS="-Ixxx/output/zlib/include"CPPFLAGS="-Ixxx/output/zlib/include" LDFLAGS="-Lxxx/output/zlib/lib"
最后执行下面命令编译即可
make clean && make && make install
cd ..