opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.42k stars 5.76k forks source link

sfm dependencies are not found: Glog/Gflags #500

Closed ttsesm closed 8 years ago

ttsesm commented 8 years ago

I am trying to build the sfm module but without success. I have followed the instructions at the README file but no matter what I am doing I am getting the following message all the time (check also below in CMake file):

Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags .... .... Unavailable: sfm

System: Archlinux 64bit Packages Installed:

# pacman -Qs ceres-solver
local/ceres-solver 1.11.0-1 [installed]
    Solver for nonlinear least squares problems
 # pacman -Qs gflags
local/gflags 2.1.2-2 [installed]
    C++ Library for commandline flag processing
local/python2-gflags 2.0-2 [installed]
    Commandline flags module for Python
 # pacman -Qs google-glog
local/google-glog 0.3.4-2 [installed]
    Logging library for C++

CMake file:

$ makepkg -sc
==> Making package: opencv-git 3.1.0.r20.g8d79285-1 (Sat Jan  2 01:40:27 CET 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating opencv git repo...
Fetching origin
  -> Updating opencv_contrib git repo...
Fetching origin
  -> Found fsh.patch
==> Validating source files with md5sums...
    opencv ... Skipped
    opencv_contrib ... Skipped
    fsh.patch ... Passed
==> Extracting sources...
  -> Creating working copy of opencv git repo...
Reset branch 'makepkg'
  -> Creating working copy of opencv_contrib git repo...
Reset branch 'makepkg'
==> Starting pkgver()...
==> Starting prepare()...
patching file CMakeLists.txt
Hunk #1 succeeded at 311 (offset 11 lines).
Hunk #2 succeeded at 353 (offset 11 lines).
Hunk #3 succeeded at 382 (offset 11 lines).
Hunk #4 succeeded at 393 (offset 11 lines).
patching file cmake/templates/opencv_run_all_tests_unix.sh.in
Hunk #1 succeeded at 53 with fuzz 2.
==> Removing existing $pkgdir/ directory...
==> Starting build()...
-- Detected version of GNU GCC: 53 (503)
-- Found ZLIB: /lib64/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Found ZLIB: /lib64/libz.so (found version "1.2.8") 
-- Found OpenEXR: /lib64/libIlmImf.so
-- Checking for module 'libunicap'
--   Package 'libunicap' not found
-- Checking for module 'libucil'
--   Package 'libucil' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
WARNING, OpenNI library directory (set by OPENNI_LIB_DIR variable) is not found or does not have OpenNI libraries.
WARNING, OpenNI include directory (set by OPENNI_INCLUDE_DIR variable) is not found or does not have OpenNI include files.
WARNING, PrimeSensor Module binaries directory (set by OPENNI_PRIME_SENSOR_MODULE_BIN_DIR variable) is not found or does not have PrimeSensor Module binaries.
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'tbb'
--   Package 'tbb' not found
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/theodore/package_builds/opencv-git/src/opencv/3rdparty/ippicv/unpack/ippicv_lnx
-- CUDA detected: 7.5
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.11", minimum required is "2.7") 
-- Found PythonLibs: /lib64/libpython2.7.so (found suitable exact version "2.7.11") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.1", minimum required is "3.4") 
-- Found PythonLibs: /lib64/libpython3.5m.so (found suitable exact version "3.5.1") 
-- Found apache ant 1.9.6: /bin/ant
-- Found VTK ver. 6.3.0 (usefile: /usr/lib/cmake/vtk-6.3/UseVTK.cmake)
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   YES
-- HDF5:   YES
-- Found required Ceres dependency: Eigen version 3.2.7 in /usr/include/eigen3
-- Found required Ceres dependency: Glog in /usr/include
-- Ceres version 1.11.0 detected here: /usr was built with C++11. Ceres target will add C++11 flags to compile options for targets using it.
-- Found Ceres version: 1.11.0 installed in: /usr
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
-- Tesseract:   YES
-- HDF5:   YES
-- The protocol buffer compiler and libprotobuf were found
-- Tesseract:   YES
-- 
-- General configuration for OpenCV 3.1.0-dev =====================================
--   Version control:               3.1.0-20-g8d79285-dirty
-- 
--   Platform:
--     Host:                        Linux 4.3.3-2-ARCH x86_64
--     CMake:                       3.4.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               Release
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 5.3.0)
--     C++ flags (Release):         -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,-O1,--sort-common,--as-needed,-z,relro
--     Linker flags (Debug):        -Wl,-O1,--sort-common,--as-needed,-z,relro
--     Precompiled headers:         YES
--     Extra dependencies:          Qt5::Test Qt5::Concurrent Qt5::OpenGL /lib64/libwebp.so /lib64/libpng.so /lib64/libtiff.so /lib64/libjasper.so /lib64/libjpeg.so /lib64/libImath.so /lib64/libIlmImf.so /lib64/libIex.so /lib64/libHalf.so /lib64/libIlmThread.so gstvideo-1.0 gstapp-1.0 gstbase-1.0 gstriff-1.0 gstpbutils-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 dc1394 xine avcodec avformat avutil swscale avresample gphoto2 gphoto2_port exif /lib64/libbz2.so Qt5::Core Qt5::Gui Qt5::Widgets /lib64/libhdf5_hl.so /lib64/libhdf5.so /lib64/libpthread.so /lib64/libz.so /lib64/libdl.so /lib64/libm.so vtkRenderingOpenGL vtkImagingHybrid vtkIOImage vtkCommonDataModel vtkCommonMath vtkCommonCore vtksys vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkDICOMParser vtkIOCore /usr/lib64/libz.so vtkmetaio /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libtiff.so vtkImagingCore vtkRenderingCore vtkCommonColor vtkFiltersExtraction vtkFiltersCore vtkFiltersGeneral vtkCommonComputationalGeometry vtkFiltersStatistics vtkImagingFourier vtkalglib vtkFiltersGeometry vtkFiltersSources vtkInteractionStyle vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOGeometry vtkFiltersTexture vtkRenderingFreeType /usr/lib64/libfreetype.so vtkftgl vtkIOExport vtkRenderingAnnotation vtkImagingColor vtkRenderingContext2D vtkRenderingGL2PS vtkRenderingContextOpenGL /usr/lib64/libgl2ps.so vtkRenderingLabel /lib64/libtesseract.so /lib64/liblept.so dl m pthread rt /lib64/libGLU.so /lib64/libGL.so tbb cudart nppc nppi npps cufft -L/opt/cuda/lib64
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 cudev core cudaarithm flann hdf imgproc ml reg surface_matching video viz cudabgsegm cudafilters cudaimgproc cudawarping dnn fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo cvv datasets java rgbd stereo structured_light superres tracking videostab xfeatures2d ximgproc aruco optflow stitching matlab python2 python3
--     Disabled:                    world contrib_world
--     Disabled by dependency:      -
--     Unavailable:                 sfm
-- 
--   GUI: 
--     QT 5.x:                      YES (ver 5.5.1)
--     QT OpenGL support:           YES (Qt5::OpenGL 5.5.1)
--     OpenGL support:              YES (/lib64/libGLU.so /lib64/libGL.so)
--     VTK support:                 YES (ver 6.3.0)
-- 
--   Media I/O: 
--     ZLib:                        /lib64/libz.so (ver 1.2.8)
--     JPEG:                        /lib64/libjpeg.so (ver )
--     WEBP:                        /lib64/libwebp.so (ver encoder: 0x0209)
--     PNG:                         /lib64/libpng.so (ver 1.6.20)
--     TIFF:                        /lib64/libtiff.so (ver 42 - 4.0.6)
--     JPEG 2000:                   /lib64/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /lib64/libImath.so /lib64/libIlmImf.so /lib64/libIex.so /lib64/libHalf.so /lib64/libIlmThread.so (ver 2.2.0)
--     GDAL:                        NO
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.3)
--     FFMPEG:                      YES
--       codec:                     YES (ver 56.60.100)
--       format:                    YES (ver 56.40.101)
--       util:                      YES (ver 54.31.100)
--       swscale:                   YES (ver 3.1.101)
--       resample:                  YES (ver 2.1.0)
--       gentoo-style:              YES
--     GStreamer:                   
--       base:                      YES (ver 1.6.2)
--       video:                     YES (ver 1.6.2)
--       app:                       YES (ver 1.6.2)
--       riff:                      YES (ver 1.6.2)
--       pbutils:                   YES (ver 1.6.2)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    NO/YES
--     XIMEA:                       NO
--     Xine:                        YES (ver 1.2.6)
--     gPhoto2:                     YES
-- 
--   Parallel framework:            TBB (ver 4.4 interface 9002)
-- 
--   Other third-party libraries:
--     Use IPP:                     9.0.1 [9.0.1]
--          at:                     /home/theodore/package_builds/opencv-git/src/opencv/3rdparty/ippicv/unpack/ippicv_lnx
--     Use IPP Async:               NO
--     Use VA:                      NO
--     Use Intel VA-API/OpenCL:     NO
--     Use Eigen:                   YES (ver 3.2.7)
--     Use Cuda:                    YES (ver 7.5)
--     Use OpenCL:                  YES
--     Use custom HAL:              NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     USE NVCUVID:                 NO
--     NVIDIA GPU arch:             20 21 30 35
--     NVIDIA PTX archs:            30
--     Use fast math:               NO
--
--   OpenCL:
--     Version:                     dynamic
--     Include path:                /home/theodore/package_builds/opencv-git/src/opencv/3rdparty/include/opencl/1.2
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
--
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.11)
--     Libraries:                   /lib64/libpython2.7.so (ver 2.7.11)
--     numpy:                       /usr/lib/python2.7/site-packages/numpy/core/include (ver 1.10.2)
--     packages path:               lib/python2.7/site-packages
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.1)
--     Libraries:                   /lib64/libpython3.5m.so (ver 3.5.1)
--     numpy:                       /usr/lib/python3.5/site-packages/numpy/core/include (ver 1.10.2)
--     packages path:               lib/python3.5/site-packages
--
--   Python (for build):            /usr/bin/python2.7
--
--   Java:
--     ant:                         /bin/ant (ver 1.9.6)
--     JNI:                         /usr/lib/jvm/default/include /usr/lib/jvm/default/include/linux /usr/lib/jvm/default/include
--     Java wrappers:               YES
--     Java tests:                  YES
--
--   Matlab:
--     mex:                         /home/theodore/matlab/r2015b/bin/mex
--     Compiler/generator:          Working
--
--   Documentation:
--     Doxygen:                     /usr/bin/doxygen (ver 1.8.10)
--     PlantUML:                    NO
--
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              YES
--
--   Install path:                  /usr
--
--   cvconfig.h is in:              /home/theodore/package_builds/opencv-git/src/opencv
-- -----------------------------------------------------------------
--
CMake Warning at CMakeLists.txt:1250 (message):
  The source directory is the same as binary directory.  "make clean" may
  damage the source tree

