Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unrecognized command line option while compiling boost for android on cygwin

Tags:

c++

cygwin

boost

I am trying to compile boost on cygwin with help of following article

But when I ran following statement

bjam --without-python --without-serialization toolset=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android

It started compilation but failed due to following error:

cc1plus.exe: error: unrecognized command line option "-mthreads"

I am using latest cygwin and boost 1.48.0

I would appreciate if anybody can give me a hint to remove this error.

Update:

I found solution. Boost assumed cygwin has MingW gcc compiler so it added that special option in configuation file "gcc.jam" Once I removed the option it ran OK.

like image 646
Tae-Sung Shin Avatar asked Nov 13 '22 13:11

Tae-Sung Shin


1 Answers

Short

Pass target-os=android to b2

Explanation

I faced with same issue for Boost 1.59

According boost/tools/build/src/tools/gcc.jam line 1024

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

        if $(option)
        {
            OPTIONS on $(targets) += $(option) ;
        }
        if $(libs)
        {
            FINDLIBS-SA on $(targets) += $(libs) ;
        }
    }
}

As you can see -mthreads depends on target-os param

like image 90
CAMOBAP Avatar answered Mar 15 '23 03:03

CAMOBAP