micro-ROS / micro_ros_setup

Support macros for building micro-ROS-based firmware.
Apache License 2.0
359 stars 131 forks source link

Errors when run build_agent.sh #228

Closed Aerotic closed 3 years ago

Aerotic commented 3 years ago

HOSTOS: Ubuntu 20.04.1 LTS

When I run ros2 run micro_ros_setup build_agent.sh, it gives following msg:

--- stderr: micro_ros_agent                                    
/usr/bin/ld: CMakeFiles/micro_ros_agent.dir/src/main.cpp.o: undefined reference to symbol '_ZN8eprosima8fastrtps4rtps6Time_tC1Eij'
/usr/bin/ld: /home/aero/test/install/microxrcedds_agent/lib/libfastrtps.so.2.0.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/micro_ros_agent.dir/build.make:87: micro_ros_agent] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/micro_ros_agent.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---

I'm quite sure that I completely follow the tutorial https://micro-ros.github.io/docs/tutorials/core/first_application_rtos/freertos/

The firmware build and flash work well.

Meanwhile, I've got a previously verison of microros_ws where firmware build and flash and micro_ros_agent all work well on the same computer

servetcoskun commented 3 years ago

Can confirm, I have the same issue following "First micro-ROS Application on Linux" on Ubuntu 20.04 with Foxy distro.

Duplicate of #227

peratle commented 3 years ago

Hi,

I also experienced this, but found a way to solve it:

In file ~/microros_ws/src/uros/micro-ROS-Agent/micro_ros_agent/CMakeLists.txt, add dependency to fastrtps three places (find_package, target_link_libraries, amend_export_dependencies)

Here you can see parts of the file after change:

...
find_package(ament_cmake REQUIRED)
find_package(microxrcedds_agent REQUIRED)
find_package(fastrtps REQUIRED)

add_executable(${PROJECT_NAME} src/main.cpp)

target_link_libraries(${PROJECT_NAME}
  PRIVATE
    microxrcedds_agent
    fastrtps
    $<$<BOOL:$<PLATFORM_ID:Linux>>:rt>
    $<$<BOOL:$<PLATFORM_ID:Linux>>:dl>
  )

set_target_properties(${PROJECT_NAME} PROPERTIES
  CXX_STANDARD
    11
  CXX_STANDARD_REQUIRED
    YES
  )

target_compile_options(${PROJECT_NAME}
  PRIVATE
    $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wall>
    $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wextra>
    $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wpedantic>
  )

ament_export_dependencies(microxrcedds_agent fastrtps)
...
FilipStarkenberg commented 3 years ago

Thank you. It worked for me as well. Good work!

pablogs9 commented 3 years ago

Hello everyone. Sorry for this error.

I have reset the foxy branch to in Micro XRCE-Agent to a34ad20a6dcc457cf34a3df97cacb87b00a2ff9d, so it should be working again.

@peratle thanks a lot for this fix, we are going to check internally why this error is introduced in the latest commit.

I'm closing since solved, please reopen if any other issue.

CC: @jamoralp

Hubery-wl commented 1 year ago

I found that all of my content loaded, but still report this error, I've read a lot of comments but still can't fix it.