LuoXubo / JointLoc

[IROS 2024] JointLoc: A Real-time Visual Localization Framework for Planetary UAVs Based on Joint Relative and Absolute Pose Estimation
https://luoxubo.github.io/projects/iros2024.html
MIT License
35 stars 1 forks source link

building RelLoc on Ubuntu 18.04 #9

Closed vasnakh closed 2 months ago

vasnakh commented 2 months ago

Hi, was wondering what version of Ubuntu the code has been tested on? I am trying to run on ubuntu 18.04 and after installing reddis and protobuf successfully i am running into an issue after the build is almost done (around 100%). I have been able to successfully build ORBSLAM3 and use it on the same PC btw before building this project but i am just stock with protobuf part it seems like.

Note that i had to add the following into the CMakeLists.txt for RelLoc else i would get some redis related error (that's how i was able to bypass redis errors). and to make sure things are correct i also made sure CMakeLists.txt of protobuf-3.25.2 and also tried to add the same lines in to protobuf-3.25.2/third-party/abseil-cpp but still got the same error.

SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

The error i am getting when i call bash ./build.sh under RelLoc is:

Towards top:

[100%] Linking CXX executable jointslam
/usr/local/lib/libprotobuf.a(generated_message_reflection.cc.o): In function `google::protobuf::GetFastParseFunction(google::protobuf::internal::TcParseFunction)':
/home/ga/app/protobuf/src/google/protobuf/generated_message_reflection.cc:3202: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::LogMessageFatal(char const*, int)'
/usr/local/lib/libprotobuf.a(generated_message_reflection.cc.o): In function `google::protobuf::GetFastParseFunction(google::protobuf::internal::TcParseFunction)':
/home/ga/app/protobuf/third_party/abseil-cpp/absl/log/internal/log_message.h:307: undefined reference to `void absl::lts_20230802::log_internal::LogMessage::CopyToEncodedBuffer<(absl::lts_20230802::log_internal::LogMessage::StringType)0>(absl::lts_20230802::string_view)'
/home/ga/app/protobuf/third_party/abseil-cpp/absl/log/internal/log_message.h:118: undefined reference to `absl::lts_20230802::log_internal::LogMessage& absl::lts_20230802::log_internal::LogMessage::operator<< <int, 0>(int const&)'
/usr/local/lib/libprotobuf.a(generated_message_reflection.cc.o): In function `google::protobuf::GetFastParseFunction(google::protobuf::internal::TcParseFunction)':
/home/ga/app/protobuf/src/google/protobuf/generated_message_reflection.cc:3202: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::~LogMessageFatal()'
/usr/local/lib/libprotobuf.a(generated_message_reflection.cc.o): In function `google::protobuf::internal::ReflectionSchema::GetExtensionSetOffset() const [clone .part.125]':
/home/ga/app/protobuf/src/google/protobuf/generated_message_reflection.h:189: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, absl::lts_20230802::string_view)'
/home/ga/app/protobuf/src/google/protobuf/generated_message_reflection.h:189: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::~LogMessageFatal()'
/usr/local/lib/libprotobuf.a(generated_message_reflection.cc.o): In function `google::protobuf::Reflection::GetSplitField(google::protobuf::Message const*) const [clone .part.127]':
/home/ga/app/protobuf/src/google/protobuf/message.h:1548: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, absl::lts_20230802::string_view)'

so many other lines with similar error and towards the end:

/home/ga/app/protobuf/third_party/abseil-cpp/absl/strings/str_format.h:465: undefined reference to `absl::lts_20230802::str_format_internal::SnprintF(char*, unsigned long, absl::lts_20230802::str_format_internal::UntypedFormatSpecImpl, absl::lts_20230802::Span<absl::lts_20230802::str_format_internal::FormatArgImpl const>)'
/home/ga/app/protobuf/third_party/abseil-cpp/absl/strings/str_format.h:465: undefined reference to `absl::lts_20230802::str_format_internal::SnprintF(char*, unsigned long, absl::lts_20230802::str_format_internal::UntypedFormatSpecImpl, absl::lts_20230802::Span<absl::lts_20230802::str_format_internal::FormatArgImpl const>)'
/usr/local/lib/libprotobuf.a(strtod.cc.o): In function `google::protobuf::io::SimpleFtoa[abi:cxx11](float)':
/home/ga/app/protobuf/src/google/protobuf/io/strtod.cc:188: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, absl::lts_20230802::string_view)'
/home/ga/app/protobuf/src/google/protobuf/io/strtod.cc:188: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::~LogMessageFatal()'
/usr/local/lib/libprotobuf.a(strtod.cc.o): In function `google::protobuf::io::SimpleFtoa[abi:cxx11](float)':
/home/ga/app/protobuf/third_party/abseil-cpp/absl/strings/str_format.h:465: undefined reference to `absl::lts_20230802::str_format_internal::SnprintF(char*, unsigned long, absl::lts_20230802::str_format_internal::UntypedFormatSpecImpl, absl::lts_20230802::Span<absl::lts_20230802::str_format_internal::FormatArgImpl const>)'
/usr/local/lib/libprotobuf.a(strtod.cc.o): In function `google::protobuf::io::SimpleFtoa[abi:cxx11](float)':
/home/ga/app/protobuf/src/google/protobuf/io/strtod.cc:196: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, absl::lts_20230802::string_view)'
/home/ga/app/protobuf/src/google/protobuf/io/strtod.cc:196: undefined reference to `absl::lts_20230802::log_internal::LogMessageFatal::~LogMessageFatal()'

