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

Build fails on latest LTS ROS2 "Humble" #1

Open
JesseCake opened this issue Jun 2, 2022 · 3 comments
Open

Build fails on latest LTS ROS2 "Humble" #1

JesseCake opened this issue Jun 2, 2022 · 3 comments

Comments

@JesseCake
Copy link

I realise that this driver was written with ROS2 "Foxy" in mind, but it shouldn't be too hard to get it to play nice with the newest LTS being that we're still in the land of ROS2.

I've attempted a build and am getting the following error:

~/dev_ws/src/ros2-driver/src/advanced_navigation_driver.cpp:40:10: fatal error: tf2/LinearMath/Quaternion.h: No such file or directory
   40 | #include <tf2/LinearMath/Quaternion.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Meaning that somewhere along the way we're not referencing the right library header location.

I'll dig and see what I can find, but right now I thought I'd let you know so that moves can be made to get this library up to speed with the latest LTS

@JesseCake
Copy link
Author

JesseCake commented Jun 2, 2022

Update:

By updating the CMakeLists.txt to include the tf2 library this problem goes away:


cmake_minimum_required(VERSION 3.5)
project(ros2-driver)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
#find_library(DRIVER tf2)


add_executable(adnav_driver src/advanced_navigation_driver.cpp src/rs232/rs232.c src/an_packet_protocol.c src/spatial_packets.c src/NTRIP_Client/NTRIP/ntripclient.c)
ament_target_dependencies(
        adnav_driver
        rclcpp
        std_msgs
        sensor_msgs
        diagnostic_msgs
        geometry_msgs
        tf2_ros
)

install(TARGETS
adnav_driver
DESTINATION lib/${PROJECT_NAME})

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # uncomment the line when a copyright and license is not present in all source files
  #set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  #set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

But now we see we have a new problem in compilation that appears to be a definition of 'error' in 2 of the other pieces of code in use for RS232 and NTRIP which means the compilation stops again (the linker doesn't like this):

/usr/bin/ld: CMakeFiles/adnav_driver.dir/src/NTRIP_Client/NTRIP/ntripclient.c.o:(.bss+0x0): multiple definition of `error'; CMakeFiles/adnav_driver.dir/src/rs232/rs232.c.o:(.bss+0x4): first defined here
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/adnav_driver.dir/build.make:277: adnav_driver] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/adnav_driver.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

I'll keep investigating, but did this code compile happily before?

@JesseCake
Copy link
Author

Successful compilation!

Basically there's a variable name "error" in both ntripclient.c and also rs232.c so when they're linked the linker is unhappy.

I changed the variable name "error" to "myerror" just to see if it'd work in ntripclient.c and it's happy now - compilation worked.

I can either clone, fix, and send a pull request for you to merge, or let you do your thing - happy either way.

Jesse

@TZECHIN6
Copy link

TZECHIN6 commented Jun 1, 2023

@JesseCake thanks for that.

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