facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

Building caffe2 android error #778

Open yxftju opened 7 years ago

yxftju commented 7 years ago

I try to build caffe2 for android by using make android on the root of caffe2 but I got an error .the CMakeError show like this:

/home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp/src.cxx: In function 'int main(int, char**)':
 11 /home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp/src.cxx:4:49: error: '__builtin_cpu_supports' was not declared in this scope
 12        std::cout << __builtin_cpu_supports("avx2") << std::endl;
 13                                                  ^
 14 CMakeFiles/cmTC_e49d0.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_e49d0.dir/src.cxx.o' failed
 15 make[2]: *** [CMakeFiles/cmTC_e49d0.dir/src.cxx.o] Error 1
 16 make[2]: Leaving directory '/home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp'
 17 Makefile:126: recipe for target 'cmTC_e49d0/fast' failed
 18 make[1]: *** [cmTC_e49d0/fast] Error 2
 19 make[1]: Leaving directory '/home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp'
 20 
 21 Source file was:
 22 #include <iostream>
 23 
 24     int main(int argc, char** argv) {
 25       std::cout << __builtin_cpu_supports("avx2") << std::endl;
 26       return 0;
 27     }

and another error

 34 make[2]: Entering directory '/home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp'
 35 Building CXX object CMakeFiles/cmTC_4d9f4.dir/src.cxx.o
 36 /home/br2/Android_tool_chain/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++   -DANDROI    D -isystem /home/br2/Android_tool_chain/android-ndk-r14b/platforms/android-21/arch-arm64/usr/include -isystem /home/br2/Android_tool_chain/androi    d-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/br2/Android_tool_chain/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/lib    s/arm64-v8a/include -isystem /home/br2/Android_tool_chain/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward  -fexceptions -frtt    i -Wno-psabi --sysroot=/home/br2/Android_tool_chain/android-ndk-r14b/platforms/android-21/arch-arm64 -funwind-tables -fsigned-char -no-canonical-    prefixes -fdata-sections -ffunction-sections -Wa,--noexecstack  -DCAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING -std=c++11 -fPIE   -o CMakeFiles/cm    TC_4d9f4.dir/src.cxx.o -c /home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp/src.cxx
 37 /home/br2/Projects/caffe2/caffe2/build_android/CMakeFiles/CMakeTmp/src.cxx:1:30: fatal error: glog/stl_logging.h: No such file or directory
 38  #include <glog/stl_logging.h>
 39                               ^
 40 compilation terminated.

Has anyone fix this error? It seems that something missing.

Seungsoo-Yang commented 7 years ago

2nd error is related to glog lib path. please check your path

yxftju commented 7 years ago

where can I setting the path?

moli232777144 commented 7 years ago

When I modify the API settings, I have the same problem. BLOG lib shows OFF, API21 can be compiled successfully, but less than 21, this problem will appear。

fanser commented 6 years ago

Did you fix it? I meet the same problem. Thx.