c++ - Apache 交叉编译错误./gen_test_char : cannot execute binary file

标签 c++ apache ubuntu arm cross-compiling

我花了很长时间才找到这个错误的解决方案。当尝试为 Arm 交叉编译 Apache 时(我确信这可能发生在许多其他架构上),我会从服务器文件夹中得到这个错误:

 ./gen_test_char: cannot execute binary file

这意味着 Apache 正在尝试为实际设备编译此 test_char.h 生成器,而我需要它在我正在交叉编译的 Ubuntu 上运行。 Ubuntu 无法将编译后的 gen_test_char 识别为可执行文件,因此我需要为 Ubuntu 正确编译它。

最佳答案

我搜索了又搜索,发现有好几次尝试打补丁,但都没有成功。其中大部分是 Apache 开发组直接建议的补丁。

但我终于遇到了这个Apache mail list .它提出了补丁无法提供的直接解决方案。

在尝试交叉编译 Apache 之前编译 gen_test_char 应用程序。所以我做了。并听从了建议,效果非常好。

instead just compile gen_test_char.c 1st with something like: gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o gen_test_char then run it and put its output into the include folder (or where its placed normaly);

在此编译之后运行它以获得所需的输出:

 ./gen_test_char > test_char.h

关于c++ - Apache 交叉编译错误./gen_test_char : cannot execute binary file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18408400/

相关文章:

javascript - 将 Bigfoot.js 与 Apache Web 服务器结合使用

apache - 如何使用非根 url 配置 phabricator?

代码 :blocks not compiling code in Ubuntu Linux

linux - 在 bash 变量赋值中引用

apache - 使用 dispatch.cgi 运行 CGI 时出现 perl Dancer 问题

c++ - 学习 C++ 并在早期示例中遇到错误(非静态数据成员之前需要构造函数)

c++ - 字 rune 字的 U 前缀与字符串文字的区别是什么?

c++ - 如果我从 getter 生成迭代器,程序将中止

java - com.mongodb.MongoSocketOpenException : Exception opening socket 异常

c++ - round 比 LLVM 中的 floor/ceil/int 慢得多