努力 奋斗 专注于linux内核 微信:tolimit 扣扣:348958453
2015年(26)
分类: 嵌入式
2015-03-27 15:48:58
软件版本:php-5.4.27
依赖库:zlib,libxml2
交叉编译器:arm-hisiv200-linux-gnueabi
PATH=$PATH:/usr/local/arm-hisiv200-linux/bin/
软件版本:nginx-1.6.2
依赖源码:pcre,zlib(这里是需要用到它们的源码)
交叉编译器:arm-hisiv200-linux-gnueabi
linux版本:32位ubuntu(这个很重要,主要是使用32位x86系统才能进行编译成功,因为字长不一样)
交叉编译nginx与交叉编译php5不同就是nginx用的是依赖的库的源码,而php5用的是库文件。
checking for OS + Linux 3.13.0-43-generic x86_64 checking for C compiler ... found but is not working ./configure: error: C compiler /home/shanlink/Cross_compile/arm-hisiv200-linux/bin/arm-hisiv200-linux-gnueabi-gcc is not found
解决办法就是:编辑auto/cc/name文件,在文件开头有如下一段,注释掉exit 1
checking for TCP_INFO ... found checking for accept4() ... found checking for int size ...objs/autotest: 1: objs/autotest: Syntax error: word unexpected (expecting ")") bytes ./configure: error: can not detect int size cat: objs/autotest.c: No such file or directory
解决方法:编辑auto/types/sizeof文件,找到
checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/home/shanlink/Cross_compile/pcre-8.11': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details. make[1]: *** [/home/shanlink/Cross_compile/pcre-8.11//Makefile] Error 1 make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2' make: *** [build] Error 2
这个是由于nginx在编译时会同时配置pcre并且进行编译,而由于是交叉编译,pcre的配置时需要添加--host=arm-hisiv200-linux-gnueabi,因为是由nginx自动配置的,所以我们需要手动添加此选项于pcre,然后再make,此选项添加在
src/core/ngx_slab.c: In function 'ngx_slab_alloc_locked': src/core/ngx_slab.c:209: error: integer constant is too large for 'long' type src/core/ngx_slab.c:209: error: comparison is always true due to limited range of data type src/core/ngx_slab.c:221: error: integer constant is too large for 'long' type src/core/ngx_slab.c:221: error: comparison is always false due to limited range of data type src/core/ngx_slab.c:223: error: integer constant is too large for 'long' type src/core/ngx_slab.c:223: error: comparison is always true due to limited range of data type src/core/ngx_slab.c:253: error: integer constant is too large for 'long' type src/core/ngx_slab.c:253: error: comparison is always true due to limited range of data type src/core/ngx_slab.c:262: error: integer constant is too large for 'long' type src/core/ngx_slab.c:262: error: comparison is always false due to limited range of data type src/core/ngx_slab.c:289: error: left shift count >= width of type src/core/ngx_slab.c:292: error: integer constant is too large for 'long' type src/core/ngx_slab.c:294: error: left shift count >= width of type src/core/ngx_slab.c:304: error: integer constant is too large for 'long' type src/core/ngx_slab.c:376: error: left shift count >= width of type src/core/ngx_slab.c: In function 'ngx_slab_free_locked': src/core/ngx_slab.c:499: error: integer constant is too large for 'long' type src/core/ngx_slab.c:499: error: comparison is always false due to limited range of data type src/core/ngx_slab.c:552: error: integer constant is too large for 'long' type src/core/ngx_slab.c:575: error: integer constant is too large for 'long' type src/core/ngx_slab.c:575: error: comparison is always false due to limited range of data type src/core/ngx_slab.c:582: error: integer constant is too large for 'long' type src/core/ngx_slab.c: In function 'ngx_slab_alloc_pages': src/core/ngx_slab.c:643: error: integer constant is too large for 'long' type src/core/ngx_slab.c:652: error: integer constant is too large for 'long' type src/core/ngx_slab.c:652: error: large integer implicitly truncated to unsigned type make[1]: *** [objs/src/core/ngx_slab.o] Error 1 make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2' make: *** [build] Error 2
src/os/unix/ngx_errno.c: In function 'ngx_strerror': src/os/unix/ngx_errno.c:37: error: 'NGX_SYS_NERR' undeclared (first use in this function) src/os/unix/ngx_errno.c:37: error: (Each undeclared identifier is reported only once src/os/unix/ngx_errno.c:37: error: for each function it appears in.) src/os/unix/ngx_errno.c: In function 'ngx_strerror_init': src/os/unix/ngx_errno.c:58: error: 'NGX_SYS_NERR' undeclared (first use in this function) make[1]: *** [objs/src/os/unix/ngx_errno.o] Error 1 make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2' make: *** [build] Error 2
解决方法就是打开objs/ngx_auto_config.h,添加
另一个错误
同样的,我们需要修改objs/ngx_auto_config.h文件,在文件中加入
软件版本:squid-2.7-STABLE9
交叉编译器:arm-hisiv200-linux-gnueabi
系统:32位ubuntu
在对squid进行交叉编译时,需要用到x86版本的squid,所以我们要进行两个版本的编译。
./configure --prefix=X86_SQUID_PATH
#!/bin/bash ./configure --host=arm-hisiv200-linux-gnueabi --prefix=/home/shanlink/Cross_compile/squid_ccs/ --cache-file=arm-linux.cache
这时应该是能够顺利通过的
./cf_gen: cannot execute binary file