Building Boost for Android with error “cannot find -lrt”

编辑tools/build/src/tools/gcc.jam

rule setup-threading ( targets * : sources * : properties * )
{
local threading = [ feature.get-values threading : $(properties) ] ;
if $(threading) = multi
{
local target = [ feature.get-values target-os : $(properties) ] ;
local option ;
local libs ;

switch $(target)
{
case android : # No threading options, everything is in already.
case windows : option = -mthreads ;
case cygwin : option = -mthreads ;
case solaris : option = -pthreads ; libs = rt ;
case beos : # No threading options.
case haiku : option = ;
case *bsd : option = -pthread ; # There is no -lrt on BSD.
case sgi : # gcc on IRIX does not support multi-threading.
case darwin : # No threading options.
case * : option = -pthread ; #libs = rt ;
}

将libs = rt这行注释掉

------------------------------------------------------------------

Indeed all occurrencies of -lrt with sed doesn‘t seem to have any impact on the problem.
What worked for me (in boost 1.53.0 though) is the following:

Edit tools/build/v2/tools/gcc.jam

Comment libs = rt ; in this code section (By the way, it could be that you do not have the -pthread option line):

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

Note: As initial/brute force solution, I would take the failed commands and manually run them removing -lrt from them.

question:

So I am trying to build boost 1.55 for android, but I am getting linking errors for Boost.System and Boost.Atomic, that say "error: cannot find -lrt". Of course, android doesn‘t have librt because its built into the C runtime. So, I am trying to get boost so it won‘t link to librt. I tried just deleting every "-lrt" in the source code:

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

But I still get the same error. How do I make boost not link against librt for android?

answer:

Indeed all occurrencies of -lrt with sed doesn‘t seem to have any impact on the problem.
What worked for me (in boost 1.53.0 though) is the following:

Edit tools/build/v2/tools/gcc.jam

Comment libs = rt ; in this code section (By the way, it could be that you do not have the -pthread option line):

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

Note: As initial/brute force solution, I would take the failed commands and manually run them removing -lrt from them.

时间: 2024-08-02 23:34:48

Building Boost for Android with error “cannot find -lrt”的相关文章

ANDROID Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER

今天测试时,手机已安装了多开助手,再安装我厂自己的应用,安装失败了,报错ANDROID Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER 这是由于环境中已有一个同名的Provider存在. 网查解决方法是修改AndroidManifest.xml中的 <provider android:name="DataProvider"             android:authorities="com.misoo

[Exception Android 20] - Error:Execution failed for task &#39;:app:processDebugResources&#39;

Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Android\adt-bundle-windows-x86_64-20140702\sdk\build-tools\22.0.1\aapt.ex

Android MediaPlayer Error -1004

之前用Android自带的VideoView播放在线视频一直没问题的,今天突然碰到无法播放. MediaPalyer返回的错误代码是-1004,API文档上写的是:Bitstream is not conforming to the related coding standard or file spec. 最后查明是因为我用了Mac下的Charles,然后没有开代理服务导致的... 进入系统关闭代理即可.... Android MediaPlayer Error -1004

Android Studio-error: Error retrieving parent for item: No resource found that matches the given name &#39;android:Wind

在遇到这两个问题的时候: android:TextAppearance.Material.Widget.Button.Inverse找不到或者报错问题 Error retrieving parent for item: No resource found that matches the given name 'android:Wind 在Android Studio SDK升级到android6.0的时候也就是API为23,报错的话,可以用如下方式,删除23的信息. 我用的是5.0.1,所以删

android - Lint Error Checking导致的无法打包问题的解决办法

Export aborted because fatal lint errors were found.These are listed in the Problems view.Either fix these before running Export again,or turn off "Run full error check when exporting app" in the Android > Lint Error checking preference page.

Android emulator: ERROR: Unable to load VM from snapshot.

Android emulator: ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different. 昨天使用Inteliij IDEA 编译工程,运行的时候,遇到了上面这个问题. 解决办法.点击loris(这里会显示你的工程名),编辑运行配置. 选择 Target Device.选择第一个对话框就可以,重新运行就可以了.

android stack error message is Fail to start the plugin

E: 08-26 16:34:11.934: E/AliSDK(32236): 错误编码 = 1002208-26 16:34:11.934: E/AliSDK(32236): 错误消息 = SDK 组件 Qupaisdk 启动出错,错误消息为 [Qupaisdk], the android stack error message is Fail to start the plugin, which is caused by dalvik.system.PathClassLoader[DexPa

Grade 编译 Android 解决 Error:more than one library with package name

Grade 编译 Android 解决 Error:more than one library with package name Error: more than one library with package name 'com.app.XX' You can temporarily disable this error with android.enforceUniquePackageName=false However, this is temporary and will be en

解决 Boost安装:fatal error: bzlib.h: No such file or directory 问题

参考: How to install all the boost development libraries? 解决 Boost安装:fatal error: bzlib.h: No such file or directory 问题 在安装boost时,步骤./b2出现如下错误: gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.9.4/release/link-static/threading-multi/bzip2.o libs/iostr