Error while re-building catkin workspace: "undefined reference to `__aarch64_ldadd4_acq_rel'"
I have been attempting to build a ROS melodic package that I have previously built successfully, but I am encountering a issue while linking the nodes in the package. It seems that this issue is with the boost atomic library, but I have reinstalled this along with all its dependencies.
I get the following errors:
[ 10%] Built target lineSegmentFix
[ 11%] Linking CXX executable /home/slapper/catkin_ws/devel/lib/ransac_test/coefficient_cylinder_detector
[ 12%] Linking CXX executable /home/slapper/catkin_ws/devel/lib/ransac_test/perch_checker
CMakeFiles/post_processing.dir/src/post_processing.cpp.o: In function `boost::detail::atomic_increment(std::atomic<int>*)':
post_processing.cpp:(.text._ZN5boost6detail16atomic_incrementEPSt6atomicIiE[_ZN5boost6detail16atomic_incrementEPSt6atomicIiE]+0x28): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/post_processing.dir/src/post_processing.cpp.o: In function `boost::detail::atomic_decrement(std::atomic<int>*)':
post_processing.cpp:(.text._ZN5boost6detail16atomic_decrementEPSt6atomicIiE[_ZN5boost6detail16atomic_decrementEPSt6atomicIiE]+0x30): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/post_processing.dir/src/post_processing.cpp.o: In function `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()':
post_processing.cpp:(.text._ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv[_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv]+0x50): undefined reference to `__aarch64_ldadd4_acq_rel'
post_processing.cpp:(.text._ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv[_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv]+0x104): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/post_processing.dir/src/post_processing.cpp.o: In function `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy()':
post_processing.cpp:(.text._ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE15_M_add_ref_copyEv[_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE15_M_add_ref_copyEv]+0x50): undefined reference to `__aarch64_ldadd4_acq_rel'
collect2: error: ld returned 1 exit status
ransac_test/CMakeFiles/post_processing.dir/build.make:412: recipe for target '/home/slapper/catkin_ws/devel/lib/ransac_test/post_processing' failed
make[2]: *** [/home/slapper/catkin_ws/devel/lib/ransac_test/post_processing] Error 1
CMakeFiles/Makefile2:2302: recipe for target 'ransac_test/CMakeFiles/post_processing.dir/all' failed
make[1]: *** [ransac_test/CMakeFiles/post_processing.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/rviz_pcd.dir/src/rviz_pcd.cpp.o: In function `boost::detail::atomic_increment(std::atomic<int>*)':
rviz_pcd.cpp:(.text._ZN5boost6detail16atomic_incrementEPSt6atomicIiE[_ZN5boost6detail16atomic_incrementEPSt6atomicIiE]+0x28): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/rviz_pcd.dir/src/rviz_pcd.cpp.o: In function `boost::detail::atomic_decrement(std::atomic<int>*)':
rviz_pcd.cpp:(.text._ZN5boost6detail16atomic_decrementEPSt6atomicIiE[_ZN5boost6detail16atomic_decrementEPSt6atomicIiE]+0x30): undefined reference to `__aarch64_ldadd4_acq_rel'
collect2: error: ld returned 1 exit status
ransac_test/CMakeFiles/rviz_pcd.dir/build.make:411: recipe for target '/home/slapper/catkin_ws/devel/lib/ransac_test/rviz_pcd' failed
make[2]: *** [/home/slapper/catkin_ws/devel/lib/ransac_test/rviz_pcd] Error 1
CMakeFiles/Makefile2:2265: recipe for target 'ransac_test/CMakeFiles/rviz_pcd.dir/all' failed
make[1]: *** [ransac_test/CMakeFiles/rviz_pcd.dir/all] Error 2
CMakeFiles/coefficient_cylinder_detector.dir/src/coefficient_cylinder_detector.cpp.o: In function `boost::detail::atomic_increment(std::atomic<int>*)':
coefficient_cylinder_detector.cpp:(.text._ZN5boost6detail16atomic_incrementEPSt6atomicIiE[_ZN5boost6detail16atomic_incrementEPSt6atomicIiE]+0x28): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/coefficient_cylinder_detector.dir/src/coefficient_cylinder_detector.cpp.o: In function `boost::detail::atomic_decrement(std::atomic<int>*)':
coefficient_cylinder_detector.cpp:(.text._ZN5boost6detail16atomic_decrementEPSt6atomicIiE[_ZN5boost6detail16atomic_decrementEPSt6atomicIiE]+0x30): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/coefficient_cylinder_detector.dir/src/coefficient_cylinder_detector.cpp.o: In function `cv::Mat::operator=(cv::Mat const&)':
coefficient_cylinder_detector.cpp:(.text._ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0x48): undefined reference to `__aarch64_ldadd4_acq_rel'
CMakeFiles/coefficient_cylinder_detector.dir/src/coefficient_cylinder_detector.cpp.o: In function `cv::Mat::release()':
coefficient_cylinder_detector.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x30): undefined reference to `__aarch64_ldadd4_acq_rel'
collect2: error: ld returned 1 exit status
ransac_test/CMakeFiles/coefficient_cylinder_detector.dir/build.make:426: recipe for target '/home/slapper/catkin_ws/devel/lib/ransac_test/coefficient_cylinder_detector' failed
make[2]: *** [/home/slapper/catkin_ws/devel/lib/ransac_test/coefficient_cylinder_detector] Error 1
CMakeFiles/Makefile2:3527: recipe for target 'ransac_test/CMakeFiles/coefficient_cylinder_detector.dir/all' failed
make[1]: *** [ransac_test/CMakeFiles/coefficient_cylinder_detector.dir/all] Error 2
/usr/lib/gcc/aarch64-linux-gnu/10/../../../aarch64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
(.text+0x1c): undefined reference to `main'
collect2: error: ld returned 1 exit status
ransac_test/CMakeFiles/perch_checker.dir/build.make:411: recipe for target '/home/slapper/catkin_ws/devel/lib/ransac_test/perch_checker' failed
make[2]: *** [/home/slapper/catkin_ws/devel/lib/ransac_test/perch_checker] Error 1
CMakeFiles/Makefile2:3602: recipe for target 'ransac_test/CMakeFiles/perch_checker.dir/all' failed
make[1]: *** [ransac_test/CMakeFiles/perch_checker.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
I have tried both catkin_make and catkin build, but they result in the same error. I have also tried removing certain nodes from the package, but they all seem to have this same issue.
My CMakeLists.txt looks as follows:
cmake_minimum_required(VERSION 3.0.2)
project(ransac_test)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
add_compile_options(-std=c++14)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED dynamic_reconfigure COMPONENTS
roscpp
rospy
std_msgs
visualization_msgs
nodelet
tf2_ros
geometry_msgs
message_generation
)
find_package(PCL REQUIRED)
find_package(OpenCV REQUIRED)
find_package(realsense2 REQUIRED)
#Set flag for using threads
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and actions ##
################################################
## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder
add_message_files(
FILES
Perch.msg
# Message1.msg
# Message2.msg
)
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )
## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )
# Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
visualization_msgs
)
################################################
## Declare ROS dynamic reconfigure parameters ##
################################################
## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed
## Generate dynamic reconfigure parameters in the 'cfg' folder
generate_dynamic_reconfigure_options(
cfg/cylinder_detector.cfg
cfg/coefficient_cylinder_detector.cfg
cfg/cluster_cylinder_detector.cfg
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
# #TODO: LINKED WITH BROKEN line_segment_detector_nodelet_test ISSUE
# #TODO: See if nodelet_plugins can be different name then nodelet_plugins.xml file -> SEE BELOW TOO
catkin_package(
# INCLUDE_DIRS include
LIBRARIES line_segment_detector
CATKIN_DEPENDS message_runtime roscpp rospy std_msgs geometry_msgs nodelet
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories( include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
## Add librealsense sub-directory
##add_subdirectory(libs/librealsense-master)
##Link PCL directories and ad PCL definitions
##Found: https://answers.ros.org/question/123261/unable-to-include-pcl-files-in-header/
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
## Declare a C++ library
# add_library(line_segment_detector_nodelet_test
# src/line_segment_detector_nodelet_test_class.cpp
# )
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/ransac_test_node.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )
## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )
## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_ransac_test.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
add_executable(lineSegmentFix src/lineSegmentFix.cpp)
target_link_libraries(lineSegmentFix ${catkin_LIBRARIES})
#add_dependencies(markerListener ransac_test_generate_messages_cpp)
add_executable(coefficient_cylinder_detector src/coefficient_cylinder_detector.cpp)
target_link_libraries(coefficient_cylinder_detector ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBS})
add_dependencies(coefficient_cylinder_detector ${PROJECT_NAME}_gencfg)
add_executable(cluster_cylinder_detector src/cluster_cylinder_detector.cpp)
target_link_libraries(cluster_cylinder_detector ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBS})
add_dependencies(cluster_cylinder_detector ${PROJECT_NAME}_gencfg)
add_executable(cylinder_detector src/cylinder_detector.cpp)
target_link_libraries(cylinder_detector ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBS})
add_dependencies(cylinder_detector ${PROJECT_NAME}_gencfg ${PROJECT_NAME}_generate_messages_cpp)
add_executable(conversion_writer src/conversion_writer.cpp)
target_link_libraries(conversion_writer ${catkin_LIBRARIES} ${PCL_LIBRARIES})
add_executable(rviz_pcd src/rviz_pcd.cpp)
target_link_libraries(rviz_pcd ${catkin_LIBRARIES} ${PCL_LIBRARIES})
add_executable(post_processing src/post_processing.cpp)
target_link_libraries(post_processing ${DEPENDENCIES} ${realsense2_LIBRARY} ${catkin_LIBRARIES} ${PCL_LIBRARIES})
add_executable(perch_checker src/perch_checker.cpp)
target_link_libraries(perch_checker ${catkin_LIBRARIES} ${PCL_LIBRARIES})
add_executable(frame_conversion src/frame_conversion.cpp)
target_link_libraries(frame_conversion ${catkin_LIBRARIES})
#TODO: THIS IS STILL NOT WORKING, COULD TRY TO FIX
#add_executable(line_segment_detector_nodelet_test src/line_segment_detector_nodelet_test.cpp)
#TODO: See if nodelet_plugins can be different name then nodelet_plugins.xml file -> SEE ABOVE TOO
#TODO: I think nodelet_plugins should correspond to the library name in the nodelet_plugins.xml file
add_library(line_segment_detector src/line_segment_detector_nodelet_test.cpp)
target_link_libraries(line_segment_detector ${catkin_LIBRARIES})
if(catkin_EXPORTED_LIBRARIES)
add_dependencies(line_segment_detector ${catkin_EXPORTED_LIBRARIES})
endif()
## Mark the nodelet library for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
install(TARGETS line_segment_detector
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(FILES nodelet_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
I am using ROS melodic on a NVIDIA Jetson Xavier NX.
I have been banging my head against this for a couple of days now and would greatly appreciate any help!
Asked by DuffRumkins on 2023-05-23 10:15:56 UTC
Comments