产品中 configure/cross compile的一个bug

在mac机上, 为iPhone版本编译产品. 运行./configure报错如下:

configure:22793: error: cannot run test program while cross compiling
See `config.log' for more details

 

原因:

aclocal/xx.m4中, 有如下代码:

AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
// ...
])], [var="a"], [var="b"])

 

https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Runtime.html

If the compiler being used does not produce executables that run on the system where configure is being run, then the test program is not run. If the optional shell commandsaction-if-cross-compiling are given, they are run instead. Otherwise, configure prints an error message and exits.

在configure中, 我们需要实际run一些代码来检查系统. 对于cross compile的情况, 我们实际上没有相应的运行环境. 所以configure会报错退出.

 

posted @ 2016-04-15 12:07  brayden  阅读(439)  评论(0编辑  收藏  举报