我花了很长时间才找到这个错误的解决方案。当尝试为 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/