Open Fixstars-momoko opened 1 week ago
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
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。
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
built on ros2 environment https://github.com/fixstars/ion-kit/pull/334
-- 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
@xinyuli1204 Thanks for the investigation. Is this fix compatible with multiple/different version of ROS2 which may link different version of spdlog?
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
byset_level
, and we can test the change of thespdlog: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.