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

來源:互聯網
上載者:User

標籤:-o   support   getting   lin   oid   building   edit   ble   target   

編輯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.

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.