From 050c7e2dade8668b976244ff9c3960d87f4b6dbc Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 26 May 2026 12:30:09 +0200 Subject: [PATCH] rfnoc: move chdr_ctrl_xport::make() out of header GCC 16 eagerly instantiates std::_Sp_counted_ptr_inplace in every TU that includes chdr_ctrl_xport.hpp with the inline make() definition. This causes the destructor to be referenced in TUs that do not link against chdr_ctrl_xport.cpp (e.g. client_zero_test), resulting in undefined reference linker errors. Fix by moving make() from the inline header definition into the .cpp file, so std::make_shared is only instantiated where ~chdr_ctrl_xport() is also defined. --- .../include/uhdlib/rfnoc/chdr_ctrl_xport.hpp | 13 +----------- host/lib/rfnoc/chdr_ctrl_xport.cpp | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp index ad3994493..2d04fd5d4 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp @@ -49,18 +49,7 @@ public: size_t num_send_frames, size_t num_recv_frames, size_t send_frame_size, - disconnect_callback_t disconnect) - { - return std::make_shared(io_srv, - send_link, - recv_link, - pkt_factory, - my_epid, - num_send_frames, - num_recv_frames, - send_frame_size, - disconnect); - } + disconnect_callback_t disconnect); /*! * Make a chdr_ctrl_xport diff --git a/host/lib/rfnoc/chdr_ctrl_xport.cpp b/host/lib/rfnoc/chdr_ctrl_xport.cpp index c0b8840bc..4c513ff22 100644 --- a/host/lib/rfnoc/chdr_ctrl_xport.cpp +++ b/host/lib/rfnoc/chdr_ctrl_xport.cpp @@ -13,6 +13,27 @@ using namespace uhd::rfnoc; using namespace uhd::rfnoc::chdr; using namespace uhd::transport; +chdr_ctrl_xport::sptr chdr_ctrl_xport::make(io_service::sptr io_srv, + send_link_if::sptr send_link, + recv_link_if::sptr recv_link, + const chdr::chdr_packet_factory& pkt_factory, + sep_id_t my_epid, + size_t num_send_frames, + size_t num_recv_frames, + size_t send_frame_size, + disconnect_callback_t disconnect) +{ + return std::make_shared(io_srv, + send_link, + recv_link, + pkt_factory, + my_epid, + num_send_frames, + num_recv_frames, + send_frame_size, + disconnect); +} + chdr_ctrl_xport::chdr_ctrl_xport(io_service::sptr io_srv, send_link_if::sptr send_link, recv_link_if::sptr recv_link,