When I've installed all the prerequisites listed in the install page of caffe2, I type the command make && cd build && sudo make install the compile caffe2, then I got the following error, the 1st part is log file using Cmake.
cama@cama:/home/chaoyang/caffe2-master/build$ cmake ..
-- The CXX compiler identification is GNU 4.9.3
-- The C compiler identification is GNU 4.9.3
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /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: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type not set - defaulting to Release
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so
-- The BLAS backend of choice:Eigen
-- Could NOT find NNPACK (missing: NNPACK_INCLUDE_DIR NNPACK_LIBRARY)
-- Will try to build NNPACK from source. If anything fails, follow the NNPACK prerequisite installation steps.
CMake Warning at cmake/External/nnpack.cmake:157 (message):
NNPACK is chosen to be installed, but confu and ninja that are needed by it
are not installed. As a result we won't build with NNPACK.
Call Stack (most recent call first):
cmake/Dependencies.cmake:52 (include)
CMakeLists.txt:72 (include)
CMake Warning at cmake/Dependencies.cmake:57 (message): Not compiling with NNPACK. Suppress this warning with -DUSE_NNPACK=OFF Call Stack (most recent call first): CMakeLists.txt:72 (include)
-- Found GFlags: /usr/include
-- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found system gflags install.
-- Found Glog: /usr/include
-- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Found system glog install.
-- Found PythonInterp: /home/cama/anaconda3/bin/python (found version "3.6")
-- Could NOT find Benchmark (missing: Benchmark_INCLUDE_DIR Benchmark_LIBRARY)
-- Found Git: /usr/bin/git (found version "2.7.4")
-- git Version: v0.0.0
-- Version: 0.0.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WZERO_AS_NULL_POINTER_CONSTANT
-- Performing Test HAVE_CXX_FLAG_WZERO_AS_NULL_POINTER_CONSTANT - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test BENCHMARK_HAS_CXX03_FLAG
-- Performing Test BENCHMARK_HAS_CXX03_FLAG - Success
-- Found LMDB: /usr/include
-- Found lmdb (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/liblmdb.so)
-- Found LevelDB: /usr/include
-- Found LevelDB (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libleveldb.so)
-- Found Snappy: /usr/include
-- Found Snappy (include: /usr/include, library: /usr/lib/libsnappy.so)
-- Could NOT find RocksDB (missing: RocksDB_INCLUDE_DIR RocksDB_LIBRARIES)
CMake Warning at cmake/Dependencies.cmake:138 (message):
Not compiling with RocksDB. Suppress this warning with -DUSE_ROCKSDB=OFF
Call Stack (most recent call first):
CMakeLists.txt:72 (include)
CMake Warning at cmake/Dependencies.cmake:181 (message): Not compiling with OpenCV. Suppress this warning with -DUSE_OPENCV=OFF Call Stack (most recent call first): CMakeLists.txt:72 (include)
CMake Warning at cmake/Dependencies.cmake:201 (find_package): By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Eigen3", but CMake did not find one.
Could not find a package configuration file provided by "Eigen3" with any of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set "Eigen3_DIR" to a directory containing one of the above files. If "Eigen3" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:72 (include)
-- Found PythonInterp: /home/cama/anaconda3/bin/python (found suitable version "3.6", minimum required is "2.7") -- Found PythonLibs: /home/cama/anaconda3/lib/libpython3.6m.so (found suitable version "3.6.0", minimum required is "2.7") -- Found NumPy: /home/cama/anaconda3/lib/python3.6/site-packages/numpy/core/include (found version "1.11.3") -- NumPy ver. 1.11.3 found (include: /home/cama/anaconda3/lib/python3.6/site-packages/numpy/core/include) -- Could NOT find pybind11 (missing: pybind11_INCLUDE_DIR) -- Could NOT find MPI_C (missing: MPI_C_LIBRARIES MPI_C_INCLUDE_PATH) -- Could NOT find MPI_CXX (missing: MPI_CXX_LIBRARIES MPI_CXX_INCLUDE_PATH) CMake Warning at cmake/Dependencies.cmake:257 (message): Not compiling with MPI. Suppress this warning with -DUSE_MPI=OFF Call Stack (most recent call first): CMakeLists.txt:72 (include)
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- Adding -fopenmp
-- CUDA detected: 8.0
-- Added CUDA NVCC flags for: sm_61
-- Found libcuda: /usr/local/cuda-8.0/lib64/stubs/libcuda.so
-- Found libnvrtc: /usr/local/cuda-8.0/lib64/libnvrtc.so
-- Found CUDNN: /usr/local/cuda-8.0/include
-- Found cuDNN: v5.1.5 (include: /usr/local/cuda-8.0/include, library: /usr/local/cuda-8.0/lib64/libcudnn.so)
-- Could NOT find NCCL (missing: NCCL_INCLUDE_DIR NCCL_LIBRARY)
-- NCCL: /home/chaoyang/caffe2-master/third_party/nccl/build/lib/libnccl_static.a
-- Could NOT find CUB (missing: CUB_INCLUDE_DIR)
-- Could NOT find Gloo (missing: Gloo_INCLUDE_DIR Gloo_LIBRARY)
-- Found CUDA: /usr/local/cuda-8.0 (found suitable version "8.0", minimum required is "7.0")
-- CUDA detected: 8.0
-- Found libcuda: /usr/local/cuda-8.0/lib64/stubs/libcuda.so
-- Found libnvrtc: /usr/local/cuda-8.0/lib64/libnvrtc.so
-- Performing Test CAFFE2_LONG_IS_INT32_OR_64
-- Performing Test CAFFE2_LONG_IS_INT32_OR_64 - Success
-- Does not need to define long separately.
-- Performing Test HAS_BUILTIN_CPU_SUPPORTS
-- Performing Test HAS_BUILTIN_CPU_SUPPORTS - Success
-- This compiler has builtin_cpu_supports feature.
-- 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.
-- GCC 4.9.3: Adding gcc and gcc_s libs to link line
-- Include NCCL operators
-- Excluding image processing operators due to no opencv
-- 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.
-- ******** Summary ******** -- General: -- Git version : -- System : Linux -- C++ compiler : /usr/bin/c++ -- C++ compiler version : 4.9.3 -- Protobuf compiler : /usr/bin/protoc -- CXX flags : -fopenmp -Wno-deprecated -std=c++11 -fPIC -Wno-narrowing -- Build type : Release
-- Compile definitions : CAFFE2_USE_EIGEN_FOR_BLAS;CAFFE2_USE_GOOGLE_GLOG;CAFFE2_USE_GFLAGS;EIGEN_MPL2_ONLY
-- BUILD_SHARED_LIBS : ON -- BUILD_PYTHON : ON -- Python version : 3.6.0 -- Python library : /home/cama/anaconda3/lib/libpython3.6m.so -- USE_CUDA : ON -- CUDA version : 8.0 -- USE_CNMEM : OFF -- USE_NERVANA_GPU : OFF -- USE_GLOG : ON -- USE_GFLAGS : ON -- USE_LMDB : ON -- LMDB version : 0.9.10 -- USE_LEVELDB : ON -- LevelDB version : 1.15 -- Snappy version : 1.1.0 -- USE_OPENCV : OFF -- USE_FFMPEG : -- USE_ZMQ : OFF -- USE_ROCKSDB : OFF -- USE_MPI : OFF -- USE_NCCL : ON -- USE_NNPACK : OFF -- USE_OPENMP : ON -- USE_REDIS : OFF -- USE_GLOO : ON -- Configuring done -- Generating done -- Build files have been written to: /home/chaoyang/caffe2-master/build
The following is the normal output of make. Please focus on the last lines for the reason that these indicate the errors.
[ 77%] Building CXX object caffe2/CMakeFiles/conv_op_cache_cudnn_test.dir/operators/conv_op_cache_cudnn_test.cc.o
[ 77%] Linking CXX executable binaries/conv_op_cache_cudnn_test
libCaffe2_CPU.so: undefined reference to gflags::SetUsageMessage(std::string const&)'
libCaffe2_CPU.so: undefined reference togoogle::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)'
libCaffe2_CPU.so: undefined reference to google::protobuf::Message::GetTypeName() const'
libCaffe2_CPU.so: undefined reference togoogle::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
libCaffe2_GPU.so: undefined reference to google::protobuf::internal::kEmptyString'
libCaffe2_CPU.so: undefined reference togoogle::protobuf::MessageLite::SerializeToString(std::string*) const'
libCaffe2_CPU.so: undefined reference to google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))'
libCaffe2_GPU.so: undefined reference togoogle::protobuf::TextFormat::ParseFromString(std::string const&, google::protobuf::Message*)'
libCaffe2_GPU.so: undefined reference to google::base::CheckOpMessageBuilder::NewString()'
libCaffe2_CPU.so: undefined reference togoogle::protobuf::internal::WireFormatLite::WriteBytes(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
libCaffe2_GPU.so: undefined reference to google::protobuf::internal::StringTypeHandlerBase::New()'
libCaffe2_CPU.so: undefined reference togflags::ParseCommandLineFlags(int*, char***, bool)'
libCaffe2_GPU.so: undefined reference to google::protobuf::Message::ShortDebugString() const'
libCaffe2_GPU.so: undefined reference togoogle::protobuf::MessageLite::ParseFromString(std::string const&)'
libCaffe2_GPU.so: undefined reference to gflags::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
libCaffe2_CPU.so: undefined reference togoogle::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
libCaffe2_GPU.so: undefined reference to google::protobuf::internal::ParseNamedEnum(google::protobuf::EnumDescriptor const*, std::string const&, int*)'
libCaffe2_GPU.so: undefined reference togoogle::protobuf::MessageLite::SerializeAsString() const'
libCaffe2_CPU.so: undefined reference to google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
libCaffe2_CPU.so: undefined reference togflags::ProgramUsage()'
libCaffe2_CPU.so: undefined reference to google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)'
libCaffe2_CPU.so: undefined reference togoogle::protobuf::Message::InitializationErrorString() const'
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/conv_op_cache_cudnn_test.dir/build.make:130: recipe for target 'caffe2/binaries/conv_op_cache_cudnn_test' failed
make[3]: * [caffe2/binaries/conv_op_cache_cudnn_test] Error 1
make[3]: Leaving directory '/home/chaoyang/caffe2-master/build'
CMakeFiles/Makefile2:1429: recipe for target 'caffe2/CMakeFiles/conv_op_cache_cudnn_test.dir/all' failed
make[2]: [caffe2/CMakeFiles/conv_op_cache_cudnn_test.dir/all] Error 2
make[2]: Leaving directory '/home/chaoyang/caffe2-master/build'
Makefile:138: recipe for target 'all' failed
make[1]: [all] Error 2
make[1]: Leaving directory '/home/chaoyang/caffe2-master/build'
Makefile:4: recipe for target 'all' failed
make: * [all] Error 2
It seems that cudnn library caused this error, while I've successfully used cudnn-v5.1 and cuda-8.0 in ubuntu, specifically, in matconvnet, which requires cuda and cudnn for accelerating the computation speed. And it seems no one else has got this error before, so any advice will be appreciated!