ros2_java
ros2_java copied to clipboard
Colcon build fails to undefined symbol: osrf_testing_tools_cpp
Greetings,
I followed the build instructions and got this error:
ld.lld: error: undefined symbol: osrf_testing_tools_cpp::memory_tools::on_unexpected_calloc(std::__ndk1::variant<std::__ndk1::function<void (osrf_testing_tools_cpp::memory_tools::MemoryToolsService&)>, std::__ndk1::function<void ()>, std::nullptr_t>)
>>> referenced by performance_test_fixture.cpp:57 (/home/x/ros2_android_ws/src/ros2/performance_test_fixture/src/performance_test_fixture.cpp:57)
>>> CMakeFiles/performance_test_fixture.dir/src/performance_test_fixture.cpp.o:(performance_test_fixture::PerformanceTest::SetUp(benchmark::State&))
ld.lld: error: undefined symbol: osrf_testing_tools_cpp::memory_tools::on_unexpected_malloc(std::__ndk1::variant<std::__ndk1::function<void (osrf_testing_tools_cpp::memory_tools::MemoryToolsService&)>, std::__ndk1::function<void ()>, std::nullptr_t>)
>>> referenced by performance_test_fixture.cpp:60 (/home/x/ros2_android_ws/src/ros2/performance_test_fixture/src/performance_test_fixture.cpp:60)
>>> CMakeFiles/performance_test_fixture.dir/src/performance_test_fixture.cpp.o:(performance_test_fixture::PerformanceTest::SetUp(benchmark::State&))
ld.lld: error: undefined symbol: osrf_testing_tools_cpp::memory_tools::on_unexpected_realloc(std::__ndk1::variant<std::__ndk1::function<void (osrf_testing_tools_cpp::memory_tools::MemoryToolsService&)>, std::__ndk1::function<void ()>, std::nullptr_t>)
>>> referenced by performance_test_fixture.cpp:63 (/home/x/ros2_android_ws/src/ros2/performance_test_fixture/src/performance_test_fixture.cpp:63)
>>> CMakeFiles/performance_test_fixture.dir/src/performance_test_fixture.cpp.o:(performance_test_fixture::PerformanceTest::SetUp(benchmark::State&))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/performance_test_fixture.dir/build.make:103: libperformance_test_fixture.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:160: CMakeFiles/performance_test_fixture.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< performance_test_fixture [0.90s, exited with code 2]
How should I resolve it?
I'm using ROS2 Humble, Ubuntu 22.04, Python 3.10.12. Android NDK r27b (27.1.12297006), Android 34 (I guess).
------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------
Build time: 2024-03-22 15:52:46 UTC
Revision: 650af14d7653aa949fce5e886e685efc9cf97c10
Kotlin: 1.9.22
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21.0.4 (Oracle Corporation 21.0.4+8-LTS-274)
OS: Linux 6.8.0-45-generic amd64
There is a similar build error here (on macOS): https://github.com/ros2/ros2/issues/1398
There is a plan B to use this: https://github.com/YasuChiba/ros2-android-build