cedricve / raspicam

AVA RaspiCam: C++ API for using Raspberry camera with/without OpenCv
322 stars 138 forks source link

Unable to build with open cv installed #52

Open FlYnN91 opened 5 years ago

FlYnN91 commented 5 years ago
dainius@dainius-VirtualBox:/ProjectFiles/Utilities/raspicam/build$ cmake .. && make
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.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
-- -------------------------------------------------------------------------------
-- GNU COMPILER
-- -------------------------------------------------------------------------------
-- Adding cv library
-- 
-- -------------------------------------------------------------------------------
-- General configuration for raspicam 0.1.2
-- -------------------------------------------------------------------------------
-- 
    Built as dynamic libs?:ON
    Compiler:/usr/bin/c++
-- C++ flags (Release):        -Wno-pedantic -Wall -Wno-variadic-macros -std=c++0x -Wl,--no-as-needed  -Wall -Wno-long-long -ffunction-sections   -fomit-frame-pointer -O3 -ffast-math -mmmx -msse -msse2 -msse3 -DNDEBUG  -lpthread
-- C++ flags (Debug):          -Wno-pedantic -Wall -Wno-variadic-macros -std=c++0x -Wl,--no-as-needed  -Wall -Wno-long-long -ffunction-sections  -g3 -O0 -DDEBUG -D_DEBUG -W -Wextra -Wno-return-type  -lpthread
-- CMAKE_CXX_FLAGS:          -Wno-pedantic -Wall -Wno-variadic-macros -std=c++0x -Wl,--no-as-needed  -Wall -Wno-long-long -ffunction-sections 
-- CMAKE_BINARY_DIR:         /ProjectFiles/Utilities/raspicam/build
-- 
-- CMAKE_SYSTEM_PROCESSOR = x86_64
-- BUILD_SHARED_LIBS = ON
-- BUILD_UTILS = ON
-- CMAKE_INSTALL_PREFIX = /usr/local
-- CMAKE_BUILD_TYPE = Release
-- CMAKE_MODULE_PATH = /usr/local/lib/cmake/;/usr/lib/cmake
-- 
-- CREATE OPENCV MODULE=1
-- CMAKE_INSTALL_PREFIX=/usr/local
-- REQUIRED_LIBRARIES=
-- 
-- 
-- Change a value with: cmake -D<Variable>=<Value>
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /ProjectFiles/Utilities/raspicam/build
Scanning dependencies of target raspicam
[  4%] Building CXX object src/CMakeFiles/raspicam.dir/raspicam.cpp.o
[  8%] Building CXX object src/CMakeFiles/raspicam.dir/raspicam_still.cpp.o
[ 12%] Building CXX object src/CMakeFiles/raspicam.dir/private/private_impl.cpp.o
[ 16%] Building CXX object src/CMakeFiles/raspicam.dir/private/threadcondition.cpp.o
[ 20%] Building CXX object src/CMakeFiles/raspicam.dir/private_still/private_still_impl.cpp.o
[ 25%] Building CXX object src/CMakeFiles/raspicam.dir/private/fake_mmal_dependencies.cpp.o
[ 29%] Linking CXX shared library libraspicam.so
[ 29%] Built target raspicam
Scanning dependencies of target raspicam_cv
[ 33%] Building CXX object src/CMakeFiles/raspicam_cv.dir/raspicam_cv.cpp.o
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp: In constructor ‘raspicam::RaspiCam_Cv::RaspiCam_Cv()’:
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:46:6: error: ‘CAP_PROP_FORMAT’ is not a member of ‘cv’
  set(cv::CAP_PROP_FORMAT,CV_8UC3);
      ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp: In member function ‘double raspicam::RaspiCam_Cv::get(int)’:
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:95:14: error: ‘CAP_PROP_MODE’ is not a member of ‘cv’
         case cv::CAP_PROP_MODE:
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:97:14: error: ‘CAP_PROP_FRAME_WIDTH’ is not a member of ‘cv’
         case cv::CAP_PROP_FRAME_WIDTH :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:99:14: error: ‘CAP_PROP_FRAME_HEIGHT’ is not a member of ‘cv’
         case cv::CAP_PROP_FRAME_HEIGHT :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:101:14: error: ‘CAP_PROP_FPS’ is not a member of ‘cv’
         case cv::CAP_PROP_FPS:
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:103:14: error: ‘CAP_PROP_FORMAT’ is not a member of ‘cv’
         case cv::CAP_PROP_FORMAT :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:105:14: error: ‘CAP_PROP_BRIGHTNESS’ is not a member of ‘cv’
         case cv::CAP_PROP_BRIGHTNESS :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:107:14: error: ‘CAP_PROP_CONTRAST’ is not a member of ‘cv’
         case cv::CAP_PROP_CONTRAST :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:109:14: error: ‘CAP_PROP_SATURATION’ is not a member of ‘cv’
         case cv::CAP_PROP_SATURATION :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:112:14: error: ‘CAP_PROP_GAIN’ is not a member of ‘cv’
         case cv::CAP_PROP_GAIN :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:114:14: error: ‘CAP_PROP_EXPOSURE’ is not a member of ‘cv’
         case cv::CAP_PROP_EXPOSURE :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp: In member function ‘bool raspicam::RaspiCam_Cv::set(int, double)’:
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:130:14: error: ‘CAP_PROP_MODE’ is not a member of ‘cv’
         case cv::CAP_PROP_MODE:
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:134:14: error: ‘CAP_PROP_FRAME_WIDTH’ is not a member of ‘cv’
         case cv::CAP_PROP_FRAME_WIDTH :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:137:14: error: ‘CAP_PROP_FRAME_HEIGHT’ is not a member of ‘cv’
         case cv::CAP_PROP_FRAME_HEIGHT :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:140:14: error: ‘CAP_PROP_FORMAT’ is not a member of ‘cv’
         case cv::CAP_PROP_FORMAT :{
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:153:14: error: ‘CAP_PROP_BRIGHTNESS’ is not a member of ‘cv’
         case cv::CAP_PROP_BRIGHTNESS :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:156:14: error: ‘CAP_PROP_CONTRAST’ is not a member of ‘cv’
         case cv::CAP_PROP_CONTRAST : 
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:159:14: error: ‘CAP_PROP_SATURATION’ is not a member of ‘cv’
         case cv::CAP_PROP_SATURATION :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:163:14: error: ‘CAP_PROP_GAIN’ is not a member of ‘cv’
         case cv::CAP_PROP_GAIN :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:166:14: error: ‘CAP_PROP_EXPOSURE’ is not a member of ‘cv’
         case cv::CAP_PROP_EXPOSURE :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:174:14: error: ‘CAP_PROP_CONVERT_RGB’ is not a member of ‘cv’
         case cv::CAP_PROP_CONVERT_RGB :
              ^
/ProjectFiles/Utilities/raspicam/src/raspicam_cv.cpp:177:14: error: ‘CAP_PROP_FPS’ is not a member of ‘cv’
         case cv::CAP_PROP_FPS:
              ^
src/CMakeFiles/raspicam_cv.dir/build.make:62: recipe for target 'src/CMakeFiles/raspicam_cv.dir/raspicam_cv.cpp.o' failed
make[2]: *** [src/CMakeFiles/raspicam_cv.dir/raspicam_cv.cpp.o] Error 1
CMakeFiles/Makefile2:156: recipe for target 'src/CMakeFiles/raspicam_cv.dir/all' failed
make[1]: *** [src/CMakeFiles/raspicam_cv.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Satansseed6 commented 5 years ago

👍

andreh7 commented 5 years ago

I suspect that raspicam is meant to built against OpenCV 3 while e.g. on my Raspberry Pi (Raspbian 9) I only have OpenCV 2.4 .

Sedwin97 commented 5 years ago

So @andreh7 is the only option to build opencv3 from source to build raspicam?

philliihd commented 5 years ago

The easiest solution is to build an earlier commit of raspicam. If you revert to the commit on Jan 27, 2018 then raspicam will build with OpenCV 2.4: https://github.com/cedricve/raspicam/commit/59d92e6907859e59bd40645af6038e2122cd45ef

OpenCV 2.4 works prior to a recent pull request (https://github.com/cedricve/raspicam/pull/43) and commit (https://github.com/cedricve/raspicam/commit/35ace996cbcb7d2951db0fe50f3f97c3e1758a4c) that switched to using OpenCV 3 or higher with no backwards comparability.