无法识别的命令行选项,同时编译boost for cygwin [英] unrecognized command line option while compiling boost for android on cygwin
问题描述
我试图通过以下文章
但是当我运行以下语句时
bjam --without-python --without-serialization toolset = gcc-android4.4.3 link = static runtime-link = static target-os = linux --stagedir = android
它开始编译,但由于以下错误而失败:
cc1plus.exe:错误:无法识别的命令行选项-mthreads
我使用最新的cygwin和boost 1.48.0
如果有人可以给我一个提示删除此错误,我将感激。
更新:
我找到解决方案。 Boost认为cygwin有MingW gcc编译器,所以它添加了配置文件gcc.jam中的特殊选项。一旦我删除了它的选项就可以了。
短
通过 target-os = android
c $ c> b2
说明我面临同样的问题Boost 1.59
根据 boost / tools / build / src / tools / gcc.jam
line 1024
规则设置 - 线程(目标*: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:#没有线程选项,一切都在。
case windows:option = -mthreads;
case cygwin:option = -mthreads;
case solaris:option = -pthreads; libs = rt;
case beos:#没有线程选项。
case haiku:option =;
case * bsd:option = -pthread; #在BSD上没有-lrt。
case sgi:#gcc on IRIX不支持多线程。
case darwin:#没有线程选项。
case *:option = -pthread; libs = rt;
}
如果$(选项)
{
选项$(目标)+ = $(选项);
}
如果$(libs)
{
FINDLIBS-SA on $(targets)+ = $(libs);
}
}
}
c $ c> -mthreads 取决于 target-os
param
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.
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
这篇关于无法识别的命令行选项,同时编译boost for cygwin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!