我正在尝试在 cygwin 的帮助下编译 boost以下文章 http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/
但是当我运行以下语句时
bjam --without-python --without-serialization toolset=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android
它开始编译但由于以下错误而失败:
cc1plus.exe: error: unrecognized command line option "-mthreads"
我正在使用最新的 cygwin 和 boost 1.48.0
如果有人能给我提示以消除此错误,我将不胜感激。
Update:
我找到了解决方案。 Boost 假设 cygwin 具有 MingW gcc 编译器,因此它在配置文件“gcc.jam”中添加了该特殊选项,一旦我删除了该选项,它就可以正常运行。
Short
Pass target-os=android
to b2
解释
我在 Boost 1.59 中遇到了同样的问题
根据boost/tools/build/src/tools/gcc.jam
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) ;
}
}
}
如你看到的-mthreads
依赖于取决于target-os
param
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)