rubengooj / stvo-pl

Stereo Visual Odometry by combining point and line segment features
GNU General Public License v3.0
222 stars 96 forks source link

Fix build against latest MRPT #15

Open jlblancoc opened 5 years ago

jlblancoc commented 5 years ago

The PR fixes:

Please, merge, and reflect that the latest mrpt-1.5 version can be used to build the project, instead of referencing to a now outdated commit, as done here ;-)

Closes #14

cc: @rubengooj , @dzunigan

jlblancoc commented 4 years ago

This PR has been updated. It addresses https://github.com/rubengooj/pl-slam/issues/30

wsakobe commented 4 years ago

Sorry, I had a try of this PR but still met some problems as follow:

CMake Error at /usr/local/share/cmake-3.15/Modules/CMakeFindDependencyMacro.cmake:47 (find_package): By not providing "Findmrpt-opengl.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "mrpt-opengl", but CMake did not find one.

Could not find a package configuration file provided by "mrpt-opengl" with any of the following names:

mrpt-openglConfig.cmake
mrpt-opengl-config.cmake

I installed MRPT1.9.9 with PPA I'd like to ask you that how can i fix these problems?

jlblancoc commented 4 years ago

@wsakobe Let us know if the updated instructions here are clearer now...

wsakobe commented 4 years ago

I think it ca be worked soon! I have cmake this PR successfully. But I still faced some problems as follow: /usr/bin/ld: warning: libopencv_imgcodecs.so.3.2, needed by /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libopencv_core.so.3.2, needed by /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9, not found (try using -rpath or -rpath-link) /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9: undefined reference to `_IplImage::_IplImage(cv::Mat const&)' collect2: error: ld returned 1 exit status CMakeFiles/imagesStVO.dir/build.make:160: recipe for target 'imagesStVO' failed make[2]: [imagesStVO] Error 1 CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/imagesStVO.dir/all' failed make[1]: [CMakeFiles/imagesStVO.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

The version of my opencv is 3.4.7, does that means i need to degrade my opencv to 3.2? That's bad..

jlblancoc commented 4 years ago

The version of my opencv is 3.4.7, does that means i need to degrade my opencv to 3.2? That's bad..

I guess you installed opencv 3.4.7 with "sudo make install"? If yes, remove it from under "/usr/local/lib/". Installing libraries there is a bad practice nowadays.

You can keep using opencv 3.x or 4.x without problems, but building it locally in its own ".../build" directory, and setting OPENCV_DIR in any CMake project that you want to use that more recent version of opencv.

wsakobe commented 4 years ago

Sorry, i had uninstalled opencv with "sudo make uninstall" and add "set(OpenCV_DIR /home/wsakobe/Downloads/opencv-3.4.7/build)" to CMakeList in stvo, but it still showed ERROR with the same reasons: /usr/bin/ld: warning: libopencv_imgcodecs.so.3.2, needed by /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libopencv_core.so.3.2, needed by /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9, not found (try using -rpath or -rpath-link) /usr/lib/x86_64-linux-gnu/libmrpt-img.so.1.9.9: undefined reference to `_IplImage::_IplImage(cv::Mat const&)' collect2: error: ld returned 1 exit status CMakeFiles/imagesStVO.dir/build.make:161: recipe for target 'imagesStVO' failed make[2]: [imagesStVO] Error 1 CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/imagesStVO.dir/all' failed make[1]: [CMakeFiles/imagesStVO.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

Sorry again to interrupt you again.. How can i fix this problem?

jlblancoc commented 4 years ago

Check if sudo apt install libopencv-dev does install new packages or not? And after that, try:

locate libopencv_imgproc.so

and:

apt list --installed | grep opencv

and show us the outputs.

wsakobe commented 4 years ago

Sure, that's the outputs:

wsakobe@wsakobe-PC:~$ sudo apt install libopencv-dev [sudo] password for wsakobe: Reading package lists... Done Building dependency tree
Reading state information... Done libopencv-dev is already the newest version (3.2.0+dfsg-4ubuntu0.1). The following packages were automatically installed and are no longer required: libactionlib-msgs-dev libb64-0d libb64-dev libgeometry-msgs-dev libmrpt-detectors1.9 libmrpt-graphslam1.9 libros-rosgraph-msgs-dev librosconsole-dev librosconsole2d libroscpp-core-dev libroscpp-dev libroscpp-msgs-dev libroscpp1d libsensor-msgs-dev libstd-msgs-dev libstereo-msgs-dev libtf2-msgs-dev libxmlrpcpp-dev libxmlrpcpp1d python-gencpp python-genlisp python-genmsg python-genpy ros-message-generation ros-message-runtime Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.

wsakobe@wsakobe-PC:~$ locate libopencv_imgproc.so /home/wsakobe/Downloads/opencv-3.4.7/build/lib/libopencv_imgproc.so /home/wsakobe/Downloads/opencv-3.4.7/build/lib/libopencv_imgproc.so.3.4 /home/wsakobe/Downloads/opencv-3.4.7/build/lib/libopencv_imgproc.so.3.4.7 /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_imgproc.so.3.4 /usr/local/lib/libopencv_imgproc.so.3.4.7

wsakobe@wsakobe-PC:~$ apt list --installed | grep opencv

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libopencv-calib3d-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-calib3d3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-contrib-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-contrib3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-core-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-core3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed] libopencv-features2d-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-features2d3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-flann-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-flann3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-highgui-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-highgui3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-imgcodecs-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-imgcodecs3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-imgproc-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-imgproc3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-ml-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-ml3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-objdetect-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-objdetect3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-photo-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-photo3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-shape-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-shape3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-stitching-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-stitching3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-superres-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-superres3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-ts-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-video-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-video3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-videoio-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-videoio3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-videostab-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-videostab3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-viz-dev/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv-viz3.2/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] libopencv3.2-java/bionic-updates,bionic-updates,bionic-security,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 all [installed,automatic] libopencv3.2-jni/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] opencv-data/bionic-updates,bionic-updates,bionic-security,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 all [installed,automatic] python-opencv/bionic-updates,bionic-security,now 3.2.0+dfsg-4ubuntu0.1 amd64 [installed,automatic] ros-melodic-vision-opencv/bionic,now 1.13.0-0bionic.20191008.211701 amd64 [installed,automatic]

