Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeographicLib irary error, how can i resolve it in ubuntu melodic? #18

Open
rahulgupta582 opened this issue Sep 15, 2021 · 1 comment
Open

Comments

@rahulgupta582
Copy link

root1@root1-GP65-Leopard-9SD:~/workspace_test$ catkin_make
Base path: /home/root1/workspace_test
Source space: /home/root1/workspace_test/src
Build space: /home/root1/workspace_test/build
Devel space: /home/root1/workspace_test/devel
Install space: /home/root1/workspace_test/install

Running command: "make cmake_check_build_system" in "/home/root1/workspace_test/build"

Running command: "make -j12 -l12" in "/home/root1/workspace_test/build"

Scanning dependencies of target gps_waypoint
[ 0%] Built target nav_msgs_generate_messages_nodejs
[ 4%] Built target calibrate_heading
[ 4%] Built target _catkin_empty_exported_target
[ 9%] Built target safety_node
[ 13%] Built target collect_gps_waypoints
[ 16%] Linking CXX executable /home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/plot_gps_waypoints
[ 18%] Linking CXX executable /home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_continuous2
[ 20%] Linking CXX executable /home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_mapping
[ 23%] Linking CXX executable /home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_continuous1
[ 25%] Building CXX object waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint.dir/src/gps_waypoint.cpp.o
[ 30%] Built target switch_controllers
[ 37%] Built target slam_gmapping_nodelet
[ 37%] Built target tf2_msgs_generate_messages_nodejs
[ 37%] Built target tf2_msgs_generate_messages_lisp
[ 37%] Built target tf2_msgs_generate_messages_py
[ 37%] Built target tf2_msgs_generate_messages_eus
[ 37%] Built target tf2_msgs_generate_messages_cpp
[ 37%] Built target actionlib_msgs_generate_messages_py
[ 37%] Built target actionlib_msgs_generate_messages_nodejs
[ 37%] Built target actionlib_msgs_generate_messages_eus
[ 37%] Built target std_msgs_generate_messages_py
[ 37%] Built target std_msgs_generate_messages_nodejs
[ 37%] Built target std_msgs_generate_messages_eus
[ 37%] Built target actionlib_msgs_generate_messages_lisp
[ 37%] Built target rosgraph_msgs_generate_messages_py
[ 37%] Built target rosgraph_msgs_generate_messages_nodejs
[ 37%] Built target std_msgs_generate_messages_cpp
[ 37%] Built target tf_generate_messages_cpp
[ 37%] Built target sensor_msgs_generate_messages_eus
[ 37%] Built target std_msgs_generate_messages_lisp
[ 37%] Built target rosgraph_msgs_generate_messages_lisp
[ 37%] Built target sensor_msgs_generate_messages_cpp
[ 37%] Built target rosgraph_msgs_generate_messages_eus
[ 37%] Built target tf_generate_messages_eus
[ 37%] Built target actionlib_msgs_generate_messages_cpp
[ 37%] Built target rosgraph_msgs_generate_messages_cpp
[ 37%] Built target tf_generate_messages_lisp
[ 37%] Built target roscpp_generate_messages_lisp
[ 37%] Built target roscpp_generate_messages_py
[ 37%] Built target geometry_msgs_generate_messages_nodejs
[ 37%] Built target roscpp_generate_messages_eus
[ 37%] Built target roscpp_generate_messages_nodejs
[ 37%] Built target tf_generate_messages_nodejs
[ 37%] Built target geometry_msgs_generate_messages_eus
[ 37%] Built target geometry_msgs_generate_messages_cpp
[ 37%] Built target geometry_msgs_generate_messages_lisp
[ 37%] Built target geometry_msgs_generate_messages_py
[ 37%] Built target actionlib_generate_messages_cpp
[ 37%] Built target roscpp_generate_messages_cpp
[ 37%] Built target sensor_msgs_generate_messages_lisp
[ 37%] Built target sensor_msgs_generate_messages_nodejs
[ 37%] Built target tf_generate_messages_py
[ 37%] Built target actionlib_generate_messages_eus
[ 37%] Built target sensor_msgs_generate_messages_py
[ 37%] Built target actionlib_generate_messages_lisp
[ 37%] Built target actionlib_generate_messages_py
[ 37%] Built target actionlib_generate_messages_nodejs
[ 37%] Built target nav_msgs_generate_messages_eus
[ 37%] Built target nav_msgs_generate_messages_lisp
[ 37%] Built target nav_msgs_generate_messages_cpp
[ 37%] Built target nav_msgs_generate_messages_py
CMakeFiles/plot_gps_waypoints.dir/src/plot_gps_waypoints.cpp.o: In function RobotLocalization::NavsatConversions::LLtoUTM(double, double, double&, double&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, double&)': plot_gps_waypoints.cpp:(.text+0x64): undefined reference to GeographicLib::UTMUPS::Forward(double, double, int&, bool&, double&, double&, double&, double&, int, bool)'
plot_gps_waypoints.cpp:(.text+0xa1): undefined reference to GeographicLib::MGRS::Forward(int, bool, double, double, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' collect2: error: ld returned 1 exit status waypoint_nav/outdoor_waypoint_nav/CMakeFiles/plot_gps_waypoints.dir/build.make:122: recipe for target '/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/plot_gps_waypoints' failed make[2]: *** [/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/plot_gps_waypoints] Error 1 CMakeFiles/Makefile2:1151: recipe for target 'waypoint_nav/outdoor_waypoint_nav/CMakeFiles/plot_gps_waypoints.dir/all' failed make[1]: *** [waypoint_nav/outdoor_waypoint_nav/CMakeFiles/plot_gps_waypoints.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 44%] Built target slam_gmapping_replay [ 51%] Built target slam_gmapping [ 51%] Built target _hector_mapping_nav_generate_messages_check_deps_HectorDebugInfo [ 51%] Built target _hector_mapping_nav_generate_messages_check_deps_HectorIterData CMakeFiles/gps_waypoint_mapping.dir/src/gps_waypoint_mapping.cpp.o: In function RobotLocalization::NavsatConversions::LLtoUTM(double, double, double&, double&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, double&)':
gps_waypoint_mapping.cpp:(.text+0x64): undefined reference to GeographicLib::UTMUPS::Forward(double, double, int&, bool&, double&, double&, double&, double&, int, bool)' gps_waypoint_mapping.cpp:(.text+0xa1): undefined reference to GeographicLib::MGRS::Forward(int, bool, double, double, int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)'
collect2: error: ld returned 1 exit status
waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_mapping.dir/build.make:122: recipe for target '/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_mapping' failed
make[2]: *** [/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_mapping] Error 1
CMakeFiles/Makefile2:2361: recipe for target 'waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_mapping.dir/all' failed
make[1]: *** [waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_mapping.dir/all] Error 2
CMakeFiles/gps_waypoint_continuous2.dir/src/gps_waypoint_continuous2.cpp.o: In function RobotLocalization::NavsatConversions::LLtoUTM(double, double, double&, double&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, double&)': gps_waypoint_continuous2.cpp:(.text+0x64): undefined reference to GeographicLib::UTMUPS::Forward(double, double, int&, bool&, double&, double&, double&, double&, int, bool)'
gps_waypoint_continuous2.cpp:(.text+0xa1): undefined reference to GeographicLib::MGRS::Forward(int, bool, double, double, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' collect2: error: ld returned 1 exit status CMakeFiles/gps_waypoint_continuous1.dir/src/gps_waypoint_continuous1.cpp.o: In function RobotLocalization::NavsatConversions::LLtoUTM(double, double, double&, double&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&, double&)':
gps_waypoint_continuous1.cpp:(.text+0x64): undefined reference to GeographicLib::UTMUPS::Forward(double, double, int&, bool&, double&, double&, double&, double&, int, bool)' gps_waypoint_continuous1.cpp:(.text+0xa1): undefined reference to GeographicLib::MGRS::Forward(int, bool, double, double, int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)'
collect2: error: ld returned 1 exit status
waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_continuous2.dir/build.make:122: recipe for target '/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_continuous2' failed
make[2]: *** [/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_continuous2] Error 1
CMakeFiles/Makefile2:1225: recipe for target 'waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_continuous2.dir/all' failed
make[1]: *** [waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_continuous2.dir/all] Error 2
waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_continuous1.dir/build.make:122: recipe for target '/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_continuous1' failed
make[2]: *** [/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint_continuous1] Error 1
CMakeFiles/Makefile2:1262: recipe for target 'waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_continuous1.dir/all' failed
make[1]: *** [waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint_continuous1.dir/all] Error 2
[ 53%] Linking CXX executable /home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint
CMakeFiles/gps_waypoint.dir/src/gps_waypoint.cpp.o: In function RobotLocalization::NavsatConversions::LLtoUTM(double, double, double&, double&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, double&)': gps_waypoint.cpp:(.text+0x64): undefined reference to GeographicLib::UTMUPS::Forward(double, double, int&, bool&, double&, double&, double&, double&, int, bool)'
gps_waypoint.cpp:(.text+0xa1): undefined reference to `GeographicLib::MGRS::Forward(int, bool, double, double, int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >&)'
collect2: error: ld returned 1 exit status
waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint.dir/build.make:122: recipe for target '/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint' failed
make[2]: *** [/home/root1/workspace_test/devel/lib/outdoor_waypoint_nav/gps_waypoint] Error 1
CMakeFiles/Makefile2:2558: recipe for target 'waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint.dir/all' failed
make[1]: *** [waypoint_nav/outdoor_waypoint_nav/CMakeFiles/gps_waypoint.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

@memoryisthekey
Copy link

memoryisthekey commented Oct 22, 2021

Hi! I was having the same issue.

I followed:

Below are my steps. I'm not sure all of them are needed but it did work for me:
I hope it helps.

1st Step: Geographic Lib (#19 (comment))

  • Choose where you want the geographic lib in your computer
  • git clone git://git.code.sourceforge.net/p/geographiclib/code ./geographiclib
  • cd geographiclib
  • mkdir build && cd build
  • cmake .. && make
  • sudo make install

2nd Step: Get robot_localization from src:

  • You might need to uninstall robot_localization from the /opt/ros (I did at least but it might not be necessary)
  • cd catkin_ws/src
  • git clone https://github.com/cra-ros-pkg/robot_localization.git
  • cd robot_localization/include/robot_localization
  • In the files navsat_conversions.h_ and navsat_transform.h:
    • Change or Add #include <GeographicLib/MGRS.hpp> and #include <GeographicLib/UTMUPS.hpp> for the path installed in 1st Step:
      • #include "/**_your_path_**/geographiclib/include/GeographicLib/MGRS.hpp"
      • #include "/**_your_path_**/geographiclib/include/GeographicLib/UTMUPS.hpp"

3rd Step: CMakeLists.txt (of outdoor_waypoint_nav repository):

  • Add robot_localization in find_package:
    • find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs tf roslib roslaunch robot_localization )

4th Step: package.xml (of outdoor_waypoint_nav repository):

  • Add <build_depend>robot_localization</build_depend>

5th Step: waypoint_nav/outdoor_waypoint_nav/src

  • Go through the .cpp files and change:
    *#include <robot_localization/navsat_conversions.h> to #include "/**_your_path_**/catkin_ws/src/robot_localization/include/robot_localization/navsat_conversions.h"
  • I'm not sure this is needed but I added (to all .cpp files):
    • #include "/**_your_path_**/geographiclib/include/GeographicLib/MGRS.hpp"
    • #include "/**_your_path_**/geographiclib/include/GeographicLib/UTMUPS.hpp"

6th Step: catkin_make and everything should work

  • cd catkin_ws
  • catkin_make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants