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

caffe2 cpu-only on Mac highserria Error #1296

Closed XerxesHMei closed 6 years ago

XerxesHMei commented 6 years ago

I just want to run the cpu-only version of caffe2 on my mac. But some errors just confused me.

Command: -> cmake -DUSE_CUDA=OFF -DUSE_NNPACK=OFF ..

-- The CXX compiler identification is AppleClang 9.0.0.9000037 -- The C compiler identification is AppleClang 9.0.0.9000037 -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Setting CMAKE_FIND_NO_INSTALL_PREFIX -- Build type not set - defaulting to Release -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Found Protobuf: /usr/local/lib/libprotobuf.dylib (found version "3.2.0") -- Found Git: /usr/local/bin/git (found version "2.13.0") -- The BLAS backend of choice:Eigen -- Found GFlags: /usr/local/include -- Found gflags (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib) -- Found system gflags install. -- Found Glog: /usr/local/include -- Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.dylib) -- Found system glog install. -- Found LMDB: /usr/local/include -- Found lmdb (include: /usr/local/include, library: /usr/local/lib/liblmdb.dylib) -- Found LevelDB: /usr/local/include -- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.dylib) -- Found Snappy: /usr/local/include -- Found Snappy (include: /usr/local/include, library: /usr/local/lib/libsnappy.dylib) -- Found RocksDB: /usr/local/include -- Found RocksDB (include: /usr/local/include, library: /usr/local/lib/librocksdb.dylib) -- OpenCV found (/usr/local/share/OpenCV) -- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.13", minimum required is "2.7") -- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.10", minimum required is "2.7") -- Found NumPy: /usr/local/lib/python2.7/site-packages/numpy/core/include (found version "1.13.1") -- NumPy ver. 1.13.1 found (include: /usr/local/lib/python2.7/site-packages/numpy/core/include) -- Found pybind11: /usr/local/include -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) (found version "1.0") -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) (found version "1.0") CMake Warning at cmake/Dependencies.cmake:292 (message): Not compiling with OpenMP. Suppress this warning with -DUSE_OPENMP=OFF Call Stack (most recent call first): CMakeLists.txt:73 (include)

CMake Warning at cmake/Dependencies.cmake:333 (message): If not using cuda, one should not use NCCL either. Call Stack (most recent call first): CMakeLists.txt:73 (include)

CMake Warning at cmake/Dependencies.cmake:358 (message): Gloo can only be used on Linux. Call Stack (most recent call first): CMakeLists.txt:73 (include)

CMake Warning at cmake/Dependencies.cmake:428 (message): Metal is only used in ios builds. Call Stack (most recent call first): CMakeLists.txt:73 (include)

-- Performing Test CAFFE2_LONG_IS_INT32_OR_64 -- Performing Test CAFFE2_LONG_IS_INT32_OR_64 - Failed -- Need to define long as a separate typeid. -- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING -- Performing Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING - Failed -- Turning off deprecation warning due to glog.** -- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS -- Performing Test CAFFE2_COMPILER_SUPPORTS_AVX2_EXTENSIONS - Success -- Current compiler supports avx2 extention. Will build perfkernels. -- NCCL operators skipped due to no CUDA support -- CUDA RTC operators skipped due to no CUDA support -- Including image processing operators -- Excluding video processing operators due to no opencv -- Excluding mkl operators as we are not using mkl -- MPI operators skipped due to no MPI support -- Automatically generating missing init.py files.

-- General:

-- Git version : v0.8.1-423-g36995d5e-dirty -- System : Darwin -- C++ compiler : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- C++ compiler version : 9.0.0.9000037 -- Protobuf compiler : /usr/local/bin/protoc -- CXX flags : -Wno-deprecated -std=c++11 -O2 -fPIC -Wno-narrowing -- Build type : Release -- Compile definitions :

