Unable to Build caffe with Makefile or CMake
Closed this issue · 3 comments
Issue summary:
Unable to Build caffe with Makefile or CMake
Steps to reproduce:
While follow the tutorial steps to install Caffe by Makefile or CMake, there will be the same error.
I use these commands
set CUSTOM_CXX := /opt/intel/system_studio_2019/bin/icpc
set CUSTOM_CC := /opt/intel/system_studio_2019/bin/icc
set BOOST_ROOT := /home/lsyang/Documents/caffe/boost_1_64_0
cmake .. -DCPU_ONLY=1 -DBOOST_ROOT=/home/lsyang/Documents/caffe/boost_1_64_0
CPATH="" make all -j$(nproc)
or
CC=icc CXX=icpc cmake .. -DCPU_ONLY=1 -DBLAS=mkl -DBOOST_ROOT=/home/lsyang/Documents/caffe/boost_1_64_0
CPATH="" make all -j$(nproc)
REF:
https://github.com/intel/caffe/wiki/Build-Caffe-with-Intel--Compiler
### Error Message
[ 77%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/tree.cpp.o
make[2]: *** No rule to make target '../external/mkldnn/install/lib64/libmkldnn.so', needed by 'lib/libcaffe.so.1.1.6'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 77%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o
CMakeFiles/Makefile2:372: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
### System configuration:
Operating system: Ubuntu 18.04.3
pls manully apply below patch to solve ubuntu build issue.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f1477c..df60102 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,9 +30,7 @@ add_definitions(-DCAFFE_VERSION=${CAFFE_TARGET_VERSION})
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
include(ExternalProject)
-if(MSVC)
include(GNUInstallDirs)
-endif()
include(cmake/Utils.cmake)
include(cmake/Targets.cmake)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 3e3eae4..76cdd02 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -276,11 +276,7 @@ else()
set(MKLDNN_LIBRARIES_NAME "libmkldnn.so")
endif()
-if(APPLE OR WIN32)
-set(LIBDIR lib)
-else()
-set(LIBDIR lib64)
-endif()
+set(LIBDIR ${CMAKE_INSTALL_LIBDIR})
if(DEFINED ENV{MKLDNNROOT})
Thanks for your response!
So there should be two modifications, right? One is /CMakeLists.txt, another is /cmake/Dependencies.cmake.
But I only find one line difference in Dependencies.cmake file.
After modify this line, the error phenomena is the same.
(1)
add_definitions(-DCAFFE_VERSION=${CAFFE_TARGET_VERSION})
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
include(ExternalProject)
if(MSVC)
include(GNUInstallDirs)
endif()
include(cmake/Utils.cmake)
include(cmake/Targets.cmake)
(2)
if(MSVC)
set(MKLDNN_LIBRARIES_NAME "mkldnn.lib")
else()
set(MKLDNN_LIBRARIES_NAME "libmkldnn.so")
endif()
if(APPLE OR WIN32)
set(LIBDIR lib)
else()
set(LIBDIR lib64)
endif()
set(LIBDIR ${CMAKE_INSTALL_LIBDIR}) ######## I only add this line
if(DEFINED ENV{MKLDNNROOT})
+include(GNUInstallDirs)
in CMakeLists.txt after include(ExternalProject)