【问题标题】:how to force "./configure" to stop using -pthread during compilation?如何在编译期间强制“./configure”停止使用-pthread?
【发布时间】:2012-09-25 22:25:08
【问题描述】:

我正在尝试为 Android 交叉编译一些东西,它支持 pthread,但在编译和链接时不使用 -pthread。如果你尝试使用-pthread,使用交叉编译器的编译会失败。

当尝试通过首先使用“配置”工具进行交叉编译时,它会一直尝试使用 -pthread 来执行“检查 gethostbyname”之类的操作,因此我的配置失败:

configure:21229: checking for gethostbyname
configure:21229: /mnt/hgfs/Documents/thesis/android-wmon/core/android-wireshark/agcc \
     -o conftest -D_U_="__attribute__((unused))" -g -O2 -Wall -W -Wextra \
     -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith \
     -Wno-pointer-sign -Warray-bounds -Wcast-align -Wformat-security \
     -fexcess-precision=fast -I/usr/local/include -pthread \
     -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \
     -I/usr/local/include  -Wl,--as-needed -L/usr/local/lib conftest.c  >&5
arm-eabi-gcc: error: unrecognized option '-pthread'

我找不到它从哪里获取这个标志,以及如何让它停止这样做。我在任何地方的配置中都看不到它,因此它必须是动态生成的。我似乎无法找到它在哪里执行此操作,因此我可以将它从它存储在 configure 中的任何变量中删除。

【问题讨论】:

  • 虽然我确信有更好的解决方案,但您始终可以提供一个 libpthread.a 来获取 ;)
  • 配置是一个shell脚本。打开它,搜索“-pthread”,然后将其删除。
  • 脚本中没有-pthread,它似乎是从某个地方生成它并将其存储在一个变量中。我认为它会在 $CFLAGS 中生成它......试图找到它。

标签: android compilation compiler-errors configure


【解决方案1】:

嗯,这是一个 hack,但您似乎可以在 CFLAGS 尝试链接测试之前对其进行操作:

ac_fn_c_try_link ()
{
        CFLAGS="${CFLAGS/-pthread/}"

...在“配置”中

【讨论】:

    猜你喜欢
    • 2011-07-20
    • 1970-01-01
    • 2012-12-24
    • 1970-01-01
    • 2012-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多