-- Configuring done

I tried also to set manually the paths through CMake but still no success:

-D GFLAGS_INCLUDE_DIRS=/usr/include/gflags -D GFLAGS_LIBRARIES=/usr/lib/libgflags.so'

I was not sure if it is related with #485 so I opened a new issue.

alalek commented 8 years ago

0) There are some problems with the PKGBUILD script =( 1) Try to undef cmake -U SFM_DEPS_OK . parameter. 2) Try to force cmake -DSFM_DEPS_OK=ON . parameter to bypass this check.

ttsesm commented 8 years ago

using the above settings in cmake gives the following error:

[ 24%] Built target opencv_core
[ 24%] Building CXX object modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/homography.cc.o
In file included from /usr/include/ceres/types.h:42:0,
                 from /usr/include/ceres/internal/variadic_evaluate.h:38,
                 from /usr/include/ceres/internal/autodiff.h:148,
                 from /usr/include/ceres/autodiff_cost_function.h:132,
                 from /usr/include/ceres/ceres.h:37,
                 from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/fundamental.cc:24:
/usr/include/ceres/internal/port.h:50:12: error: ‘std::shared_ptr’ has not been declared
 using std::shared_ptr;
            ^
In file included from /usr/include/ceres/ceres.h:55:0,
                 from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/fundamental.cc:24:
