linux交叉编译zlib,zlib库交叉编译方法

  • Post author:
  • Post category:linux

下载地址:http://www.zlib.net/

版本:1.2.8

编译环境:CPU为arm,操作系统为linux

编译方法:

1、export CC=arm-linux-gcc

2、./configure –prefix=$PWD/_install

_install为创建输出的指定目录

如果出现如下错误时:

[root@localhost zlib-1.2.8]# ./configure –shared –prefix=$PWD/_install

Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).

在configure 删除以下字段,避免将warn处理为error :

echo “Checking for obsessive-compulsive compiler options…” >> configure.log

if try $CC -c $CFLAGS $test.c; then

:

else

echo “Compiler error reporting is too harsh for $0 (perhaps remove -Werror).” | tee -a configure.log

leave 1

fi

3、make && make install

4、在_install/lib目录下是动态与静态库文件,_install/include下是头文件。