undefined reference to shm_open
-
下载https://github.com/osrf/ros2_java.git,参考https://www.guyuehome.com/41981编译报错,看起来一直是连接不到rt库,不知道如何解决,求助~
xxx:~/ros2_android_ws$ colcon build --packages-ignore cyclonedds rcl_logging_log4cxx rcl_logging_spdlog rosidl_generator_py rclandroid ros2_talker_android ros2_listener_android --cmake-args -DPYTHON_EXECUTABLE=${PYTHON3_EXEC} -DPYTHON_LIBRARY=${PYTHON3_LIBRARY} -DPYTHON_INCLUDE_DIR=${PYTHON3_INCLUDE_DIR} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DANDROID=ON -DANDROID_FUNCTION_LEVEL_LINKING=OFF -DANDROID_NATIVE_API_LEVEL=${ANDROID_TARGET} -DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME} -DANDROID_STL=c++_shared -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK} -DTHIRDPARTY=ON -DCOMPILE_EXAMPLES=OFF -DCMAKE_FIND_ROOT_PATH="${PWD}/install" -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop -DTHIRDPARTY_android-ifaddrs=FORCE
[0.316s] WARNING:colcon.colcon_core.package_discovery:ignoring unknown package 'cyclonedds' in --packages-ignore
[0.316s] WARNING:colcon.colcon_core.package_discovery:ignoring unknown package 'rcl_logging_log4cxx' in --packages-ignore
[0.352s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/opt/ros/noetic' in the environment variable CMAKE_PREFIX_PATH doesn't exist
Starting >>> ament_package
Starting >>> ament_lint
Starting >>> ament_cppcheck
Starting >>> gtest_vendor
Starting >>> fastcdr
Starting >>> osrf_testing_tools_cpp
Starting >>> osrf_pycommon
Starting >>> google_benchmark_vendor
Finished <<< fastcdr [0.58s]
Starting >>> ament_pycodestyle
Finished <<< gtest_vendor [0.63s]
Starting >>> gmock_vendor
Finished <<< osrf_testing_tools_cpp [0.84s]
Starting >>> test_osrf_testing_tools_cpp
Finished <<< google_benchmark_vendor [0.86s]
Finished <<< gmock_vendor [0.35s]
[1.516s] WARNING:colcon.colcon_cmake.task.cmake.build:Could not run installation step for package 'test_osrf_testing_tools_cpp' because it has no 'install' target
Finished <<< ament_cppcheck [1.08s]
Finished <<< test_osrf_testing_tools_cpp [0.23s]
Finished <<< ament_package [1.16s]
Starting >>> ament_cmake_core
Finished <<< osrf_pycommon [1.14s]
Finished <<< ament_lint [1.20s]
Starting >>> ament_flake8
Finished <<< ament_pycodestyle [0.77s]
Starting >>> ament_pyflakes
Finished <<< ament_cmake_core [0.42s]
Starting >>> ament_cmake_libraries
Starting >>> ament_cmake_export_libraries
Starting >>> ament_cmake_python
Starting >>> ament_cmake_include_directories
Starting >>> ament_cmake_export_definitions
Starting >>> ament_cmake_export_include_directories
Finished <<< ament_flake8 [0.77s]
Starting >>> ament_pep257
Finished <<< ament_pyflakes [0.78s]
Starting >>> ament_cmake_export_link_flags
Finished <<< ament_cmake_libraries [0.68s]
Finished <<< ament_cmake_export_libraries [0.69s]
Finished <<< ament_cmake_export_definitions [0.68s]
Finished <<< ament_cmake_python [0.70s]
Starting >>> ament_cmake_export_dependencies
Starting >>> ament_cmake_export_targets
Starting >>> ament_cmake_version
Finished <<< ament_cmake_include_directories [0.74s]
Starting >>> ament_cmake_test
Starting >>> ament_cmake_export_interfaces
Finished <<< ament_cmake_export_include_directories [0.75s]
Starting >>> ament_cmake_target_dependencies
Finished <<< ament_cmake_export_link_flags [0.60s]
Finished <<< ament_pep257 [0.80s]
Starting >>> ament_copyright
Starting >>> ament_mypy
Finished <<< ament_cmake_export_dependencies [0.57s]
Starting >>> test_interface_files
Finished <<< ament_cmake_version [0.81s]
Finished <<< ament_cmake_export_targets [0.85s]
Finished <<< ament_cmake_export_interfaces [0.81s]
Finished <<< ament_cmake_target_dependencies [0.82s]
Finished <<< ament_cmake_test [0.93s]
Starting >>> ament_cmake_gtest
Starting >>> ament_cmake_pytest
Starting >>> ament_lint_auto
Starting >>> ament_cmake_google_benchmark
Starting >>> ament_cmake_nose
Finished <<< test_interface_files [0.54s]
Finished <<< ament_mypy [0.92s]
Finished <<< ament_cmake_gtest [0.50s]
Finished <<< ament_copyright [0.98s]
Starting >>> ament_lint_cmake
Starting >>> ament_xmllint
Starting >>> ament_cmake_gen_version_h
Starting >>> ament_cpplint
Finished <<< ament_cmake_pytest [0.56s]
Finished <<< ament_lint_auto [0.56s]
Starting >>> ament_index_python
Starting >>> domain_coordinator
Finished <<< ament_cmake_nose [0.92s]
Starting >>> ament_cmake_gmock
Finished <<< ament_cmake_google_benchmark [1.32s]
Starting >>> ament_clang_format
Finished <<< ament_cmake_gen_version_h [0.84s]
Starting >>> ament_cmake
Finished <<< ament_index_python [1.30s]
Starting >>> launch
Finished <<< ament_lint_cmake [1.39s]
Starting >>> ament_cmake_lint_cmake
Finished <<< ament_xmllint [1.40s]
Finished <<< ament_cmake_gmock [0.99s]
Starting >>> rosidl_cli
Finished <<< ament_cpplint [1.43s]
Starting >>> tracetools_trace
Starting >>> tracetools_read
Finished <<< domain_coordinator [1.41s]
Starting >>> ament_clang_tidy
Finished <<< ament_clang_format [1.30s]
Starting >>> ament_pclint
Finished <<< ament_cmake [1.32s]
Starting >>> uncrustify_vendor
Finished <<< ament_cmake_lint_cmake [1.03s]
Starting >>> ament_cmake_copyright
Finished <<< launch [1.31s]
Starting >>> launch_xml
Finished <<< rosidl_cli [1.32s]
Starting >>> launch_yaml
Finished <<< tracetools_read [1.46s]
Finished <<< ament_clang_tidy [1.32s]
Starting >>> rpyutils
Starting >>> ament_cmake_auto
Finished <<< tracetools_trace [1.64s]
Starting >>> tracetools_launch
Finished <<< ament_pclint [1.31s]
Starting >>> ros2trace
Finished <<< uncrustify_vendor [1.33s]
Starting >>> ament_uncrustify
Finished <<< launch_xml [1.02s]
Finished <<< ament_cmake_copyright [1.29s]
Starting >>> ament_cmake_xmllint
Starting >>> ament_cmake_cppcheck
Finished <<< launch_yaml [1.12s]
Starting >>> ament_cmake_cpplint
Finished <<< ament_cmake_auto [0.93s]
Starting >>> ament_cmake_flake8
Finished <<< rpyutils [1.16s]
Starting >>> ament_cmake_pep257
Finished <<< tracetools_launch [1.14s]
Starting >>> launch_testing
Finished <<< ros2trace [1.05s]
Starting >>> ament_cmake_mypy
Finished <<< ament_uncrustify [1.03s]
Starting >>> ament_cmake_uncrustify
Finished <<< ament_cmake_xmllint [0.77s]
Finished <<< ament_cmake_cppcheck [0.79s]
Starting >>> foonathan_memory_vendor
Starting >>> tracetools_test
Finished <<< ament_cmake_cpplint [0.84s]
Starting >>> ament_cmake_clang_format
Finished <<< ament_cmake_flake8 [0.93s]
Starting >>> ament_cmake_clang_tidy
Finished <<< ament_cmake_pep257 [0.73s]
Starting >>> ament_cmake_pclint
Finished <<< foonathan_memory_vendor [0.44s]
Starting >>> fastrtps
Finished <<< ament_cmake_mypy [0.61s]
Finished <<< ament_cmake_uncrustify [0.56s]
Starting >>> ament_cmake_pycodestyle
Starting >>> ament_lint_common
Finished <<< launch_testing [0.96s]
Starting >>> ament_cmake_pyflakes
Finished <<< ament_cmake_clang_format [0.73s]
Starting >>> launch_pytest
Finished <<< ament_cmake_clang_tidy [0.55s]
Finished <<< ament_cmake_pclint [0.70s]
Finished <<< tracetools_test [1.04s]
Finished <<< ament_cmake_pycodestyle [0.65s]
Finished <<< ament_lint_common [0.63s]
Finished <<< ament_cmake_pyflakes [0.58s]
Starting >>> ament_cmake_ros
Starting >>> rosidl_adapter
Starting >>> rosidl_typesupport_interface
Starting >>> ament_java_resources
Starting >>> fastrtps_cmake_module
Starting >>> rmw_implementation_cmake
Finished <<< launch_pytest [0.97s]
Finished <<< rosidl_typesupport_interface [0.58s]
Starting >>> performance_test_fixture
Starting >>> ament_index_cpp
Finished <<< ament_java_resources [0.64s]
Finished <<< fastrtps_cmake_module [0.63s]
Starting >>> ament_build_type_gradle
Starting >>> python_cmake_module
Finished <<< ament_cmake_ros [0.73s]
Starting >>> tracetools
Finished <<< rmw_implementation_cmake [0.70s]
Starting >>> test_launch_testing
Finished <<< rosidl_adapter [1.12s]
Starting >>> rosidl_parser
Finished <<< performance_test_fixture [0.59s]
Finished <<< ament_index_cpp [0.61s]
Finished <<< python_cmake_module [0.67s]
Starting >>> launch_testing_ament_cmake
Finished <<< tracetools [0.68s]
Finished <<< test_launch_testing [0.69s]
Finished <<< ament_build_type_gradle [0.89s]
Starting >>> ament_cmake_export_jars
Starting >>> ament_cmake_export_jni_libraries
Finished <<< launch_testing_ament_cmake [0.46s]
Starting >>> rcutils
Finished <<< rosidl_parser [0.93s]
Starting >>> rosidl_cmake
Finished <<< ament_cmake_export_jni_libraries [0.57s]
Finished <<< ament_cmake_export_jars [0.63s]
Finished <<< rcutils [0.75s]
Starting >>> rosidl_runtime_c
Starting >>> rcpputils
Finished <<< rosidl_cmake [0.73s]
Starting >>> rcljava_common
Starting >>> rosidl_generator_dds_idl
--- stderr: fastrtps
+++++++++++++++++++++++++++++++++++++++ BOOST_ROOT PATH =
+++++++++++++++++++++++++++++++++++++++ BOOST_LIBRARYDIR PATH =
/usr/bin/ld: CMakeFiles/fastrtps.dir/rtps/writer/RTPSWriter.cpp.o: in functionboost::interprocess::shared_memory_object::priv_open_or_create(boost::interprocess::ipcdetail::create_enum_t, char const*, boost::interprocess::mode_t, boost::interprocess::permissions const&)': RTPSWriter.cpp:(.text._ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE[_ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE]+0xc1): undefined reference to
shm_open'
/usr/bin/ld: RTPSWriter.cpp:(.text._ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE[_ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE]+0xec): undefined reference toshm_open' /usr/bin/ld: RTPSWriter.cpp:(.text._ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE[_ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE]+0x1ff): undefined reference to
shm_open'
/usr/bin/ld: RTPSWriter.cpp:(.text._ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE[_ZN5boost12interprocess20shared_memory_object19priv_open_or_createENS0_9ipcdetail13create_enum_tEPKcNS0_6mode_tERKNS0_11permissionsE]+0x2b3): undefined reference toshm_open' /usr/bin/ld: CMakeFiles/fastrtps.dir/rtps/writer/RTPSWriter.cpp.o: in function
boost::interprocess::shared_memory_object::remove(char const*)':
RTPSWriter.cpp:(.text._ZN5boost12interprocess20shared_memory_object6removeEPKc[_ZN5boost12interprocess20shared_memory_object6removeEPKc]+0x6a): undefined reference toshm_unlink' /usr/bin/ld: CMakeFiles/fastrtps.dir/rtps/writer/RTPSWriter.cpp.o: in function
eprosima::fastdds::rtps::SharedSegment<boost::interprocess::basic_managed_shared_memory<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, unsigned int, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index>, boost::interprocess::shared_memory_object>::remove()':
RTPSWriter.cpp:(.text._ZN8eprosima7fastdds4rtps13SharedSegmentIN5boost12interprocess27basic_managed_shared_memoryIcNS4_15rbtree_best_fitINS4_12mutex_familyENS4_10offset_ptrIvjmLm0EEELm0EEENS4_10iset_indexEEENS4_20shared_memory_objectEE6removeEv[_ZN8eprosima7fastdds4rtps13SharedSegmentIN5boost12interprocess27basic_managed_shared_memoryIcNS4_15rbtree_best_fitINS4_12mutex_familyENS4_10offset_ptrIvjmLm0EEELm0EEENS4_10iset_indexEEENS4_20shared_memory_objectEE6removeEv]+0x91): undefined reference toshm_unlink' /usr/bin/ld: CMakeFiles/fastrtps.dir/rtps/writer/RTPSWriter.cpp.o: in function
void boost::interprocess::ipcdetail::managed_open_or_create_impl<boost::interprocess::shared_memory_object, 16ul, true, false>::priv_open_or_create<boost::interprocess::ipcdetail::create_open_func<boost::interprocess::ipcdetail::basic_managed_memory_impl<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, unsigned int, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index, 16ul> > >(boost::interprocess::ipcdetail::create_enum_t, char const* const&, unsigned long, boost::interprocess::mode_t, void const*, boost::interprocess::permissions const&, boost::interprocess::ipcdetail::create_open_func<boost::interprocess::ipcdetail::basic_managed_memory_impl<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, unsigned int, unsigned long, 0ul>, 0ul>, boost::interprocess::iset_index, 16ul> >)':
RTPSWriter.cpp:(.text.ZN5boost12interprocess9ipcdetail27managed_open_or_create_implINS0_20shared_memory_objectELm16ELb1ELb0EE19priv_open_or_createINS1_16create_open_funcINS1_25basic_managed_memory_implIcNS0_15rbtree_best_fitINS0_12mutex_familyENS0_10offset_ptrIvjmLm0EEELm0EEENS0_10iset_indexELm16EEEEEEEvNS1_13create_enum_tERKPKcmNS0_6mode_tEPKvRKNS0_11permissionsET[ZN5boost12interprocess9ipcdetail27managed_open_or_create_implINS0_20shared_memory_objectELm16ELb1ELb0EE19priv_open_or_createINS1_16create_open_funcINS1_25basic_managed_memory_implIcNS0_15rbtree_best_fitINS0_12mutex_familyENS0_10offset_ptrIvjmLm0EEELm0EEENS0_10iset_indexELm16EEEEEEEvNS1_13create_enum_tERKPKcmNS0_6mode_tEPKvRKNS0_11permissionsET]+0x14c): undefined reference toshm_open' /usr/bin/ld: RTPSWriter.cpp:(.text._ZN5boost12interprocess9ipcdetail27managed_open_or_create_implINS0_20shared_memory_objectELm16ELb1ELb0EE19priv_open_or_createINS1_16create_open_funcINS1_25basic_managed_memory_implIcNS0_15rbtree_best_fitINS0_12mutex_familyENS0_10offset_ptrIvjmLm0EEELm0EEENS0_10iset_indexELm16EEEEEEEvNS1_13create_enum_tERKPKcmNS0_6mode_tEPKvRKNS0_11permissionsET_[_ZN5boost12interprocess9ipcdetail27managed_open_or_create_implINS0_20shared_memory_objectELm16ELb1ELb0EE19priv_open_or_createINS1_16create_open_funcINS1_25basic_managed_memory_implIcNS0_15rbtree_best_fitINS0_12mutex_familyENS0_10offset_ptrIvjmLm0EEELm0EEENS0_10iset_indexELm16EEEEEEEvNS1_13create_enum_tERKPKcmNS0_6mode_tEPKvRKNS0_11permissionsET_]+0xad1): undefined reference to
shm_open'
/usr/bin/ld: RTPSWriter.cpp:(.text.ZN5boost12interprocess9ipcdetail27managed_open_or_create_implINS0_20shared_memory_objectELm16ELb1ELb0EE19priv_open_or_createINS1_16create_open_funcINS1_25basic_managed_memory_implIcNS0_15rbtree_best_fitINS0_12mutex_familyENS0_10offset_ptrIvjmLm0EEELm0EEENS0_10iset_indexELm16EEEEEEEvNS1_13create_enum_tERKPKcmNS0_6mode_tEPKvRKNS0_11permissionsET[ZN5boost12interprocess9ipcdetail27managed_open_or_create_implINS0_20shared_memory_objectELm16ELb1ELb0EE19priv_open_or_createINS1_16create_open_funcINS1_25basic_managed_memory_implIcNS0_15rbtree_best_fitINS0_12mutex_familyENS0_10offset_ptrIvjmLm0EEELm0EEENS0_10iset_indexELm16EEEEEEEvNS1_13create_enum_tERKPKcmNS0_6mode_tEPKvRKNS0_11permissionsET]+0x14c9): undefined reference to `shm_open'
collect2: error: ld returned 1 exit status
make[2]: *** [src/cpp/CMakeFiles/fastrtps.dir/build.make:3283: src/cpp/libfastrtps.so.2.8.2] Error 1
make[1]: *** [CMakeFiles/Makefile2:196: src/cpp/CMakeFiles/fastrtps.dir/all] Error 2
make: *** [Makefile:141: all] Error 2Failed <<< fastrtps [3.74s, exited with code 2]
Aborted <<< rcpputils [0.44s]
Aborted <<< rosidl_runtime_c [0.46s]
Aborted <<< rcljava_common [0.27s]
Aborted <<< rosidl_generator_dds_idl [0.40s]Summary: 96 packages finished [13.2s]
1 package failed: fastrtps
4 packages aborted: rcljava_common rcpputils rosidl_generator_dds_idl rosidl_runtime_c
1 package had stderr output: fastrtps
55 packages not processed