为安卓构建带有错误"cannot find -lrt"的加速

Building Boost for Android with error "cannot find -lrt"

本文关键字:cannot find 加速 -lrt 有错误 构建      更新时间:2023-10-16

所以我正在尝试为 android 构建 boost 1.55,但我遇到了 Boost.System 和 Boost.Atomic 的链接错误,上面写着"错误:找不到 -lrt"。当然,android 没有 librt,因为它内置在 C 运行时中。所以,我正在尝试获得提升,这样它就不会链接到 librt。我尝试删除源代码中的每个"-lrt":

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

但我仍然收到同样的错误。如何使提升不链接到安卓版的librt?

事实上,

所有带有 sed 的 -lrt occurrency 似乎对这个问题没有任何影响。
对我有用的(虽然在 boost 1.53.0 中)如下:

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

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

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