致电' fmax'在交叉编译android

时间:2017-07-12 21:09:15

标签: android c++ cross-compiling

在为Android进行交叉编译时获取call to 'fmax' is ambiguous。有三个候选人:

src/interest-control.cpp:218:15: error: call to 'fmax' is ambiguous
     i <= fmax(limit_, pipeline_);
          ^~~~
<...>/toolchain/sysroot/usr/include/math.h:196:8: note: candidate function
double  fmax(double, double) __attribute_const__;
        ^
<...>/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/math.h:1116:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmaxf(__lcpp_x, __lcpp_y);}
                                             ^
<...>/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/math.h:1117:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}

我觉得编译器很困惑。这是我的CFLAGS和CPPFLAGS:

$ echo $CFLAGS 
-isystem <...>/toolchain/include/c++/4.9.x/ --sysroot=<...>/toolchain/sysroot -I<...>/toolchain/sysroot/usr/include -I<...>/toolchain/include
$ echo $CPPFLAGS
-isystem <...>/toolchain/include/c++/4.9.x/ --sysroot=<...>/toolchain/sysroot -I<...>/toolchain/sysroot/usr/include -I<...>/toolchain/include

然而,编译器有更多的系统搜索路径:

#include "..." search starts here:
#include <...> search starts here:
 .
 ./include
 ./src
 <...>/toolchain/include
 <...>/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x
 <...>/toolchain/sysroot/usr/local/include
 <...>/toolchain/lib64/clang/5.0.300080/include
 <...>/toolchain/sysroot/usr/include

这会在构建时导致混乱。 当我使用-nostdinc标志时,会导致更多问题(例如找不到float.h文件等)。 我生成了standalone android toolchain并使用GNU Autotools来编译库。

我的问题是:

  1. 为什么生成的工具链含糊不清并与其自己的sysrootinclude/c++/4.9.x路径发生冲突?
  2. 使用哪个搜索路径目录 - sysrootinclude/c++/4.9.x(现在,两者都被使用,因为任何一个都不够,例如导致文件找不到错误;但它们都导致暧昧的电话)?

0 个答案:

没有答案