Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

[UNRELEASED]
============
* Restore ``whole-archive`` only on ouster_ros library to avoid double free corruption issue.
- The ``ouster_client`` library is now linked normally without whole-archive.
* Use ``add_compile_definitions`` instead of ``add_definitions`` to set the ``EIGEN_MPL2_ONLY`` flag.

ouster_ros v0.14.0
==================
Expand Down
48 changes: 36 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ find_package(tf2_eigen REQUIRED)
find_package(CURL REQUIRED)
find_package(Boost REQUIRED)
find_package(OpenCV REQUIRED)
# Use OpenCV libs varaible
if (NOT OpenCV_LIBS)
set(OpenCV_LIBS ${OpenCV_LIBRARIES})
endif()

find_package(
catkin REQUIRED
Expand All @@ -37,11 +41,12 @@ add_service_files(FILES GetConfig.srv SetConfig.srv GetMetadata.srv)
generate_messages(DEPENDENCIES std_msgs sensor_msgs geometry_msgs)

set(_ouster_ros_INCLUDE_DIRS
"include;"
"ouster-sdk/ouster_sensor/include;"
"ouster-sdk/ouster_client/include;"
"ouster-sdk/ouster_client/include/optional-lite;"
"ouster-sdk/ouster_pcap/include")
include
ouster-sdk/ouster_sensor/include
ouster-sdk/ouster_client/include
ouster-sdk/ouster_pcap/include
ouster-sdk/ouster_client/include/optional-lite
)

catkin_package(
INCLUDE_DIRS
Expand Down Expand Up @@ -81,7 +86,7 @@ include_directories(
${OpenCV_INCLUDE_DIRS})

# use only MPL-licensed parts of eigen
add_definitions(-DEIGEN_MPL2_ONLY)
add_compile_definitions(EIGEN_MPL2_ONLY)

set(NODELET_SRC
src/os_sensor_nodelet_base.cpp
Expand All @@ -100,9 +105,26 @@ if (BUILD_PCAP)
endif()

add_library(ouster_ros src/os_ros.cpp)

# in future replace with $<LINK_LIBRARY:WHOLE_ARCHIVE,${OUSTER_TARGET_LINKS}> (min cmake 3.24)
if (APPLE)
set(WHOLE_ARCHIVE_LINK -Wl,-force_load,$<TARGET_FILE:ouster_client>)
if (BUILD_PCAP)
list(APPEND WHOLE_ARCHIVE_LINK -Wl,-force_load,$<TARGET_FILE:ouster_pcap>)
endif()
else()
set(WHOLE_ARCHIVE_LINK -Wl,--whole-archive ${OUSTER_TARGET_LINKS} -Wl,--no-whole-archive)
endif()

target_link_libraries(ouster_ros
PUBLIC ${catkin_LIBRARIES} ouster_build OusterSDK::ouster_sensor pcl_common
PRIVATE ${OUSTER_TARGET_LINKS}
PUBLIC
pcl_common
ouster_build
OusterSDK::ouster_sensor
${catkin_LIBRARIES}
PRIVATE
${WHOLE_ARCHIVE_LINK}
${OpenCV_LIBS}
)

add_dependencies(ouster_ros ${PROJECT_NAME}_gencpp)
Expand All @@ -112,9 +134,8 @@ add_library(${PROJECT_NAME}_nodelets ${NODELET_SRC})
target_link_libraries(
${PROJECT_NAME}_nodelets
ouster_ros
${OUSTER_TARGET_LINKS} # Add this to ensure ouster_client is linked
${OpenCV_LIBS}
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
add_dependencies(${PROJECT_NAME}_nodelets ${PROJECT_NAME}_gencpp)

Expand All @@ -128,8 +149,11 @@ if(CATKIN_ENABLE_TESTING)
tests/point_transform_test.cpp
tests/point_cloud_compose_test.cpp
)
target_link_libraries(${PROJECT_NAME}_test ${catkin_LIBRARIES}
ouster_build pcl_common ${OUSTER_TARGET_LINKS})
target_link_libraries(${PROJECT_NAME}_test
ouster_ros
${catkin_LIBRARIES}
ouster_build
pcl_common)
endif()

# ==== Install ====
Expand Down
6 changes: 5 additions & 1 deletion src/lidar_packet_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

#include "lock_free_ring_buffer.h"
#include <optional>
#include <thread>
#include <chrono>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <vector>
#include <string>

namespace {

Expand Down
3 changes: 2 additions & 1 deletion src/os_sensor_nodelet.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
#include "ouster_ros/os_ros.h"
// clang-format on

#include <ouster/client.h>
#include <string>
#include <thread>
#include <atomic>
#include <optional>

#include <ouster/client.h>

#include "ouster_ros/GetConfig.h"
#include "ouster_ros/SetConfig.h"
#include "ouster_ros/PacketMsg.h"
Expand Down
Loading