Why does using a BehaviorTree.CPP in ROS2 cause the program to crash? #1032
Unanswered
YangKaiyun-a
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I used CMake version 3.22 to compile BehaviorTree.CPP and built a shared library named libbehaviortree_cpp.so using the following three commands:
mkdir build_releasecmake -S . -B build_releasecmake --build build_release --parallelThen, I copied the libbehaviortree_cpp.so library into my project, but the program crashed.
Later, I used Conan to compile the project. Since Conan requires CMake version 3.23 or higher, I upgraded CMake to version 4.1.2.
After that, I ran the following commands for the Conan build:
conan install . -s build_type=Release --build=missingcmake --preset conan-releasecmake --build --preset conan-releaseSimilarly, I obtained a shared library libbehaviortree_cpp.so, and this library did not cause any crashes when used in my project.
I find this very strange. I also noticed that the shared libraries generated by the two methods have different sizes — the first one is 2.3 MB, while the second one is 5.1 MB.
In addition, I compiled a third shared library using CMake 4.1.2 with the first method, and it also caused the program to crash.
My project is located at the following path.
Please note that it should be run on Ubuntu 22 and compiled using the system-provided Qt 5.15.3.
🔗 Project link: https://github.com/YangKaiyun-a/ros2_behaviortree_qt_demo.git
My Questions
1、In my project’s CMakeLists.txt, the library libbehaviortree_cpp.so is currently found using find_library() and linked with target_link_libraries().Can this be replaced with find_package() and ament_target_dependencies() instead?
2、Why does the library compiled with CMake 4.1.2 not cause the program to crash, while the one built with CMake 3.22 does?
3、Am I the only one encountering these issues?
4、If I don’t use Conan, what is the correct way to use this shared library properly in my project?
Beta Was this translation helpful? Give feedback.
All reactions