ethz-asl / eth_supermegabot

Instructions for ETH center for robotics summer school 2019.
102 stars 41 forks source link

Compilation error opencv3 #28

Open michaelchi08 opened 4 years ago

michaelchi08 commented 4 years ago

Hello,

I'm getting this error compiling opencv. Can someone help me figure it out? I followed every step in the documentation.

Thanks, Michael

[ 50%] Built target opencv3_contrib [ 56%] Performing configure step for 'opencv3_src' -- Looking for ccache - not found -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") -- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR) -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") -- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so -- Checking for module 'gstreamer-base-1.0' -- No package 'gstreamer-base-1.0' found -- Checking for module 'gstreamer-video-1.0' -- No package 'gstreamer-video-1.0' found -- Checking for module 'gstreamer-app-1.0' -- No package 'gstreamer-app-1.0' found -- Checking for module 'gstreamer-riff-1.0' -- No package 'gstreamer-riff-1.0' found -- Checking for module 'gstreamer-pbutils-1.0' -- No package 'gstreamer-pbutils-1.0' found -- Checking for module 'gstreamer-base-0.10' -- No package 'gstreamer-base-0.10' found -- Checking for module 'gstreamer-video-0.10' -- No package 'gstreamer-video-0.10' found -- Checking for module 'gstreamer-app-0.10' -- No package 'gstreamer-app-0.10' found -- Checking for module 'gstreamer-riff-0.10' -- No package 'gstreamer-riff-0.10' found -- Checking for module 'gstreamer-pbutils-0.10' -- No package 'gstreamer-pbutils-0.10' 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 -- Found TBB (env): /usr/lib/x86_64-linux-gnu/libtbb.so -- found Intel IPP (ICV version): 2017.0.3 [2017.0.3] -- at: /home/michael/ethz_ws/build/opencv3_catkin/opencv3_build/3rdparty/ippicv/ippicv_lnx -- found Intel IPP IW sources: 2017.0.3 -- at: /home/michael/ethz_ws/build/opencv3_catkin/opencv3_build/3rdparty/ippicv/ippiw_lnx -- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR) -- A library with BLAS API found. -- A library with LAPACK API found. -- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) -- The imported target "vtkRenderingPythonTkWidgets" references the file "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so" but this file does not exist. Possible reasons include:

-- The imported target "vtk" references the file "/usr/bin/vtk" but this file does not exist. Possible reasons include:

-- Found VTK 6.3.0 (/usr/lib/cmake/vtk-6.3/UseVTK.cmake) -- Caffe: NO -- Protobuf: NO -- Glog: YES -- freetype2: YES -- harfbuzz: YES -- HDF5: Using hdf5 compiler wrapper to determine C configuration -- Module opencv_ovis disabled because OGRE3D was not found -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available. -- Found installed version of gflags: /home/michael/ethz_ws/devel/lib/cmake/gflags -- Detected gflags version: 2.2.1 -- Found installed version of Eigen: /usr/lib/cmake/eigen3 -- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3 -- Found required Ceres dependency: glog CMake Error at /usr/lib/x86_64-linux-gnu/cmake/gflags/gflags-targets.cmake:37 (message): Some (but not all) targets in this export set were already defined.

Targets Defined: gflags_shared;gflags_nothreads_shared

Targets not yet defined: gflags_static;gflags_nothreads_static

Call Stack (most recent call first): /usr/lib/x86_64-linux-gnu/cmake/gflags/gflags-config.cmake:10 (include) /usr/local/lib/cmake/Ceres/FindGflags.cmake:327 (find_package) /usr/local/lib/cmake/Ceres/CeresConfig.cmake:308 (find_package) /home/michael/ethz_ws/build/opencv3_catkin/opencv3_contrib_src/modules/sfm/CMakeLists.txt:8 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/michael/ethz_ws/build/opencv3_catkin/opencv3_build/CMakeFiles/CMakeOutput.log". See also "/home/michael/ethz_ws/build/opencv3_catkin/opencv3_build/CMakeFiles/CMakeError.log". CMakeFiles/opencv3_src.dir/build.make:109: recipe for target 'opencv3_src-prefix/src/opencv3_src-stamp/opencv3_src-configure' failed make[2]: [opencv3_src-prefix/src/opencv3_src-stamp/opencv3_src-configure] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/opencv3_src.dir/all' failed make[1]: [CMakeFiles/opencv3_src.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2

michaelchi08 commented 4 years ago

Errors << opencv3_catkin:make /home/ros/catkin_ws/logs/opencv3_catkin/build.make.000.log CMake Error at /usr/lib/x86_64-linux-gnu/cmake/gflags/gflags-targets.cmake:37 (message): Some (but not all) targets in this export set were already defined.

Targets Defined: gflags_shared;gflags_nothreads_shared

Targets not yet defined: gflags_static;gflags_nothreads_static

Call Stack (most recent call first): /usr/lib/x86_64-linux-gnu/cmake/gflags/gflags-config.cmake:10 (include) /usr/local/lib/cmake/Ceres/FindGflags.cmake:327 (find_package) /usr/local/lib/cmake/Ceres/CeresConfig.cmake:308 (find_package) /home/ros/catkin_ws/build/opencv3_catkin/opencv3_contrib_src/modules/sfm/CMakeLists.txt:8 (find_package)

make[2]: [opencv3_src-prefix/src/opencv3_src-stamp/opencv3_src-configure] Error 1 make[1]: [CMakeFiles/opencv3_src.dir/all] Error 2 make: *** [all] Error 2 cd /home/ros/catkin_ws/build/opencv3_catkin; catkin build --get-env opencv3_catkin | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd - ............................................................................... Failed << opencv3_catkin:make

michaelchi08 commented 4 years ago

I was able to solve the other errors but still not there yet. My latest build error:

Errors << octomap_world:make /home/ros/catkin_ws/logs/octomap_world/build.make.003.log
/home/ros/catkin_ws/devel/lib/libvolumetric_map_base.so: undefined reference to `cv::Mat::updateContinuityFlag()' collect2: error: ld returned 1 exit status make[2]: [/home/ros/catkin_ws/devel/lib/octomap_world/octomap_manager] Error 1 make[1]: [CMakeFiles/octomap_manager.dir/all] Error 2 make: *** [all] Error 2 cd /home/ros/catkin_ws/build/octomap_world; catkin build --get-env octomap_world | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -

BarzelS commented 4 years ago

I was able to solve the other errors but still not there yet. My latest build error:

Errors << octomap_world:make /home/ros/catkin_ws/logs/octomap_world/build.make.003.log /home/ros/catkin_ws/devel/lib/libvolumetric_map_base.so: undefined reference to `cv::Mat::updateContinuityFlag()' collect2: error: ld returned 1 exit status make[2]: [/home/ros/catkin_ws/devel/lib/octomap_world/octomap_manager] Error 1 make[1]: [CMakeFiles/octomap_manager.dir/all] Error 2 make: *** [all] Error 2 cd /home/ros/catkin_ws/build/octomap_world; catkin build --get-env octomap_world | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -

How did you solve the first issue?

petegibson commented 3 years ago

I encountered the same error,

Targets not yet defined: gflags_static;gflags_nothreads_static

while building opencv3_catkin for Kimera on Ubuntu 18.04 + ROS Melodic, and it seems like catkin was finding the system libgflags instead of the workspace one. Removing libgflags* with apt fixed the issue for me.

flashsturz commented 1 year ago

For me, the same issue

Targets not yet defined: gflags_static;gflags_nothreads_static

was caused by a system installation of Google Ceres together with gflags, which I required for another project. Hence I could not simply delete the system gflag-packages. The workaround that made the software compile for me was to comment out the hardcoded gflags-directory path when loading ceres, e.g. commenting out the following part in /usr/lib/cmake/Ceres around line 300 (notice the # in the middle of the 3 lines):

if (GFLAGS_WAS_BUILT_WITH_CMAKE)
      #set(gflags_DIR /usr/lib/x86_64-linux-gnu/cmake/gflags)
      set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE)