Unable to compile due to OpenCV (4.0.1) related error (I think)
sudo apt-get install build-essential cmake unzip pkg-config libjpeg-dev libpng-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran
sudo -H pip3.6 install -U numpy
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.0.1.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.0.1.zip
unzip opencv.zip
unzip opencv_contrib.zip
mv opencv-4.0.1 opencv
mv opencv_contrib-4.0.1 opencv_contrib
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/temp/opencv/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=/usr/bin/python3.6 \
-D WITH_OPENCL=ON \
-D HAVE_OPENCL_STATIC=ON \
-D BUILD_EXAMPLES=ON ..
make -j16
sudo make install
sudo ldconfig
cd /usr/local/lib/python3.6/site-packages/cv2/python-3.6/
sudo mv cv2.cpython-36m-x86_64-linux-gnu.so cv2.so
git clone
cd caffe
mkdir build
cd build
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -D PYTHON_INCLUDE_DIR=/usr/include/python3.6 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6.so ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- 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
-- 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
-- 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
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found GFlags: /usr/include
-- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found Glog: /usr/include
-- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.0.0")
-- Found PROTOBUF Compiler: /usr/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.0.1") found components: HL
-- 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/x86_64-linux-gnu/libsnappy.so)
CMake Warning at cmake/Dependencies.cmake:90 (message):
-- CUDA is not detected by cmake. Building without it...
Call Stack (most recent call first):
CMakeLists.txt:49 (include)
-- OpenCV found (/usr/local/lib/cmake/opencv4)
-- Found Atlas: /usr/include/x86_64-linux-gnu
-- Found Atlas (include: /usr/include/x86_64-linux-gnu library: /usr/lib/x86_64-linux-gnu/libatlas.so lapack: /usr/lib/x86_64-linux-gnu/liblapack.so
-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.7", minimum required is "2.7")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6.so (found suitable version "3.6.7", minimum required is "2.7")
-- Found NumPy: /usr/local/lib/python3.6/dist-packages/numpy/core/include (found suitable version "1.13.3", minimum required is "1.7.1")
-- NumPy ver. 1.13.3 found (include: /usr/local/lib/python3.6/dist-packages/numpy/core/include)
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- python
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Found Git: /usr/bin/git (found version "2.17.1")
--
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0
-- Git : 1.0-132-g99bd9979
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Build type : Release
--
-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : OFF
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- USE_NCCL : OFF
-- ALLOW_LMDB_NOLOCK : OFF
-- USE_HDF5 : ON
--
-- Dependencies:
-- BLAS : Yes (Atlas)
-- Boost : Yes (ver. 1.65)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 3.0.0)
-- lmdb : Yes (ver. 0.9.21)
-- LevelDB : Yes (ver. 1.20)
-- Snappy : Yes (ver. ..)
-- OpenCV : Yes (ver. 4.0.1)
-- CUDA : No
--
-- Python:
-- Interpreter : /usr/bin/python3.6 (ver. 3.6.7)
-- Libraries : /usr/lib/x86_64-linux-gnu/libpython3.6.so (ver 3.6.7)
-- NumPy : /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.13.3)
--
-- Documentaion:
-- Doxygen : No
-- config_file :
--
-- Install:
-- Install path : /home/patrick/git/caffe/build/install
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/patrick/git/caffe/build
make all -j16
...
[ 76%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/im2col.cpp.o
/home/patrick/git/caffe/src/caffe/layers/window_data_layer.cpp: In member function âvirtual void caffe::WindowDataLayer<Dtype>::load_batch(caffe::Batch<Dtype>*)â:
/home/patrick/git/caffe/src/caffe/layers/window_data_layer.cpp:293:42: error: âCV_LOAD_IMAGE_COLORâ was not declared in this scope
cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
^~~~~~~~~~~~~~~~~~~
[ 76%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/insert_splits.cpp.o
/home/patrick/git/caffe/src/caffe/layers/window_data_layer.cpp:293:42: note: suggested alternative: âCV_IS_IMAGE_HDRâ
cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
^~~~~~~~~~~~~~~~~~~
CV_IS_IMAGE_HDR
[ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o
[ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/math_functions.cpp.o
[ 79%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/signal_handler.cpp.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libpython3.6.so', needed by 'lib/libcaffe.so.1.0.0'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 79%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o
src/caffe/CMakeFiles/caffe.dir/build.make:1958: recipe for target 'src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o' failed
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o] Error 1
/home/patrick/git/caffe/src/caffe/util/io.cpp: In function âcv::Mat caffe::ReadImageToCVMat(const string&, int, int, bool)â:
/home/patrick/git/caffe/src/caffe/util/io.cpp:76:34: error: âCV_LOAD_IMAGE_COLORâ was not declared in this scope
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
^~~~~~~~~~~~~~~~~~~
/home/patrick/git/caffe/src/caffe/util/io.cpp:76:34: note: suggested alternative: âCV_IS_IMAGE_HDRâ
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
^~~~~~~~~~~~~~~~~~~
CV_IS_IMAGE_HDR
/home/patrick/git/caffe/src/caffe/util/io.cpp:77:5: error: âCV_LOAD_IMAGE_GRAYSCALEâ was not declared in this scope
CV_LOAD_IMAGE_GRAYSCALE);
^~~~~~~~~~~~~~~~~~~~~~~
/home/patrick/git/caffe/src/caffe/util/io.cpp: In function âcv::Mat caffe::DecodeDatumToCVMat(const caffe::Datum&, bool)â:
/home/patrick/git/caffe/src/caffe/util/io.cpp:182:34: error: âCV_LOAD_IMAGE_COLORâ was not declared in this scope
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
^~~~~~~~~~~~~~~~~~~
/home/patrick/git/caffe/src/caffe/util/io.cpp:182:34: note: suggested alternative: âCV_IS_IMAGE_HDRâ
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
^~~~~~~~~~~~~~~~~~~
CV_IS_IMAGE_HDR
/home/patrick/git/caffe/src/caffe/util/io.cpp:183:5: error: âCV_LOAD_IMAGE_GRAYSCALEâ was not declared in this scope
CV_LOAD_IMAGE_GRAYSCALE);
^~~~~~~~~~~~~~~~~~~~~~~
src/caffe/CMakeFiles/caffe.dir/build.make:2438: recipe for target 'src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o' failed
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o] Error 1
CMakeFiles/Makefile2:267: 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
make clean
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -D PYTHON_INCLUDE_DIR=/usr/include/python3.6 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6.so -DUSE_OPENCV=off ..
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Found PROTOBUF Compiler: /usr/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found lmdb (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/liblmdb.so)
-- Found LevelDB (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libleveldb.so)
-- Found Snappy (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libsnappy.so)
CMake Warning at cmake/Dependencies.cmake:90 (message):
-- CUDA is not detected by cmake. Building without it...
Call Stack (most recent call first):
CMakeLists.txt:49 (include)
-- Found Atlas (include: /usr/include/x86_64-linux-gnu library: /usr/lib/x86_64-linux-gnu/libatlas.so lapack: /usr/lib/x86_64-linux-gnu/liblapack.so
-- NumPy ver. 1.13.3 found (include: /usr/local/lib/python3.6/dist-packages/numpy/core/include)
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- python
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
--
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0
-- Git : 1.0-132-g99bd9979
-- System : Linux
-- C++ compiler : /usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
-- Build type : Release
--
-- BUILD_SHARED_LIBS : ON
-- BUILD_python : ON
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : OFF
-- USE_OPENCV : off
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- USE_NCCL : OFF
-- ALLOW_LMDB_NOLOCK : OFF
-- USE_HDF5 : ON
--
-- Dependencies:
-- BLAS : Yes (Atlas)
-- Boost : Yes (ver. 1.65)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 3.0.0)
-- lmdb : Yes (ver. 0.9.21)
-- LevelDB : Yes (ver. 1.20)
-- Snappy : Yes (ver. ..)
-- CUDA : No
--
-- Python:
-- Interpreter : /usr/bin/python3.6 (ver. 3.6.7)
-- Libraries : /usr/lib/x86_64-linux-gnu/libpython3.6.so (ver 3.6.7)
-- NumPy : /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.13.3)
--
-- Documentaion:
-- Doxygen : No
-- config_file :
--
-- Install:
-- Install path : /home/patrick/git/caffe/build/install
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/patrick/git/caffe/build
make all -j16
...
[ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/math_functions.cpp.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libpython3.6.so', needed by 'lib/libcaffe.so.1.0.0'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o
[ 79%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/signal_handler.cpp.o
CMakeFiles/Makefile2:267: 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
Since I have an Intel Movidius (2)
@xerus
Thank you. This commit provides a good idea of replacing old marcos with new marcos.
10 months no update?
Issue summary
Unable to compile due to OpenCV (4.0.1) related error (I think)
Steps to reproduce
OpenCV 4.0.1
sudo apt-get install build-essential cmake unzip pkg-config libjpeg-dev libpng-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran sudo -H pip3.6 install -U numpy wget -O opencv.zip https://github.com/opencv/opencv/archive/4.0.1.zip wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.0.1.zip unzip opencv.zip unzip opencv_contrib.zip mv opencv-4.0.1 opencv mv opencv_contrib-4.0.1 opencv_contrib cd opencv mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D INSTALL_C_EXAMPLES=OFF \ -D OPENCV_ENABLE_NONFREE=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/temp/opencv/opencv_contrib/modules \ -D PYTHON_EXECUTABLE=/usr/bin/python3.6 \ -D WITH_OPENCL=ON \ -D HAVE_OPENCL_STATIC=ON \ -D BUILD_EXAMPLES=ON .. make -j16 sudo make install sudo ldconfig cd /usr/local/lib/python3.6/site-packages/cv2/python-3.6/ sudo mv cv2.cpython-36m-x86_64-linux-gnu.so cv2.sogit clone cd caffe mkdir build cd build cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -D PYTHON_INCLUDE_DIR=/usr/include/python3.6 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6.so .. -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- 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 -- 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 -- 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 -- Boost version: 1.65.1 -- Found the following Boost libraries: -- system -- thread -- filesystem -- chrono -- date_time -- atomic -- Found GFlags: /usr/include -- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so) -- Found Glog: /usr/include -- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so) -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.0.0") -- Found PROTOBUF Compiler: /usr/bin/protoc -- HDF5: Using hdf5 compiler wrapper to determine C configuration -- HDF5: Using hdf5 compiler wrapper to determine CXX configuration -- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.0.1") found components: HL -- 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/x86_64-linux-gnu/libsnappy.so) CMake Warning at cmake/Dependencies.cmake:90 (message): -- CUDA is not detected by cmake. Building without it... Call Stack (most recent call first): CMakeLists.txt:49 (include) -- OpenCV found (/usr/local/lib/cmake/opencv4) -- Found Atlas: /usr/include/x86_64-linux-gnu -- Found Atlas (include: /usr/include/x86_64-linux-gnu library: /usr/lib/x86_64-linux-gnu/libatlas.so lapack: /usr/lib/x86_64-linux-gnu/liblapack.so -- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.7", minimum required is "2.7") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6.so (found suitable version "3.6.7", minimum required is "2.7") -- Found NumPy: /usr/local/lib/python3.6/dist-packages/numpy/core/include (found suitable version "1.13.3", minimum required is "1.7.1") -- NumPy ver. 1.13.3 found (include: /usr/local/lib/python3.6/dist-packages/numpy/core/include) -- Boost version: 1.65.1 -- Found the following Boost libraries: -- python -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Found Git: /usr/bin/git (found version "2.17.1") -- -- ******************* Caffe Configuration Summary ******************* -- General: -- Version : 1.0.0 -- Git : 1.0-132-g99bd9979 -- System : Linux -- C++ compiler : /usr/bin/c++ -- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized -- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized -- Build type : Release -- -- BUILD_SHARED_LIBS : ON -- BUILD_python : ON -- BUILD_matlab : OFF -- BUILD_docs : ON -- CPU_ONLY : OFF -- USE_OPENCV : ON -- USE_LEVELDB : ON -- USE_LMDB : ON -- USE_NCCL : OFF -- ALLOW_LMDB_NOLOCK : OFF -- USE_HDF5 : ON -- -- Dependencies: -- BLAS : Yes (Atlas) -- Boost : Yes (ver. 1.65) -- glog : Yes -- gflags : Yes -- protobuf : Yes (ver. 3.0.0) -- lmdb : Yes (ver. 0.9.21) -- LevelDB : Yes (ver. 1.20) -- Snappy : Yes (ver. ..) -- OpenCV : Yes (ver. 4.0.1) -- CUDA : No -- -- Python: -- Interpreter : /usr/bin/python3.6 (ver. 3.6.7) -- Libraries : /usr/lib/x86_64-linux-gnu/libpython3.6.so (ver 3.6.7) -- NumPy : /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.13.3) -- -- Documentaion: -- Doxygen : No -- config_file : -- -- Install: -- Install path : /home/patrick/git/caffe/build/install -- -- Configuring done -- Generating done -- Build files have been written to: /home/patrick/git/caffe/build make all -j16 ... [ 76%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/im2col.cpp.o /home/patrick/git/caffe/src/caffe/layers/window_data_layer.cpp: In member function âvirtual void caffe::WindowDataLayer<Dtype>::load_batch(caffe::Batch<Dtype>*)â: /home/patrick/git/caffe/src/caffe/layers/window_data_layer.cpp:293:42: error: âCV_LOAD_IMAGE_COLORâ was not declared in this scope cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR); ^~~~~~~~~~~~~~~~~~~ [ 76%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/insert_splits.cpp.o /home/patrick/git/caffe/src/caffe/layers/window_data_layer.cpp:293:42: note: suggested alternative: âCV_IS_IMAGE_HDRâ cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR); ^~~~~~~~~~~~~~~~~~~ CV_IS_IMAGE_HDR [ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o [ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/math_functions.cpp.o [ 79%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/signal_handler.cpp.o make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libpython3.6.so', needed by 'lib/libcaffe.so.1.0.0'. Stop. make[2]: *** Waiting for unfinished jobs.... [ 79%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o src/caffe/CMakeFiles/caffe.dir/build.make:1958: recipe for target 'src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o' failed make[2]: *** [src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o] Error 1 /home/patrick/git/caffe/src/caffe/util/io.cpp: In function âcv::Mat caffe::ReadImageToCVMat(const string&, int, int, bool)â: /home/patrick/git/caffe/src/caffe/util/io.cpp:76:34: error: âCV_LOAD_IMAGE_COLORâ was not declared in this scope int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : ^~~~~~~~~~~~~~~~~~~ /home/patrick/git/caffe/src/caffe/util/io.cpp:76:34: note: suggested alternative: âCV_IS_IMAGE_HDRâ int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : ^~~~~~~~~~~~~~~~~~~ CV_IS_IMAGE_HDR /home/patrick/git/caffe/src/caffe/util/io.cpp:77:5: error: âCV_LOAD_IMAGE_GRAYSCALEâ was not declared in this scope CV_LOAD_IMAGE_GRAYSCALE); ^~~~~~~~~~~~~~~~~~~~~~~ /home/patrick/git/caffe/src/caffe/util/io.cpp: In function âcv::Mat caffe::DecodeDatumToCVMat(const caffe::Datum&, bool)â: /home/patrick/git/caffe/src/caffe/util/io.cpp:182:34: error: âCV_LOAD_IMAGE_COLORâ was not declared in this scope int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : ^~~~~~~~~~~~~~~~~~~ /home/patrick/git/caffe/src/caffe/util/io.cpp:182:34: note: suggested alternative: âCV_IS_IMAGE_HDRâ int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : ^~~~~~~~~~~~~~~~~~~ CV_IS_IMAGE_HDR /home/patrick/git/caffe/src/caffe/util/io.cpp:183:5: error: âCV_LOAD_IMAGE_GRAYSCALEâ was not declared in this scope CV_LOAD_IMAGE_GRAYSCALE); ^~~~~~~~~~~~~~~~~~~~~~~ src/caffe/CMakeFiles/caffe.dir/build.make:2438: recipe for target 'src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o' failed make[2]: *** [src/caffe/CMakeFiles/caffe.dir/util/io.cpp.o] Error 1 CMakeFiles/Makefile2:267: 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 2Tried solutions
Omit OpenCV
make clean cmake -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -D PYTHON_INCLUDE_DIR=/usr/include/python3.6 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6.so -DUSE_OPENCV=off .. -- Boost version: 1.65.1 -- Found the following Boost libraries: -- system -- thread -- filesystem -- chrono -- date_time -- atomic -- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so) -- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so) -- Found PROTOBUF Compiler: /usr/bin/protoc -- HDF5: Using hdf5 compiler wrapper to determine C configuration -- HDF5: Using hdf5 compiler wrapper to determine CXX configuration -- Found lmdb (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/liblmdb.so) -- Found LevelDB (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libleveldb.so) -- Found Snappy (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libsnappy.so) CMake Warning at cmake/Dependencies.cmake:90 (message): -- CUDA is not detected by cmake. Building without it... Call Stack (most recent call first): CMakeLists.txt:49 (include) -- Found Atlas (include: /usr/include/x86_64-linux-gnu library: /usr/lib/x86_64-linux-gnu/libatlas.so lapack: /usr/lib/x86_64-linux-gnu/liblapack.so -- NumPy ver. 1.13.3 found (include: /usr/local/lib/python3.6/dist-packages/numpy/core/include) -- Boost version: 1.65.1 -- Found the following Boost libraries: -- python -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- -- ******************* Caffe Configuration Summary ******************* -- General: -- Version : 1.0.0 -- Git : 1.0-132-g99bd9979 -- System : Linux -- C++ compiler : /usr/bin/c++ -- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized -- Debug CXX flags : -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized -- Build type : Release -- -- BUILD_SHARED_LIBS : ON -- BUILD_python : ON -- BUILD_matlab : OFF -- BUILD_docs : ON -- CPU_ONLY : OFF -- USE_OPENCV : off -- USE_LEVELDB : ON -- USE_LMDB : ON -- USE_NCCL : OFF -- ALLOW_LMDB_NOLOCK : OFF -- USE_HDF5 : ON -- -- Dependencies: -- BLAS : Yes (Atlas) -- Boost : Yes (ver. 1.65) -- glog : Yes -- gflags : Yes -- protobuf : Yes (ver. 3.0.0) -- lmdb : Yes (ver. 0.9.21) -- LevelDB : Yes (ver. 1.20) -- Snappy : Yes (ver. ..) -- CUDA : No -- -- Python: -- Interpreter : /usr/bin/python3.6 (ver. 3.6.7) -- Libraries : /usr/lib/x86_64-linux-gnu/libpython3.6.so (ver 3.6.7) -- NumPy : /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.13.3) -- -- Documentaion: -- Doxygen : No -- config_file : -- -- Install: -- Install path : /home/patrick/git/caffe/build/install -- -- Configuring done -- Generating done -- Build files have been written to: /home/patrick/git/caffe/build make all -j16 ... [ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/math_functions.cpp.o make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libpython3.6.so', needed by 'lib/libcaffe.so.1.0.0'. Stop. make[2]: *** Waiting for unfinished jobs.... [ 78%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/upgrade_proto.cpp.o [ 79%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/signal_handler.cpp.o CMakeFiles/Makefile2:267: 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 2Other versions
Since I have an Intel Movidius (2)
* https://github.com/weiliu89/caffe/tree/ssd * [weiliu89#968](https://github.com/weiliu89/caffe/issues/968) for https://github.com/movidius/ncsdk * [weiliu89#969](https://github.com/weiliu89/caffe/issues/969) for https://github.com/movidius/ncsdk/tree/ncsdk2System configuration
* Operating system: Ubuntu 18.04.1Issue checklist
* [x] read the guidelines and removed the first paragraph * [x] written a short summary and detailed steps to reproduce * [x] explained how solutions to related problems failed (tick if found none) * [x] filled system configuration * [x] attached relevant logs/config files (tick if not applicable)
the error is not about how to compile, nothing happens if we change the Makefile or CMakeLists.txt. The error caused by the OpenCV module in version 3 and 4 has change.
to fix it, in every file that error to build:
in the section #ifdef USE_OPENCV, add:
#include "opencv2/imgcodecs/imgcodecs.hpp"
so it will looks like this:
#ifdef USE_OPENCV
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/imgproc.hpp>
#include "opencv2/imgcodecs/imgcodecs.hpp"
then, the file which has code:
cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
change to:
cv_img = cv::imread(image.first,cv::IMREAD_COLOR);
and the other files which has:
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
CV_LOAD_IMAGE_GRAYSCALE);
change to:
int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
cv::IMREAD_GRAYSCALE);
Cheers...
for anyone who encounter with the following error message
/usr/local/include/opencv4/opencv2/core/cvdef.h(781): error: expected a declaration
/usr/local/include/opencv4/opencv2/core/cvdef.h(870): warning: parsing restarts here after previous syntax error
according to tip that @wahyubram82 provide
#include "opencv2/imgcodecs/imgcodecs.hpp" this line on my machine will produce the above message
after removing #include "opencv2/imgcodecs/imgcodecs.hpp", it compiled successfully.
my system configuration is
ubuntu 20.04 LTS
opencv 4.5.0
python3.8
hope it helps!
Most helpful comment
the error is not about how to compile, nothing happens if we change the Makefile or CMakeLists.txt. The error caused by the OpenCV module in version 3 and 4 has change.
to fix it, in every file that error to build:
in the section
#ifdef USE_OPENCV, add:#include "opencv2/imgcodecs/imgcodecs.hpp"so it will looks like this:
then, the file which has code:
cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);change to:
cv_img = cv::imread(image.first,cv::IMREAD_COLOR);and the other files which has:
change to:
Cheers...