Bug:Boost: Use shlibs instead of header-only for call_stack::top_
This symbol is defined as a static member object inside of a boost detail header. When boost headers are used in a project that uses Boost in both the main binary as well as dlopen()'d shlibs, the top_ symbol gets duplicated and the metadata gets partitioned. We use the Boost shlib to unify both the main binary and the shlibs to use the same memory address for top_. This involves marking the templated object call_stack::top_ as "extern" and then declaring to Boost that we intend to use the shlibs.
This commit is contained in:
@@ -11,3 +11,8 @@ target_include_directories(attachmentSupport PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
target_link_libraries(attachmentSupport PUBLIC
|
||||
Boost::system
|
||||
Boost::log
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <iostream>
|
||||
#include <config.h>
|
||||
#include <componentThread.h>
|
||||
@@ -43,9 +44,6 @@ void StimulusBuffer::stop()
|
||||
|
||||
void StimulusBuffer::scheduleNextTimeout(int delayMs)
|
||||
{
|
||||
std::cout << __func__ << ": being executed on thread "
|
||||
<< smoHooksPtr->ComponentThread_getSelf()->name << std::endl;
|
||||
|
||||
if (!shouldContinue.load())
|
||||
{ return; }
|
||||
|
||||
@@ -60,8 +58,6 @@ std::cout << __func__ << ": being executed on thread "
|
||||
|
||||
void StimulusBuffer::onTimeout(const boost::system::error_code& error)
|
||||
{
|
||||
std::cout << __func__ << ": being executed on thread "
|
||||
<< smoHooksPtr->ComponentThread_getSelf()->name << std::endl;
|
||||
// Timer was cancelled, which is expected when stopping
|
||||
if (error == boost::asio::error::operation_aborted) {
|
||||
return;
|
||||
|
||||
@@ -13,7 +13,14 @@ if(ENABLE_LIB_livoxProto1)
|
||||
# Set config define for header generation
|
||||
add_compile_definitions(CONFIG_LIB_LIVOXPROTO1_ENABLED)
|
||||
target_include_directories(livoxProto1 PUBLIC ${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries(livoxProto1 ${Boost_LIBRARIES})
|
||||
target_link_libraries(livoxProto1 PUBLIC Boost::system Boost::log)
|
||||
|
||||
# Verify Boost dynamic dependencies after build
|
||||
add_custom_command(TARGET livoxProto1 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -DVERIFY_FILE="$<TARGET_FILE:livoxProto1>"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/VerifyBoostDynamic.cmake
|
||||
COMMENT "Verifying Boost dynamic dependencies for livoxProto1"
|
||||
)
|
||||
|
||||
# Install rules
|
||||
install(TARGETS livoxProto1 DESTINATION lib)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef BROADCAST_LISTENER_H
|
||||
#define BROADCAST_LISTENER_H
|
||||
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef LIVOX_PROTO1_DEVICE_H
|
||||
#define LIVOX_PROTO1_DEVICE_H
|
||||
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <stdexcept>
|
||||
#include <callback.h>
|
||||
#include <boost/asio/posix/stream_descriptor.hpp>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef LIVOXPROTO1_H
|
||||
#define LIVOXPROTO1_H
|
||||
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef LIVOXPROTO1_PROTOCOL_H
|
||||
#define LIVOXPROTO1_PROTOCOL_H
|
||||
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef UDP_COMMAND_DEMUXER_H
|
||||
#define UDP_COMMAND_DEMUXER_H
|
||||
|
||||
#include <boostAsioLinkageFix.h>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <boost/asio/posix/stream_descriptor.hpp>
|
||||
|
||||
Reference in New Issue
Block a user