Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault caused by conflict between ion-kit and ROS Client Library in spdlog usage #331

Open
Fixstars-momoko opened this issue Oct 9, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Fixstars-momoko
Copy link
Contributor

A segmentation occurs at the end of a program when using ion-kit with the rcl in a C++ environment.

Both ion-kit and rcl utilize the spdlog::logger class and this caused ion-kit tries to access the logger instance after rcl cleans it up.

Tentatively we disabled the use of spdlog::logger by set_level, and we can test the change of the spdlog:logger in ion-kit to a local instance to avoid this conflict. Further testing is required to confirm if this solution effectively resolves this issue.

@Fixstars-momoko Fixstars-momoko added the bug Something isn't working label Oct 9, 2024
@xinyuli1204
Copy link
Contributor

xinyuli1204 commented Oct 10, 2024

Summary

ion-kit and rclcpp use differing versions of spdlog, and I think it is the reason causing a segfault in program since the segmentfault doesn't happen when I don't link against ion-kit

ros2 spdlog

It looks like the ros2 logger [compiles against the system's version of spdlog]

(https://github.com/ros2/rcl_logging/blob/fc3a6f37ada01d21242eb146d1f7715a1f1e6a00/rcl_logging_spdlog/CMakeLists.txt#L17), and I think it should be the same in ion-kit。

Fix

Use (or add the option to use) the system version of spdlog in cmake. if can not found the system spdlog use our own spdlog

#334

@xinyuli1204
Copy link
Contributor

xinyuli1204 commented Oct 10, 2024

built on ros2 environment #334

@xinyuli1204
Copy link
Contributor

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Halide 'host' platform triple:   x86-64-linux
-- Halide 'cmake' platform triple:  x86-64-linux
-- Halide default AOT target:       host
-- Could not find nvcc, please set CUDAToolkit_ROOT.
-- Version: v3.2.1-2-g2782713
-- Found system spdlog
Skip building "fpga"
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37") 
Skip building "llm"
-- Configuring done
-- Generating done
-- Build files have been written to: /ion-kit/build

@iitaku
Copy link
Collaborator

iitaku commented Oct 11, 2024

@xinyuli1204 Thanks for the investigation. Is this fix compatible with multiple/different version of ROS2 which may link different version of spdlog?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants