android - 错误 "cannot find -lrt"为 Android 构建 Boost

所以我正在尝试为 android 构建 boost 1.55,但我收到 Boost.System 和 Boost.Atomic 的链接错误,即“错误:找不到 -lrt”。当然,android 没有 librt,因为它内置在 C 运行时中。所以,我试图得到 boost ,所以它不会链接到 librt。我尝试只删除源代码中的每个“-lrt”:

find . -type f | xargs -n1 -P 8 sed -i "s/-lrt//g"

但我仍然遇到同样的错误。如何使 boost 不链接到 librt for android?

最佳答案

确实,所有使用 sed 的 -lrt 发生似乎对问题没有任何影响。
对我有用的(不过在 boost 1.53.0 中)如下:

  • 编辑tools/build/v2/tools/gcc.jam
  • 注释 libs = rt ; 在此代码部分(顺便说一句,可能是您没有 -pthread 选项行):

        case * :
        {
            option = -pthread ;
            libs = rt ;   <--Comment this line
        }
    

注意:作为初始/蛮力解决方案,我会采用失败的命令并手动运行它们,从中删除 -lrt

关于android - 错误 "cannot find -lrt"为 Android 构建 Boost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27851974/

相关文章:

c++ - 构建 Boost 动态可链接会导致链接错误?

android - 在 gradle 中添加对特定 productFlavor 和 buildTyp

c# - TFS 构建测试结果

android - 如何生成 R.java

linux - 下载 tar.gz 包时不支持的协议(protocol)

java - 如何告诉 ant 使用特定的 javac 可执行文件进行构建?

iphone - 在 Xcode 中将build设置重置为默认值?

java - 如何使用命令行在 Linux 下使用 Java 构建 OpenCV?(将在 MapRe

ant - Apache ant 无法识别 'for' 任务/宏,虽然我已经通过 taskdef 添

xcode - 使用运行脚本时更新 Xcode 构建进度条