我想在macOS上构建caffe2。
构建caffe2就可以了,但是当我构建android时,使用caffe2/scripts/build_android.sh
处理是100%然后发生:
CMake Error at /usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CheckCXXSourceCompiles.cmake:97 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
cmake/MiscCheck.cmake:34 (CHECK_CXX_SOURCE_COMPILES)
CMakeLists.txt:61 (include)
我的cmake版本是:
cmake version 3.10.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
所有日志是:
```
CMake Error at third_party/android-cmake/android.toolchain.cmake:310 (file):
file STRINGS file
"/Users/zhouhuacong/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/usr/include/android/api-level.h"
cannot be read.
Call Stack (most recent call first):
third_party/android-cmake/android.toolchain.cmake:814 (__DETECT_NATIVE_API_LEVEL)
/usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:6 (project)
CMake Error at third_party/android-cmake/android.toolchain.cmake:816 (message):
Specified Android API level (21) does not match to the level found ().
Probably your copy of NDK is broken.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:6 (project)
CMake Deprecation Warning at /usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeForceCompiler.cmake:69 (message):
The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set
CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
third_party/android-cmake/android.toolchain.cmake:1139 (CMAKE_FORCE_C_COMPILER)
/usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:6 (project)
CMake Deprecation Warning at /usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeForceCompiler.cmake:83 (message):
The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set
CMAKE_CXX_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
third_party/android-cmake/android.toolchain.cmake:1151 (CMAKE_FORCE_CXX_COMPILER)
/usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:6 (project)
-- Performing Test CAFFE2_LONG_IS_INT32_OR_64
CMake Error at /Users/zhouhuacong/CaffeProject/caffe2/third_party/android-cmake/android.toolchain.cmake:310 (file):
file STRINGS file
"/Users/zhouhuacong/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/usr/include/android/api-level.h"
cannot be read.
Call Stack (most recent call first):
/Users/zhouhuacong/CaffeProject/caffe2/third_party/android-cmake/android.toolchain.cmake:814 (__DETECT_NATIVE_API_LEVEL)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/3.10.1/CMakeSystem.cmake:6 (include)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)
CMake Error at /Users/zhouhuacong/CaffeProject/caffe2/third_party/android-cmake/android.toolchain.cmake:816 (message):
Specified Android API level (21) does not match to the level found ().
Probably your copy of NDK is broken.
Call Stack (most recent call first):
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/3.10.1/CMakeSystem.cmake:6 (include)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)
CMake Deprecation Warning at /usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeForceCompiler.cmake:69 (message):
The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set
CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
/Users/zhouhuacong/CaffeProject/caffe2/third_party/android-cmake/android.toolchain.cmake:1139 (CMAKE_FORCE_C_COMPILER)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/3.10.1/CMakeSystem.cmake:6 (include)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)
CMake Deprecation Warning at /usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CMakeForceCompiler.cmake:83 (message):
The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set
CMAKE_CXX_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
/Users/zhouhuacong/CaffeProject/caffe2/third_party/android-cmake/android.toolchain.cmake:1151 (CMAKE_FORCE_CXX_COMPILER)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/3.10.1/CMakeSystem.cmake:6 (include)
/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)
CMake Error at /usr/local/Cellar/cmake/3.10.1/share/cmake/Modules/CheckCXXSourceCompiles.cmake:97 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
cmake/MiscCheck.cmake:34 (CHECK_CXX_SOURCE_COMPILES)
CMakeLists.txt:61 (include)
-- Configuring incomplete, errors occurred!
See also "/Users/zhouhuacong/CaffeProject/caffe2/build_android/CMakeFiles/CMakeOutput.log".
```
我发现第一个错误file STRINGS file
"/Users/zhouhuacong/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/usr/include/android/api-level.h"
cannot be read.
但我在我的mac中找不到include
文件夹。只有/Users/zhouhuacong/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/usr/lib
个文件夹。
这是我的NDK环境问题吗?我使用Android Studio 3.0
,然后下载NDK 16
。
我哪里错了?