/usr/include/ceres/solver.h:499:5: error: ‘shared_ptr’ does not name a type
     shared_ptr<ParameterBlockOrdering> linear_solver_ordering;
     ^
/usr/include/ceres/solver.h:630:5: error: ‘shared_ptr’ does not name a type
     shared_ptr<ParameterBlockOrdering> inner_iteration_ordering;
     ^
In file included from /usr/include/ceres/types.h:42:0,
                 from /usr/include/ceres/internal/variadic_evaluate.h:38,
                 from /usr/include/ceres/internal/autodiff.h:148,
                 from /usr/include/ceres/autodiff_cost_function.h:132,
                 from /usr/include/ceres/ceres.h:37,
                 from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/homography.cc:24:
/usr/include/ceres/internal/port.h:50:12: error: ‘std::shared_ptr’ has not been declared
 using std::shared_ptr;
            ^
In file included from /usr/include/ceres/ceres.h:55:0,
                 from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/homography.cc:24:
/usr/include/ceres/solver.h:499:5: error: ‘shared_ptr’ does not name a type
     shared_ptr<ParameterBlockOrdering> linear_solver_ordering;
     ^
/usr/include/ceres/solver.h:630:5: error: ‘shared_ptr’ does not name a type
     shared_ptr<ParameterBlockOrdering> inner_iteration_ordering;
     ^
modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/build.make:158: recipe for target 'modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/homography.cc.o' failed
make[2]: *** [modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/homography.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 24%] Linking CXX shared library ../../lib/libopencv_imgproc.so
[ 25%] Built target opencv_imgproc
[ 25%] Building NVCC (Device) object modules/cudaarithm/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_cmp_mat.cu.o
modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/build.make:110: recipe for target 'modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o' failed
make[2]: *** [modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o] Error 1
[ 25%] Building NVCC (Device) object modules/cudaarithm/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_minmax_mat.cu.o
CMakeFiles/Makefile2:26073: recipe for target 'modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/all' failed
make[1]: *** [modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/all] Error 2
alalek commented 8 years ago

1) Run make and wait for failure. 2) Run make VERBOSE=1 and add output here.

alalek commented 8 years ago

Google points to this discussion about invalid "config.h"

Try to check what config.h is used (for example, run GCC preprocessor via -E option). It is important, because compilation is broken in this code block in your case: https://github.com/ceres-solver/ceres-solver/blob/d80c112168acee98c3679918f3d84cfd4f31a947/include/ceres/internal/port.h#L35-L50

ttsesm commented 8 years ago
[ 84%] Built target opencv_test_optflow
make -f modules/sfm/src/libmv_light/libmv/numeric/CMakeFiles/numeric.dir/build.make modules/sfm/src/libmv_light/libmv/numeric/CMakeFiles/numeric.dir/depend
make[2]: Entering directory '/home/theodore/package_builds/opencv-git/src/opencv'
cd /home/theodore/package_builds/opencv-git/src/opencv && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/theodore/package_builds/opencv-git/src/opencv /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/numeric /home/theodore/package_builds/opencv-git/src/opencv /home/theodore/package_builds/opencv-git/src/opencv/modules/sfm/src/libmv_light/libmv/numeric /home/theodore/package_builds/opencv-git/src/opencv/modules/sfm/src/libmv_light/libmv/numeric/CMakeFiles/numeric.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/theodore/package_builds/opencv-git/src/opencv'
make -f modules/sfm/src/libmv_light/libmv/numeric/CMakeFiles/numeric.dir/build.make modules/sfm/src/libmv_light/libmv/numeric/CMakeFiles/numeric.dir/build
make[2]: Entering directory '/home/theodore/package_builds/opencv-git/src/opencv'
make[2]: Nothing to be done for 'modules/sfm/src/libmv_light/libmv/numeric/CMakeFiles/numeric.dir/build'.
make[2]: Leaving directory '/home/theodore/package_builds/opencv-git/src/opencv'
[ 84%] Built target numeric
make -f modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/build.make modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/depend
make[2]: Entering directory '/home/theodore/package_builds/opencv-git/src/opencv'
cd /home/theodore/package_builds/opencv-git/src/opencv && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/theodore/package_builds/opencv-git/src/opencv /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview /home/theodore/package_builds/opencv-git/src/opencv /home/theodore/package_builds/opencv-git/src/opencv/modules/sfm/src/libmv_light/libmv/multiview /home/theodore/package_builds/opencv-git/src/opencv/modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/theodore/package_builds/opencv-git/src/opencv'
make -f modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/build.make modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/build
make[2]: Entering directory '/home/theodore/package_builds/opencv-git/src/opencv'
[ 84%] Building CXX object modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o
cd /home/theodore/package_builds/opencv-git/src/opencv/modules/sfm/src/libmv_light/libmv/multiview && /usr/bin/c++   -DCERES_FOUND=1 -D__OPENCV_BUILD=1 -I/home/theodore/package_builds/opencv-git/src/opencv/include/opencv -I/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light -I/home/theodore/package_builds/opencv-git/src/opencv/3rdparty/ippicv/unpack/ippicv_lnx/include -I/home/theodore/package_builds/opencv-git/src/opencv -isystem /usr/include/eigen3 -I/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/include -I/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src -I/home/theodore/package_builds/opencv-git/src/opencv/modules/sfm -I/home/theodore/package_builds/opencv-git/src/opencv/modules/cudev/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/core/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/cudaarithm/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/flann/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/imgproc/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/ml/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/video/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/imgcodecs/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/shape/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/videoio/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/highgui/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/features2d/include -I/home/theodore/package_builds/opencv-git/src/opencv/modules/calib3d/include -I/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/xfeatures2d/include  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security   -Winit-self -Wpointer-arith  -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-undef -Wno-shadow -Wno-sign-compare -Wno-missing-declarations -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-function -fPIC -O3 -DNDEBUG  -DNDEBUG   -o CMakeFiles/multiview.dir/fundamental.cc.o -c /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/fundamental.cc
In file included from /usr/include/ceres/types.h:42:0,
                 from /usr/include/ceres/internal/variadic_evaluate.h:38,
                 from /usr/include/ceres/internal/autodiff.h:148,
                 from /usr/include/ceres/autodiff_cost_function.h:132,
                 from /usr/include/ceres/ceres.h:37,
                 from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/fundamental.cc:24:
/usr/include/ceres/internal/port.h:50:12: error: ‘std::shared_ptr’ has not been declared
 using std::shared_ptr;
            ^
In file included from /usr/include/ceres/ceres.h:55:0,
                 from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview/fundamental.cc:24:
/usr/include/ceres/solver.h:499:5: error: ‘shared_ptr’ does not name a type
     shared_ptr<ParameterBlockOrdering> linear_solver_ordering;
     ^
/usr/include/ceres/solver.h:630:5: error: ‘shared_ptr’ does not name a type
     shared_ptr<ParameterBlockOrdering> inner_iteration_ordering;
     ^
modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/build.make:110: recipe for target 'modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o' failed
make[2]: *** [modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/fundamental.cc.o] Error 1
make[2]: Leaving directory '/home/theodore/package_builds/opencv-git/src/opencv'
CMakeFiles/Makefile2:26073: recipe for target 'modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/all' failed
make[1]: *** [modules/sfm/src/libmv_light/libmv/multiview/CMakeFiles/multiview.dir/all] Error 2
make[1]: Leaving directory '/home/theodore/package_builds/opencv-git/src/opencv'
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

that's the output from make VERBOSE=1. However, I did not get the thing with the config.h and the gcc preprocessor via -E option can you explain a bit more.

alalek commented 8 years ago

Please attach your /usr/include/ceres/internal/config.h

Do you have something like this?

$ cat /usr/include/ceres/internal/config.h | grep TR1
// #define CERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE
#define CERES_TR1_UNORDERED_MAP
#define CERES_TR1_MEMORY_HEADER
#define CERES_TR1_SHARED_PTR

Or you have this?

ttsesm commented 8 years ago

Hi Alexander, the content of config.h is a bit different than the one that you describe above, all the lines are commented:

cat /usr/include/ceres/internal/config.h | grep TR1
// #define CERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE
// #define CERES_TR1_UNORDERED_MAP
// #define CERES_TR1_MEMORY_HEADER
// #define CERES_TR1_SHARED_PTR

