Building Boost for Android with error "Cannot FIND-LRT"

Source: Internet
Author: User

Edit 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 are 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;
}

Comment out the line libs = RT

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

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

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

Comment libs = RT; In this Code section (by the the-the-line, it could is, and does not has 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 SA Y "Error:cannot find-lrt". Of course, Android doesn ' t has 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 does I make boost not link against Librt for Android?

Answer

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

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

Comment libs = RT; In this Code section (by the the-the-line, it could is, and does not has 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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.