2014-10-10 232 views
3

免责声明:我在这里是新的,我已经尽我所能按照发布指南,所以请让我知道如果这需要任何额外的信息。我对Linux开发也比较陌生。交叉编译ARM的ActiveMQ

背景: 我正在Linux上使用ActiveMQ-cpp构建一个库。我已经在主机Ubuntu PC上成功构建并运行了它,但是试图为目标基于ARM的机器交叉编译它会产生一些非常深奥的错误。

第一步包括使用arm-linux-gcc编译器构建APR(http://apr.apache.org/)。经过一番研究,以下命令运行配置脚本时几乎没有大惊小怪:

CC=/usr/local/arm-linux/bin/arm-linux-gcc ./configure --prefix=/root/apr-arm --host=arm-linux cross_compiling=yes ac_cv_file__dev_zero=no ac_cv_func_setpgrp_void=no apr_cv_tcp_nodelay_with_cork=no apr_cv_process_shared_works=no 

这允许下一步 - 运行makefile。

本期:进入使在命令行上,在下面的行过早退出:

[...] 
/root/.local/share/Trash/files/apr-1.5.1/build/mkdir.sh include/private 
tools/gen_test_char > include/private/apr)escape_test_char.h 
/bin/bash: tools/gen_test_char: cannot execute binary file 
make[1]: *** [include/private/apr_escape_test_char.h] Error 126 
make[1]: Leaving directory `/root/.local/share/Trash/files/apr-1.5.1' 
make: *** [all-recursive] Error 1 

尝试的修复:一个解决以下问题,发表了提问者,没有奏效。有可能我没有正确地遵循这个过程(Apache Cross Compilation Error ./gen_test_char: cannot execute binary file

在同一主题中,我试着从目录中暂时删除问题gen_test_char程序,但巧妙的脚本只是重建它。

我的目标是要么避免这个错误,并在Ubuntu上继续构建过程,或者考虑其他构建库的方法。我已经在Windows上的VS2013中毫无困难地构建了它,因此如果可以为ARM体系结构交叉编译该项目,我会很乐意继续这样做。

回答

0

APR需要gen_test_char被编译系统不是手臂,为什么会得到“斌/庆典:工具/ gen_test_char:无法执行二进制文件”的错误,因为make程序是要在执行gen_test_char您系统,如果你交叉编译,那么每次你得到这个错误。

要避免此错误,请按照下列步骤操作:

1) Cross compile APR which is going to fail 
2) compile APR for system and copy gen_test_char to cross compiled APR's directory. 
3) Again cross compile 

执行上述步骤,你不应该得到“无法执行二进制文件”的错误之后。