|
Boost : |
Subject: Re: [boost] Support for Android
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-01-22 02:04:16
2014/1/22 Vladimir Prus <ghost_at_[hidden]>
> On 22.01.2014 10:15, Antony Polukhin wrote:
>
>> >Would your scripts take care of -lrt?
>>> >What about -lpthread?
>>>
>>
>> No. No. This must be fixed by bjam or Google (preferable).
>>
>
> Would the below patch, along with using target-os=android when building,
> do the trick?
>
Looks like it will do the trick! Thanks a lot!
However this arise a question:
Who is in charge of specifying platform specific thread libraries? Bjam or
each library developer?
For example Boost.Chrono has the following:
./chrono/build/Jamfile.v2: <target-os>freebsd:<linkflags>"-lrt"
./chrono/build/Jamfile.v2: <target-os>linux:<linkflags>"-lrt
-lpthread"
./chrono/perf/Jamfile.v2: <target-os>freebsd:<linkflags>"-lrt"
./chrono/perf/Jamfile.v2: <target-os>linux:<linkflags>"-lrt"
./chrono/test/Jamfile.v2: <target-os>freebsd:<linkflags>"-lrt"
./chrono/test/Jamfile.v2: <target-os>linux:<linkflags>"-lrt
-lpthread"
While bjam has exactly the same rules:
switch $(target)
{
case windows : option = -mthreads ;
case cygwin : option = -mthreads ;
case solaris : option = -pthreads ; libs = rt ;
case beos : # No threading options.
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 ;
}
And why do these rules do not work:
If I remove handwritten rules from one of the jamfiles, I'll get
../../../bin.v2/libs/variant/perf/move_perf.test/gcc-4.6/release/link-static/move_perf.o:
In function `scope::~scope()':
move_perf.cpp:(.text._ZN5scopeD2Ev[_ZN5scopeD5Ev]+0x1b): undefined
reference to `clock_gettime'
-- Best regards, Antony Polukhin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk