jiexiong2016 / GCNv2_SLAM

Real-time SLAM system with deep features
Other
769 stars 194 forks source link

Build Fail #45

Closed arBalasquide closed 4 years ago

arBalasquide commented 4 years ago

I've been trying to install this project onto a JetsonTX2 and keep getting build errors.

I have openCV 4.1.1, EIgen and Pangolin suscesfully installed and the build.sh file is correctly pointing to my build of Torch.

In python2 and python3, I can suscesfully import cv2 but for somereason in these logs it shows that g2o fails to build due to "fatal error: opencv/cv.h: No such file or directory."

Here is the exact output of build.sh

Configuring and building Thirdparty/DBoW2 ...
mkdir: cannot create directory ‘build’: File exists
CMake Error at CMakeLists.txt:31 (message):
  OpenCV > 2.4.3 not found.

-- Configuring incomplete, errors occurred!
See also "/home/nvidia/GCNv2_SLAM/Thirdparty/DBoW2/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found.  Stop.
Configuring and building Thirdparty/g2o ...
mkdir: cannot create directory ‘build’: File exists
-- BUILD TYPE:Release
-- Compiling on Unix
CMake Warning (dev) at /usr/share/cmake-3.10/Modules/FindOpenMP.cmake:310 (if):
  if given arguments:

    "TRUE"

  An argument named "TRUE" appears in a conditional statement.  Policy
  CMP0012 is not set: if() recognizes numbers and boolean constants.  Run
  "cmake --help-policy CMP0012" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindOpenMP.cmake:425 (_OPENMP_GET_SPEC_DATE)
  CMakeLists.txt:47 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake-3.10/Modules/FindOpenMP.cmake:310 (if):
  if given arguments:

    "TRUE"

  An argument named "TRUE" appears in a conditional statement.  Policy
  CMP0012 is not set: if() recognizes numbers and boolean constants.  Run
  "cmake --help-policy CMP0012" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindOpenMP.cmake:425 (_OPENMP_GET_SPEC_DATE)
  CMakeLists.txt:47 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/nvidia/GCNv2_SLAM/Thirdparty/g2o/build
[100%] Built target g2o
Configuring and building ORB_SLAM2 ...
mkdir: cannot create directory ‘build’: File exists
Build type: Release
-- Using flag -std=c++11.
TORCH_PATH set to: /home/nvidia/pytorch/torch/lib/tmp_install/share/cmake/Torch
-- Caffe2: CUDA detected: 10.0
-- Caffe2: CUDA nvcc is: /usr/local/cuda-10.0/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-10.0
-- Caffe2: Header version is: 10.0
-- Found cuDNN: v7.6.3  (include: /usr/include, library: /usr/lib/aarch64-linux-gnu/libcudnn.so)
-- Autodetected CUDA architecture(s): 6.2
-- Added CUDA NVCC flags for: -gencode;arch=compute_62,code=sm_62
-- Torch version is: 1.0.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nvidia/GCNv2_SLAM/build
Scanning dependencies of target ORB_SLAM2
[  8%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o
[  8%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/System.cc.o
[ 13%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o
[ 17%] Building CXX object CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o
In file included from /home/nvidia/GCNv2_SLAM/include/Frame.h:32:0,
                 from /home/nvidia/GCNv2_SLAM/include/KeyFrame.h:29,
                 from /home/nvidia/GCNv2_SLAM/include/MapPoint.h:24,
                 from /home/nvidia/GCNv2_SLAM/include/FrameDrawer.h:25,
                 from /home/nvidia/GCNv2_SLAM/include/Viewer.h:25,
                 from /home/nvidia/GCNv2_SLAM/include/Tracking.h:28,
                 from /home/nvidia/GCNv2_SLAM/include/System.h:30,
                 from /home/nvidia/GCNv2_SLAM/src/System.cc:23:
/home/nvidia/GCNv2_SLAM/include/GCNextractor.h:34:10: fatal error: opencv/cv.h: No such file or directory
 #include <opencv/cv.h>
          ^~~~~~~~~~~~~
compilation terminated.
CMakeFiles/ORB_SLAM2.dir/build.make:62: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/System.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/System.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/nvidia/GCNv2_SLAM/include/Frame.h:32:0,
                 from /home/nvidia/GCNv2_SLAM/include/KeyFrame.h:29,
                 from /home/nvidia/GCNv2_SLAM/include/MapPoint.h:24,
                 from /home/nvidia/GCNv2_SLAM/include/FrameDrawer.h:25,
                 from /home/nvidia/GCNv2_SLAM/include/Viewer.h:25,
                 from /home/nvidia/GCNv2_SLAM/include/Tracking.h:28,
                 from /home/nvidia/GCNv2_SLAM/src/Tracking.cc:22:
/home/nvidia/GCNv2_SLAM/include/GCNextractor.h:34:10: fatal error: opencv/cv.h: No such file or directory
 #include <opencv/cv.h>
          ^~~~~~~~~~~~~
compilation terminated.
In file included from /home/nvidia/GCNv2_SLAM/include/Frame.h:32:0,
                 from /home/nvidia/GCNv2_SLAM/include/MapPoint.h:25,
                 from /home/nvidia/GCNv2_SLAM/include/KeyFrame.h:24,
                 from /home/nvidia/GCNv2_SLAM/include/LoopClosing.h:24,
                 from /home/nvidia/GCNv2_SLAM/src/LoopClosing.cc:21:
/home/nvidia/GCNv2_SLAM/include/GCNextractor.h:34:10: fatal error: opencv/cv.h: No such file or directory
 #include <opencv/cv.h>
          ^~~~~~~~~~~~~
In file included from /home/nvidia/GCNv2_SLAM/include/Frame.h:32:0,
                 from /home/nvidia/GCNv2_SLAM/include/MapPoint.h:25,
                 from /home/nvidia/GCNv2_SLAM/include/KeyFrame.h:24,
                 from /home/nvidia/GCNv2_SLAM/include/LocalMapping.h:24,
                 from /home/nvidia/GCNv2_SLAM/src/LocalMapping.cc:21:
/home/nvidia/GCNv2_SLAM/include/GCNextractor.h:34:10: fatal error: opencv/cv.h: No such file or directory
 #include <opencv/cv.h>
          ^~~~~~~~~~~~~
compilation terminated.
compilation terminated.
CMakeFiles/ORB_SLAM2.dir/build.make:86: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:134: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:110: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Perhaps is a linking problem since I installed openCV with JetPack 4.2?

arBalasquide commented 4 years ago

Solved. Simply had to port the code to work with opencv4. Using this person's commit to ORB.

Also had to make a few changes in some files to port some openCV2/3 calls to openCV4.