Thx a lot!

jlblancoc commented 4 years ago

/usr/local/lib/libopencv_imgproc.so

As told above, try first removing everything under /usr/local:

Use with caution: Take a look first at what do you have there, but in general I strongly recommend NOT having stuff under these directories, since they only cause troubles:

sudo rm -fr /usr/local/lib /usr/local/include

wsakobe commented 4 years ago

Screenshot from 2019-11-25 18-48-11 Now i have deleted all the files in /usr/local/lib and /usr/local/include but error still occured..

jlblancoc commented 4 years ago

Ok, then it seems that if you really want to use your own version of opencv, you should uninstall mrpt (via apt remove), and build MRPT from sources, setting its cmake's OpenCV_DIR to the same one you want to use for stvo-pl....

wsakobe commented 4 years ago

Sure, let me have a look!

wsakobe commented 4 years ago

That's cool!!! I re-installed MRPT with cmake and now i have successfully compiled stvo! However, when I was dealing with the last beast -- pl-slam, I faced a problem:

CMake Error at /usr/local/share/cmake-3.15/Modules/CMakeFindDependencyMacro.cmake:47 (find_package): By not providing "Findmrpt-base.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "mrpt-base", but CMake did not find one.

Could not find a package configuration file provided by "mrpt-base" with any of the following names:

mrpt-baseConfig.cmake
mrpt-base-config.cmake

Do you know how to fix this problem? BTW i have installed MRPT by source code and after that I installed sudo apt install libmrpt-dev

jlblancoc commented 4 years ago

You must also use the version of PL-SLAM from this PR.

wsakobe commented 4 years ago

Thanks a lot! It finally works for me.