【Building Boost for Android with error “cannot find -lrt”】古人已用三冬足,年少今开万卷余。这篇文章主要讲述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.
推荐阅读
- Android,加载离线Android API文档缓慢问题!
- 什么是文档数据库(有哪些优缺点?用法介绍)
- Git更新(如何在Linux、Windows和macOS更新到最新版本的Git())
- Helm与Kustomize比较(有哪些区别(哪个更好?))
- Ansible与Kubernetes有什么区别(哪个更好?)
- 如何使用helm install命令(用法示例指南)
- 如何解决Git中的合并冲突(详细操作步骤指南)
- 如何计算混合云成本(详细分析和指南)
- 如何拉取和推送Helm Chart(详细操作步骤指南)