使用c ++ static编译NDK时出错

时间:2017-07-19 07:20:35

标签: android c++11 android-ndk webrtc

我正在使用ndk编译我的项目,我想使用c++_static来构建我的项目。为此我正在使用 -

APP_STL := c++_static 

并且

APP_CPPFLAGS := -std=c++11 -pthread -frtti  -Wno-format-extra-args -Wno-format-zero-length -Wdeprecated-declarations -fno-builtin-cos -fno-builtin-sin -fno-builtin-cosf -fno-builtin-sinf -fexceptionsin

Application.mk

但是这给了我错误:

/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:313:9: error: '::signbit' has not been declared
 using ::signbit;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:314:9: error: '::fpclassify' has not been declared
 using ::fpclassify;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:315:9: error: '::isfinite' has not been declared
 using ::isfinite;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:316:9: error: '::isinf' has not been declared
 using ::isinf;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:318:9: error: '::isnormal' has not been declared
 using ::isnormal;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:319:9: error: '::isgreater' has not been declared
 using ::isgreater;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:320:9: error: '::isgreaterequal' has not been declared
 using ::isgreaterequal;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:321:9: error: '::isless' has not been declared
 using ::isless;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:322:9: error: '::islessequal' has not been declared
 using ::islessequal;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:323:9: error: '::islessgreater' has not been declared
 using ::islessgreater;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:324:9: error: '::isunordered' has not been declared
 using ::isunordered;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:325:9: error: '::isunordered' has not been declared
 using ::isunordered;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:327:9: error: '::float_t' has not been declared
 using ::float_t;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:328:9: error: '::double_t' has not been declared
 using ::double_t;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:485:9: error: '::acosl' has not been declared
 using ::acosl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:486:9: error: '::asinl' has not been declared
 using ::asinl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:487:9: error: '::atanl' has not been declared
 using ::atanl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:488:9: error: '::atan2l' has not been declared
 using ::atan2l;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:490:9: error: '::cosl' has not been declared
 using ::cosl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:491:9: error: '::coshl' has not been declared
 using ::coshl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:492:9: error: '::expl' has not been declared
 using ::expl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:495:9: error: '::fmodl' has not been declared
 using ::fmodl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:498:9: error: '::logl' has not been declared
 using ::logl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:499:9: error: '::log10l' has not been declared
 using ::log10l;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:500:9: error: '::modfl' has not been declared
 using ::modfl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:501:9: error: '::powl' has not been declared
 using ::powl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:502:9: error: '::sinl' has not been declared
 using ::sinl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:503:9: error: '::sinhl' has not been declared
 using ::sinhl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:504:9: error: '::sqrtl' has not been declared
 using ::sqrtl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:505:9: error: '::tanl' has not been declared
 using ::tanl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:508:9: error: '::tanhl' has not been declared
 using ::tanhl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:509:9: error: '::acoshl' has not been declared
 using ::acoshl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:510:9: error: '::asinhl' has not been declared
 using ::asinhl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:511:9: error: '::atanhl' has not been declared
 using ::atanhl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:512:9: error: '::cbrtl' has not been declared
 using ::cbrtl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:518:9: error: '::erfl' has not been declared
 using ::erfl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:519:9: error: '::erfcl' has not been declared
 using ::erfcl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:520:9: error: '::exp2l' has not been declared
 using ::exp2l;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:521:9: error: '::expm1l' has not been declared
 using ::expm1l;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:526:9: error: '::hypotl' has not been declared
 using ::hypotl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:528:9: error: '::lgammal' has not been declared
 using ::lgammal;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:529:9: error: '::llrintl' has not been declared
 using ::llrintl;
         ^
/Users/aagman/Desktop/Project/Android/android-ndk-r12b/sources/cxx-stl/llvm-libc++/libcxx/include/cmath:531:9: error: '::log1pl' has not been declared
 using ::log1pl;             ^

请帮我解决这个问题。之前我使用gnustl_shared构建了我的项目,它工作正常,但由于某些约束,我需要使用c++ staticc++_shared构建我的项目。

2 个答案:

答案 0 :(得分:1)

使用LLVM libc ++ STL包含<complex>时遇到了同样的问题。一个解决方案&#39;对我有用的是在ndk-bundle/sources/cxx-stl/llvm-libc++/include/cmath中注释掉这些特定的行。

答案 1 :(得分:1)

NDK中的std lib不太可能出错。

我最近遇到过类似的问题,有精确的堆栈但有不同的NDK版本(16b)。 我试图用cmake编译愚蠢。

原来我在包含路径中有“-I src / folly / folly”文件夹,并且由于某种原因cmake没有把系统包括在内。

编译器在folly文件夹中查找<math>和其他系统库。 一旦我从包含列表中删除了这个文件夹,问题就消失了。

  1. 查找定义cmath中使用的基元的文件,然后在路径中找到具有相同名称的文件。
  2. 从包含
  3. 中删除不需要的文件夹
  4. 确保系统首先包含在列表中。