ORB_SLAM2 icon indicating copy to clipboard operation
ORB_SLAM2 copied to clipboard

Update to OpenCV4 and fix some build errors

Open Windfisch opened this issue 5 years ago • 11 comments

Mostly changes or adds #include-statements to account for moved files or missing unistd.h.

Windfisch avatar Jul 17 '19 23:07 Windfisch

Hi. I still have strange problem using OpenCV4. I receive these messages: [ 62%] Built target ORB_SLAM2 Scanning dependencies of target mono_euroc [ 65%] Building CXX object CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o [ 68%] Linking CXX executable ../Examples/Monocular/mono_euroc CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o: In function cvflann::anyimpl::big_any_policy<cv::String>::static_delete(void**)': mono_euroc.cc:(.text._ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE13static_deleteEPPv[_ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE13static_deleteEPPv]+0x15): undefined reference to cv::String::deallocate()' CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o: In function cvflann::anyimpl::big_any_policy<cv::String>::move(void* const*, void**)': mono_euroc.cc:(.text._ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5_[_ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5_]+0x10): undefined reference to cv::String::deallocate()' mono_euroc.cc:(.text.ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5[ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5]+0x24): undefined reference to cv::String::deallocate()' CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o: In function main': mono_euroc.cc:(.text.startup+0x398): undefined reference to cv::imread(cv::String const&, int)' mono_euroc.cc:(.text.startup+0x4d8): undefined reference to cv::String::deallocate()' mono_euroc.cc:(.text.startup+0xa6d): undefined reference to cv::String::allocate(unsigned long)' mono_euroc.cc:(.text.startup+0xd32): undefined reference to cv::String::deallocate()' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, double&, double)' ../lib/libORB_SLAM2.so: undefined reference to cv::line(cv::InputOutputArray const&, cv::Point, cv::Point_, cv::Scalar_ const&, int, int, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::getTextSize(cv::String const&, int, double, int, int*)' ../lib/libORB_SLAM2.so: undefined reference to cv::error(int, cv::String const&, char const*, char const*, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, int&, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::operator<<(cv::FileStorage&, cv::String const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::Mat::diag(cv::Mat const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::write(cv::FileStorage&, cv::String const&, double)' ../lib/libORB_SLAM2.so: undefined reference to cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, float&, float)' ../lib/libORB_SLAM2.so: undefined reference to cv::eigen(cv::InputArray const&, cv::OutputArray const&, cv::OutputArray const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, cv::String&, cv::String const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::putText(cv::InputOutputArray const&, cv::String const&, cv::Point, int, double, cv::Scalar, int, int, bool)' ../lib/libORB_SLAM2.so: undefined reference to cv::namedWindow(cv::String const&, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::write(cv::FileStorage&, cv::String const&, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::FileStorage::operator[](cv::String const&) const' ../lib/libORB_SLAM2.so: undefined reference to cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::InputArray::getMat(int) const' collect2: error: ld returned 1 exit status CMakeFiles/mono_euroc.dir/build.make:121: recipe for target '../Examples/Monocular/mono_euroc' failed make[2]: *** [../Examples/Monocular/mono_euroc] Error 1 CMakeFiles/Makefile2:81: recipe for target 'CMakeFiles/mono_euroc.dir/all' failed make[1]: *** [CMakeFiles/mono_euroc.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 buemi@CTNCWD7002:~/Antonio/ORB_SLAM2-master/build$ make -j1 >errors.txt CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o: In function cvflann::anyimpl::big_any_policy<cv::String>::static_delete(void**)': mono_euroc.cc:(.text._ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE13static_deleteEPPv[_ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE13static_deleteEPPv]+0x15): undefined reference to cv::String::deallocate()' CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o: In function cvflann::anyimpl::big_any_policy<cv::String>::move(void* const*, void**)': mono_euroc.cc:(.text._ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5_[_ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5_]+0x10): undefined reference to cv::String::deallocate()' mono_euroc.cc:(.text.ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5[ZN7cvflann7anyimpl14big_any_policyIN2cv6StringEE4moveEPKPvPS5]+0x24): undefined reference to cv::String::deallocate()' CMakeFiles/mono_euroc.dir/Examples/Monocular/mono_euroc.cc.o: In function main': mono_euroc.cc:(.text.startup+0x398): undefined reference to cv::imread(cv::String const&, int)' mono_euroc.cc:(.text.startup+0x4d8): undefined reference to cv::String::deallocate()' mono_euroc.cc:(.text.startup+0xa6d): undefined reference to cv::String::allocate(unsigned long)' mono_euroc.cc:(.text.startup+0xd32): undefined reference to cv::String::deallocate()' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, double&, double)' ../lib/libORB_SLAM2.so: undefined reference to cv::line(cv::InputOutputArray const&, cv::Point, cv::Point, cv::Scalar const&, int, int, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::getTextSize(cv::String const&, int, double, int, int*)' ../lib/libORB_SLAM2.so: undefined reference to cv::error(int, cv::String const&, char const*, char const*, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, int&, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::operator<<(cv::FileStorage&, cv::String const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::Mat::diag(cv::Mat const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::write(cv::FileStorage&, cv::String const&, double)' ../lib/libORB_SLAM2.so: undefined reference to cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, float&, float)' ../lib/libORB_SLAM2.so: undefined reference to cv::eigen(cv::_InputArray const&, cv::_OutputArray const&, cv::OutputArray const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::read(cv::FileNode const&, cv::String&, cv::String const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::putText(cv::InputOutputArray const&, cv::String const&, cv::Point, int, double, cv::Scalar, int, int, bool)' ../lib/libORB_SLAM2.so: undefined reference to cv::namedWindow(cv::String const&, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::write(cv::FileStorage&, cv::String const&, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' ../lib/libORB_SLAM2.so: undefined reference to cv::FileStorage::operator[](cv::String const&) const' ../lib/libORB_SLAM2.so: undefined reference to cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' ../lib/libORB_SLAM2.so: undefined reference to cv::InputArray::getMat(int) const' collect2: error: ld returned 1 exit status make[2]: *** [../Examples/Monocular/mono_euroc] Error 1 make[1]: *** [CMakeFiles/mono_euroc.dir/all] Error 2 make: *** [all] Error 2

buemi avatar Mar 13 '20 10:03 buemi

you are missing libraries at the linking step. Figure out, which .so files in /usr/lib/ (or whereever your opencv libs are) have these. Then figure out how to add them to the linking step. (make V=1) should print you the commands, adding them to the last linking step by hand should suffice as a workaround. Then figure out how to "properly" add this to the cmakefiles.txt.

Windfisch avatar Mar 20 '20 11:03 Windfisch

Thank you, I really appreciate your help. Unfortunately, is not clear to me how to add the libraries path to the last linking step, since the CMakeList doesn't seem to directly containing the linker command.

buemi avatar Mar 20 '20 14:03 buemi

Thank you, this works awesomely!

codieboomboom avatar Jul 09 '20 00:07 codieboomboom

use this work , I find the tracking time are increasing and the tracking precision is downing ,.

zhuangxiaopi avatar Sep 25 '20 07:09 zhuangxiaopi

@zhuangxiaopi how did you measure the performance? Was it running on your camera or another rosbag ?

codieboomboom avatar Sep 25 '20 14:09 codieboomboom

I run the dataset "fr3_walking_rpy",the media tracking time is 0.1s . I didn’t use the evaluation tool because the trajectory drift is visible to the naked eye. Thx .

At 2020-09-25 22:46:55, "Do Anh Tu" [email protected] wrote:

@zhuangxiaopi how did you measure the performance? Was it running on your camera or another rosbag ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

zhuangxiaopi avatar Sep 26 '20 02:09 zhuangxiaopi

using build.sh I get "ORB_SLAM2/src/ORBmatcher.cc:30:9: fatal error: 'stdint-gcc.h' file not found" - any idea how to fix that?

Are you using GCC? I'm using clang and had to change this to #include <cstdint>

collenjones avatar Jun 06 '21 21:06 collenjones

Thank you for this pull request. Works perfectly fine on Ubuntu 20.04 (uname -a: "Linux akp-VirtualBox 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux").

Why is this not yet merged in master?

GSORF avatar Jul 24 '21 11:07 GSORF

Glad it worked for you. Because this repo seems unmaintained, the maintainer was last seen 2017 :(

Windfisch avatar Jul 24 '21 11:07 Windfisch

Glad it worked for you. Because this repo seems unmaintained, the maintainer was last seen 2017 :(

Yeah I understand that ORB-SLAM3 is superior now and everyone should upgrade. However, many implementations still use ORB-SLAM2, so this is really a pity. Thank YOU for being active and responding quickly, though. Great work :)

GSORF avatar Jul 24 '21 12:07 GSORF