Apache 交叉编译错误 ./gen_test_char:无法执行二进制文件 [英] Apache Cross Compilation Error ./gen_test_char: cannot execute binary file
问题描述
我花了很长时间才找到解决此错误的方法.当尝试为 Arm 交叉编译 Apache 时(我确信这可能发生在许多其他架构上),我会从服务器文件夹中得到这个错误:
I looked quite some time to find a solution to this bug. When trying to Cross-Compile Apache for an Arm (I am sure that this could happen for many other Architectures), I would get this bug from with in the server folder:
./gen_test_char: cannot execute binary file
这意味着 Apache 正在尝试为实际设备编译这个 test_char.h 生成器,而我需要它在我交叉编译的 Ubuntu 上运行.Ubuntu 无法将编译的 gen_test_char 识别为可执行文件,因此我需要为 Ubuntu 正确编译它.
This means that Apache is trying to compile this test_char.h generator for the actual device while I need it to run on my Ubuntu where I am Cross-Compiling. Ubuntu does not recognize the compiled gen_test_char as an executable so I need to get it compiled correctly for Ubuntu.
推荐答案
我搜索并搜索并发现了几次尝试修补但没有一个奏效.其中大部分是直接从 Apache 开发组建议的补丁.
I searched and searched and found several tries to patch but none of them worked. Most of these were patches suggested directly from the Apache dev group.
但我终于遇到了这个Apache 邮件列表.它提出了补丁无法提供的直接解决方案.
But I finally came across this Apache mail list. It suggests a straight forward solution that the patches could not provide.
在尝试交叉编译 Apache 之前编译 gen_test_char 应用程序.所以我做了.并按照建议进行操作,效果非常好.
Compile the gen_test_char app before trying to cross-compile Apache. So I did. And followed the suggestions and it worked like a charm.
相反,只需使用以下内容编译 gen_test_char.c 1st:gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o 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);
并在此编译后运行它以获得所需的输出:
and after this compilation run it to get the desired output with:
./gen_test_char > test_char.h
这篇关于Apache 交叉编译错误 ./gen_test_char:无法执行二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!