and for sure not the one from the link, check bellow:

// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
//   used to endorse or promote products derived from this software without
//   specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: alexs.mac@gmail.com (Alex Stewart)

// Configuration options for Ceres.
//
// Do not edit this file, it was automatically configured by CMake when
// Ceres was compiled with the relevant configuration for the machine
// on which Ceres was compiled.
//
// Ceres Developers: All options should have the same name as their mapped
//                   CMake options, in the preconfigured version of this file
//                   all options should be enclosed in '@'.

#ifndef CERES_PUBLIC_INTERNAL_CONFIG_H_
#define CERES_PUBLIC_INTERNAL_CONFIG_H_

// If defined, use the LGPL code in Eigen.
#define CERES_USE_EIGEN_SPARSE

// If defined, Ceres was compiled without LAPACK.
// #define CERES_NO_LAPACK

// If defined, Ceres was compiled without SuiteSparse.
// #define CERES_NO_SUITESPARSE

// If defined, Ceres was compiled without CXSparse.
// #define CERES_NO_CXSPARSE

// If defined, Ceres was compiled without Schur specializations.
// #define CERES_RESTRICT_SCHUR_SPECIALIZATION

// If defined, Ceres was compiled to use Eigen instead of hardcoded BLAS
// routines.
// #define CERES_NO_CUSTOM_BLAS

// If defined, Ceres was compiled with C++11.
#define CERES_USE_CXX11

// If defined, Ceres was compiled without multithreading support.
// #define CERES_NO_THREADS
// If defined Ceres was compiled with OpenMP multithreading support.
#define CERES_USE_OPENMP
// Additionally defined on *nix if Ceres was compiled with OpenMP support,
// as in this case pthreads is also required.
#define CERES_HAVE_PTHREAD
#define CERES_HAVE_RWLOCK

// Which version of unordered map was used when Ceres was compiled. Exactly
// one of these will be defined for any given build.
#define CERES_STD_UNORDERED_MAP
// #define CERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE
// #define CERES_TR1_UNORDERED_MAP
// #define CERES_NO_UNORDERED_MAP

// If defined, the memory header is in <tr1/memory>, otherwise <memory>.
// #define CERES_TR1_MEMORY_HEADER

// If defined shared_ptr is in std::tr1 namespace, otherwise std.
// #define CERES_TR1_SHARED_PTR

// If defined, Ceres was built as a shared library.
// #define CERES_USING_SHARED_LIBRARY

#endif  // CERES_PUBLIC_INTERNAL_CONFIG_H_

so I guess the issue is that I did not compiled ceres_solver with the proper options, right? Actually I used this PKGBUILD file from here

alalek commented 8 years ago

Thanks for update!

I see, there is defined #define CERES_USE_CXX11 in your ceres config. You may try to disable C++11 in ceres build somehow or enable C++11 features in OpenCV build (rebuild with cmake -DCMAKE_CXX_FLAGS="-std=c++11 .). But this mode is not well tested (especially with opencv_contrib).

ttsesm commented 8 years ago

Hi Alexander, I followed your advice and disabled c++11 on ceres_solver package and now the content of config.h in ceres_solver is the one you mentioned above in your message:

$ cat /usr/include/ceres/internal/config.h | grep TR1
// #define CERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE
#define CERES_TR1_UNORDERED_MAP
#define CERES_TR1_MEMORY_HEADER
#define CERES_TR1_SHARED_PTR

Then I tried to recompile opencv, however now I am getting the following error:

[ 58%] Building CXX object modules/sfm/CMakeFiles/opencv_sfm.dir/src/simple_pipeline.cpp.o
In file included from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/simple_pipeline.cpp:43:0:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h: In function ‘void libmv_initLogging(const char*)’:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:94:42: error: ‘SetCommandLineOption’ was not declared in this scope
   SetCommandLineOption("logtostderr", "1");
                                          ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h: In function ‘void libmv_startDebugLogging()’:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:101:42: error: ‘SetCommandLineOption’ was not declared in this scope
   SetCommandLineOption("logtostderr", "1");
                                          ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h: In function ‘void libmv_setLoggingVerbosity(int)’:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:110:32: error: ‘SetCommandLineOption’ was not declared in this scope
   SetCommandLineOption("v", val);
                                ^
