apr移植全记录

下载源码

apr版本apr-1.7.0
https://apr.apache.org/download.cgi?spm=a2c4g.11186623.0.0.7aa126fdh2V87j&file=download.cgi

编译安装源码

#先用gcc编译生成gen_test_char,交叉编译的时候要用
$ ./configure --prefix=/opt/armlib_mipsel/libapr --host=x86_64  CC=gcc
$ make
$ cp tools/gen_test_char /opt/tmp  #零时保存执行文件
$./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8
$ make clean
$ cp /opt/tmp/gen_test_char tools
$ make
$ make install

全过程问题记录

配置完工具链和安装路径直接configure报错

$ ./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc 
...
checking for /dev/zero... configure: error: cannot check for file existence when cross compiling

解决:增加 ac_cv_file__dev_zero=yes

$ ./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc ac_cv_file__dev_zero=yes

换了一改错,接着干

checking whether setpgrp takes no argument... configure: error: cannot check setpgrp when cross compiling

解决:增加 ac_cv_func_setpgrp_void=yes

$ ./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes

又换了错,继续搞

checking whether TCP_NODELAY and TCP_CORK can both be enabled... configure: error: in `/opt/armsrc/apr-1.7.0':
configure: error: cannot run test program while cross compiling
See `config.log' for more details

解决:增加 apr_cv_tcp_nodelay_with_cork=yes

& ./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes

哎,还有问题

config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing default commands
config.status: include/apr.h is unchanged
config.status: include/arch/unix/apr_private.h is unchanged

解决:注释掉 R M " RM " RM"cfgfile"
在这里插入图片描述
可以make了,又报错了

./include/apr_want.h:94:8: error: redefinition of 'struct iovec'
 struct iovec
        ^

解决:增加ac_cv_sizeof_struct_iovec=8

$ ./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8
$ make

继续

/bin/bash: tools/gen_test_char: cannot execute binary file: Exec format error
Makefile:143: recipe for target 'include/private/apr_escape_test_char.h' failed
make[1]: *** [include/private/apr_escape_test_char.h] Error 126
make[1]: Leaving directory '/opt/armsrc/apr-1.7.0'
/opt/armsrc/apr-1.7.0/build/apr_rules.mk:118: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

解决:使用gcc先编译出gen_test_char,然后再编译目标系统

$ ./configure --prefix=/opt/armlib_mipsel/libapr --host=x86_64  CC=gcc
$ make clean
$ make
$ cp tools/gen_test_char /opt/tmp  #零时保存执行文件
$./configure --prefix=/opt/armlib_mipsel/libapr --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8
$ make clean
$ cp /opt/tmp/gen_test_char tools
$ make

最后 make install 就可以了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值