collect2: error: ld returned 1 exit status
CMakeFiles/jointslam.dir/build.make:707: recipe for target 'jointslam' failed
make[2]: *** [jointslam] Error 1
CMakeFiles/Makefile2:74: recipe for target 'CMakeFiles/jointslam.dir/all' failed
make[1]: *** [CMakeFiles/jointslam.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Note that I also tried to actually install redis-plus-plus v1.1.2 which follows C++14 standards but still getting the same error even without any changes to any of CMakeFiles.txt

Additional info: Using cmake 3.13.0

vasnakh commented 2 months ago

and FYI if i don't include SET(CMAKE_CXX_STANDARD 17) anywhere i get the following error:

[ 97%] Built target main_BowCvt
In file included from /home/ga/app/JointLoc/RelLoc/src/slam/Tracking.cc:4:0:
/home/ga/app/JointLoc/RelLoc/src/slam/Tracking.h: In constructor ‘ORB_SLAM2::Tracking::Tracking(ORB_SLAM2::System*, ORB_SLAM2::ORBVocabulary*, ORB_SLAM2::FrameDrawer*, ORB_SLAM2::MapDrawer*, ORB_SLAM2::Map*, ORB_SLAM2::KeyFrameDatabase*, const string&, int)’:
/home/ga/app/JointLoc/RelLoc/src/slam/Tracking.h:192:16: warning: ‘ORB_SLAM2::Tracking::mnLastRelocFrameId’ will be initialized after [-Wreorder]
   unsigned int mnLastRelocFrameId;
                ^~~~~~~~~~~~~~~~~~
/home/ga/app/JointLoc/RelLoc/src/slam/Tracking.h:160:16: warning:   ‘ORB_SLAM2::FrameDrawer* ORB_SLAM2::Tracking::mpFrameDrawer’ [-Wreorder]
   FrameDrawer *mpFrameDrawer;
                ^~~~~~~~~~~~~
/home/ga/app/JointLoc/RelLoc/src/slam/Tracking.cc:27:3: warning:   when initialized here [-Wreorder]
   Tracking::Tracking(System *pSys, ORBVocabulary *pVoc, FrameDrawer *pFrameDrawer,
   ^~~~~~~~
/home/ga/app/JointLoc/RelLoc/src/slam/Tracking.cc: In member function ‘bool ORB_SLAM2::Tracking::TrackLocalMap()’:
/home/ga/app/JointLoc/RelLoc/src/slam/Tracking.cc:1205:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (mnMatchesInliers < Param::MIN_2D3D_MATCHES_NUMBER)
         ~~~~~~~~~~~~~~~~~^~~~~~~
/home/ga/app/JointLoc/RelLoc/src/slam/System.cc: In member function ‘void ORB_SLAM2::System::SaveMapPoints(const string&)’:
/home/ga/app/JointLoc/RelLoc/src/slam/System.cc:504:20: warning: unused variable ‘z’ [-Wunused-variable]
       const double z = vpKFs[i]->GetPose().Ow().at<float>(2);
                    ^
/home/ga/app/JointLoc/RelLoc/src/slam/ModelBA.cc: In function ‘bool buildXYProblem(std::__cxx11::list<ORB_SLAM2::KeyFrame*>&, BA::BAParameters&, ceres::Problem&)’:
/home/ga/app/JointLoc/RelLoc/src/slam/ModelBA.cc:810:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < nprameter.abs.size(); i++)
                   ~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/sw/redis++/utils.h:24:0,
                 from /usr/local/include/sw/redis++/reply.h:28,
                 from /usr/local/include/sw/redis++/connection.h:30,
                 from /usr/local/include/sw/redis++/connection_pool.h:26,
                 from /usr/local/include/sw/redis++/redis.h:25,
                 from /usr/local/include/sw/redis++/redis++.h:20,
                 from /home/ga/app/JointLoc/RelLoc/src/vslam.cc:39:
/usr/local/include/sw/redis++/cxx_utils.h:33:25: error: ‘string_view’ in namespace ‘std’ does not name a type
 using StringView = std::string_view;
                         ^~~~~~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:36:23: error: ‘optional’ in namespace ‘std’ does not name a template type
 using Optional = std::optional<T>;
                       ^~~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:39:22: error: ‘variant’ in namespace ‘std’ does not name a template type
 using Variant = std::variant<Args...>;
                      ^~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:41:24: error: ‘monostate’ in namespace ‘std’ does not name a type
 using Monostate = std::monostate;
                        ^~~~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:44:26: error: ‘is_invocable’ in namespace ‘std’ does not name a template type
 using IsInvocable = std::is_invocable<F, Args...>;

Error is basically:

/usr/local/include/sw/redis++/cxx_utils.h:33:25: error: ‘string_view’ in namespace ‘std’ does not name a type
 using StringView = std::string_view;
                         ^~~~~~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:36:23: error: ‘optional’ in namespace ‘std’ does not name a template type
 using Optional = std::optional<T>;
                       ^~~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:39:22: error: ‘variant’ in namespace ‘std’ does not name a template type
 using Variant = std::variant<Args...>;
                      ^~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:41:24: error: ‘monostate’ in namespace ‘std’ does not name a type
 using Monostate = std::monostate;
                        ^~~~~~~~~
/usr/local/include/sw/redis++/cxx_utils.h:44:26: error: ‘is_invocable’ in namespace ‘std’ does not name a template type
 using IsInvocable = std::is_invocable<F, Args...>;
LuoXubo commented 2 months ago

Hi, I've tested JointLoc on Ubuntu20.04 and Ubuntu18.04 successfully. You can fix the namespace-related bugs by adding this to CMakeLists.txt:

SET(CMAKE_CXX_FLAGS "-std=c++17 -O2 -g -Wall ${CMAKE_CXX_FLAGS}")

If there is any further bug about Redis, feel free to contact me.


And it seems like there is a problem with the compilation of Protobuf due to the googletest. I've uploaded the full files to Google Drive, you can download them at this link: https://drive.google.com/drive/folders/1Kcz945OVrPSC6LmcvyY4hf94volbGC9P?usp=sharing

Run the following to compile Portobuf:

./autogen.sh
./configure
 make -j8
 sudo make install
 sudo ldconfig 

It should be noted that some warnings that appear during the compilation process may also cause the compilation of the entire project to fail. Thanks to @Zsy103 for helping solve the problem :)

vasnakh commented 2 months ago

Worked! Really appreciate it!