modules/sfm/CMakeFiles/opencv_sfm.dir/build.make:206: recipe for target 'modules/sfm/CMakeFiles/opencv_sfm.dir/src/simple_pipeline.cpp.o' failed
make[2]: *** [modules/sfm/CMakeFiles/opencv_sfm.dir/src/simple_pipeline.cpp.o] Error 1
CMakeFiles/Makefile2:25694: recipe for target 'modules/sfm/CMakeFiles/opencv_sfm.dir/all' failed
make[1]: *** [modules/sfm/CMakeFiles/opencv_sfm.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

any idea?

alalek commented 8 years ago

Check this patch: #484

ttsesm commented 8 years ago

I checked the source file and it is already patched, but compilation still fails.

alalek commented 8 years ago

Try to replace to something like GFLAGS_NAMESPACE::SetCommandLineOption. See https://github.com/gflags/gflags/search?utf8=%E2%9C%93&q=SetCommandLineOption

ttsesm commented 8 years ago

nope it does not work it gives me the following:

In file included from /home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/simple_pipeline.cpp:43:0:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h: In function ‘void libmv_initLogging(const char*)’:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:94:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("logtostderr", "1");
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:95:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("v", "0");
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:96:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("stderrthreshold", severity_fatal);
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:97:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("minloglevel", severity_fatal);
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h: In function ‘void libmv_startDebugLogging()’:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:101:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("logtostderr", "1");
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:102:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("v", "2");
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:103:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("stderrthreshold", "1");
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:104:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("minloglevel", "0");
   ^
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h: In function ‘void libmv_setLoggingVerbosity(int)’:
/home/theodore/package_builds/opencv-git/src/opencv_contrib/modules/sfm/src/libmv_capi.h:110:3: error: ‘GFLAGS_NAMESPACE’ has not been declared
   GFLAGS_NAMESPACE::SetCommandLineOption("v", val);
   ^
modules/sfm/CMakeFiles/opencv_sfm.dir/build.make:206: recipe for target 'modules/sfm/CMakeFiles/opencv_sfm.dir/src/simple_pipeline.cpp.o' failed
make[2]: *** [modules/sfm/CMakeFiles/opencv_sfm.dir/src/simple_pipeline.cpp.o] Error 1
CMakeFiles/Makefile2:25694: recipe for target 'modules/sfm/CMakeFiles/opencv_sfm.dir/all' failed
make[1]: *** [modules/sfm/CMakeFiles/opencv_sfm.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 64%] Built target example_tapi_camshift

then I tried to include some header files but no success as well

cbalint13 commented 8 years ago

@TheodoreT ,

ttsesm commented 8 years ago

@cbalint13 nope, I have already this patch, Alexander pointed me to that earlier, but it does not help. I tried also to use the former status before the patch with the google:: namespace but without success as well.

comicchang commented 8 years ago

Same problem here

I added '-D CMAKE_CXX_FLAGS=-std=c++11' to PKGBUILD file, that solved the std::shared_ptr error.

but the SetCommandLineOption error is still there

comicchang commented 8 years ago

Well,

adding this line

#include <gflags/gflags.h>

to the file opencv_contrib/modules/sfm/src/libmv_capi.h solved my issue

ttsesm commented 8 years ago

@comicchang thanks for the update. Indeed your solution solved the issue here as well. I will try to make a pull request with the solution. Many thanks again.

alalek commented 8 years ago

@TheodoreT Could you try #519 fix?

ttsesm commented 8 years ago

@alalek thanks #519 solves the issue I was planning to make a PR, but @volokh was faster. I am glad though that the issue is solved :+1: . Therefore, I will close this issue. Thanks again.

rainbow70626 commented 1 month ago

原因和解决办法:对于ceres-solver库,当前版本已经是2.2.0了,代码上有较大改动,而opencv的sfm模块所使用的代码是之前的版本,所以需要找个之前的版本自行源码编译。在OpenCV的官网上没有查到关于ceres-solver依赖版本的记载,选取ceres-solver-1.14.0即可构建成功。