Subject: Re: [boost] Support for Android
From: Vladimir Prus (ghost_at_[hidden])
Date: 2014-01-22 02:26:50
On 22.01.2014 11:04, Antony Polukhin wrote:
> 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?
It normally should be specified by Boost.Build.
> 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
> ./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
> 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
> In function `scope::~scope()':
> move_perf.cpp:(.text._ZN5scopeD2Ev[_ZN5scopeD5Ev]+0x1b): undefined
> reference to `clock_gettime'
That's because the above build is not threading=multi, it's just single threaded build. I think that the 'rt' library
is not actually threading, it has some timer stuff, so if chrono needs to use such timer stuff specifically,
there's nothing extremely wrong about specifying that separately.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk