【问题标题】:Building Boost for Android with error "cannot find -lrt"为 Android 构建 Boost 时出现错误“找不到 -lrt”
【发布时间】:2015-03-07 06:24:35
【问题描述】:

所以我正在尝试为 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"

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

【问题讨论】:

    标签: android c++ boost build


    【解决方案1】:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-22
      • 2018-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多