-- BUILD_BINARY : ON -- BUILD_PYTHON : ON -- Python version : 2.7.10 -- Python library : /usr/lib/libpython2.7.dylib -- BUILD_SHARED_LIBS : ON -- BUILD_TEST : ON -- USE_ATEN : OFF -- USE_CUDA : OFF -- USE_FFMPEG : OFF -- USE_GFLAGS : ON -- USE_GLOG : ON -- USE_GLOO : OFF -- USE_LEVELDB : ON -- LevelDB version : 1.20 -- Snappy version : .. -- USE_LITE_PROTO : OFF -- USE_LMDB : ON -- LMDB version : 0.9.21 -- USE_METAL : OFF -- USE_MOBILE_OPENGL : OFF -- USE_MPI : OFF -- USE_NCCL : OFF -- USE_NERVANA_GPU : OFF -- USE_NNPACK : OFF -- USE_OBSERVERS : OFF -- USE_OPENCV : ON -- OpenCV version : 2.4.13 -- USE_OPENMP : OFF -- USE_REDIS : OFF -- USE_ROCKSDB : ON -- USE_THREADS : ON -- USE_ZMQ : OFF -- Configuring done -- Generating done -- Build files have been written to: /Users/meixinhu/Desktop/caffe2/build

It seems everything is ok. But I found the CMakeError.log

Performing C++ SOURCE FILE Test CAFFE2_LONG_IS_INT32_OR_64 failed with the following output: Change Dir: /Users/meixinhu/Desktop/caffe2/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_0579f/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_0579f.dir/build.make CMakeFiles/cmTC_0579f.dir/build Building CXX object CMakeFiles/cmTC_0579f.dir/src.cxx.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCAFFE2_LONG_IS_INT32_OR_64 -std=c++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -o CMakeFiles/cmTC_0579f.dir/src.cxx.o -c /Users/meixinhu/Desktop/caffe2/build/CMakeFiles/CMakeTmp/src.cxx Linking CXX executable cmTC_0579f /usr/local/Cellar/cmake/3.9.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0579f.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCAFFE2_LONG_IS_INT32_OR_64 -std=c++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_0579f.dir/src.cxx.o -o cmTC_0579f Undefined symbols for architecture x86_64: "void Foo()", referenced from: _main in src.cxx.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [cmTC_0579f] Error 1 make: [cmTC_0579f/fast] Error 2

Source file was:

include

template <typename T> void Foo();
template<> void Foo<int32_t>() {}
template<> void Foo<int64_t>() {}
int main(int argc, char** argv) {
  Foo<long>();
  return 0;
}

Performing C++ SOURCE FILE Test CAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING failed with the following output: Change Dir: /Users/meixinhu/Desktop/caffe2/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_69549/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_69549.dir/build.make CMakeFiles/cmTC_69549.dir/build Building CXX object CMakeFiles/cmTC_69549.dir/src.cxx.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCAFFE2_NEED_TO_TURN_OFF_DEPRECATION_WARNING -std=c++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -o CMakeFiles/cmTC_69549.dir/src.cxx.o -c /Users/meixinhu/Desktop/caffe2/build/CMakeFiles/CMakeTmp/src.cxx /Users/meixinhu/Desktop/caffe2/build/CMakeFiles/CMakeTmp/src.cxx:1:10: fatal error: 'glog/stl_logging.h' file not found

include <glog/stl_logging.h>

     ^~~~~~~~~~~~~~~~~~~~

1 error generated. make[1]: [CMakeFiles/cmTC_69549.dir/src.cxx.o] Error 1 make: [cmTC_69549/fast] Error 2

Source file was:

include <glog/stl_logging.h>

int main(int argc, char** argv) {
  return 0;
}

When I use command "make -j8" , I just see the errors that confused me.

[ 74%] Linking CXX executable binaries/fixed_divisor_test Undefined symbols for architecture x86_64: "testing::internal::MakeAndRegisterTestInfo(char const, char const, char const, char const, void const, void ()(), void ()(), testing::internal::TestFactoryBase)", referenced from: GLOBALsub_I_fixed_divisor_test.cc in fixed_divisor_test.cc.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [caffe2/binaries/fixed_divisor_test] Error 1 make[1]: [caffe2/CMakeFiles/fixed_divisor_test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

So Could anyone tell me the solutions of these errors, Thank you!!!!!!!

pietern commented 6 years ago

You're using a system installed glog (see output line Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)), but can't find the header. Perhaps your glog version is older than we need, or the headers just aren't there?

rogerlzp commented 6 years ago

there are too much error during compilation, complaining about "ld: symbol(s) not found for architecture x86_64" If you need the exact glog version during each version, check it if before compile is more clear to us.

pietern commented 6 years ago

No activity on this issue, closing.

@rogerlzp If you have a similar issue, please create a new issue with CMake summary and logs.