我知道这个问题很模糊,但我不太清楚如何表达我在这里面临的问题:我正在尝试从 sources 交叉编译 Prolog(特别是 SWI-Prolog)的实现.他们使用 GNU-Autoconf 工具(我是一个完整的初学者)来构建源代码,所以我想我可以设置 --host
和 --build
三元组以允许 ARM 交叉编译,但它不起作用。这是我发出的命令:
$ ./configure --build=i686-pc-linux-gnu --host=arm-linux-gnueabi
(... lots of checks ...)
checking for clock_gettime in -lrt... yes
checking for clock_gettime... yes
checking for pthread support for cpu clocks... configure: error: in `(...)/pl-6.6.5/src':
configure: error: cannot run test program while cross compiling
See `config.log' for more details
(完整输出粘贴 here )
我检查了 config.log file ,但我无法理解到底缺少什么。我知道在这个阶段,可能有几个缺少的库或错误,但我无法理解从哪里开始。
最佳答案
configure
的输出说:
checking for pthread support for cpu clocks... configure: error: in `(...)/pl-6.6.5/src':
configure: error: cannot run test program while cross compiling
这可能意味着在
configure.ac
中的某个地方有一个宏调用 AC_TRY_RUN
或类似的东西。这个宏基本上编译一个可执行文件并执行它,试图找出更多细节。交叉编译时调用此宏将不起作用,因为构建和主机架构不同。从您的粘贴中,似乎还有另一个不会导致 configure
失败:checking whether mutex support recursive locking... ./configure: line 7307: ./conftest: cannot execute binary file
恕我直言,包维护者应该被告知他们的包不会交叉编译(除非他们在
README
或其他文档中明确说明不会交叉编译)。为了让它交叉编译,你必须找出
AC_TRY_RUN
的“正确”答案。测试您的平台并找到将它们集成到 configure.ac
中的方法,基本上是修补 configure.ac
.包维护人员也可能能够协助完成此任务。我想你也可以使用类似 Scratchbox2 的东西如果它适用于您的设备。
关于gcc - 为什么 ARM 的交叉编译在 ./configure 中失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23888063/