Skip to content

Commit 886485a

Browse files
ryanvolzmormj
authored andcommitted
runtime: Move block_gateway from gnuradio-runtime into gr_python
This eliminates the need to link gnuradio-runtime with Python and fixes segfaults on conda+macOS when trying to use any Python block. Those segfaults would happen because the Python library was loaded twice: once dynamically from linking with gnuradio-runtime, and once from the running Python interpreter which conda-forge links statically with libpython. The block_gateway was only used from its Python binding, so the implementation now just lives there. This is an API change! Signed-off-by: Ryan Volz <[email protected]>
1 parent 72c4b02 commit 886485a

File tree

9 files changed

+273
-322
lines changed

9 files changed

+273
-322
lines changed

cmake/Modules/GrPybind.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ macro(GR_PYBIND_MAKE_CHECK_HASH name updir filter files)
181181
${name}_python
182182
PRIVATE
183183
${pybind11_INCLUDE_DIR}/pybind11/pybind11.h
184-
${pybind11_INCLUDE_DIR}/pybind11/embed.h
185184
${pybind11_INCLUDE_DIR}/pybind11/complex.h
186185
${pybind11_INCLUDE_DIR}/pybind11/operators.h
187186
${pybind11_INCLUDE_DIR}/pybind11/stl.h)

gnuradio-runtime/CMakeLists.txt

+8-20
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,14 @@ find_package(spdlog CONFIG)
2828
# Register component
2929
########################################################################
3030
include(GrComponent)
31-
if(ENABLE_PYTHON)
32-
gr_register_component(
33-
"gnuradio-runtime"
34-
ENABLE_GNURADIO_RUNTIME
35-
Boost_FOUND
36-
PYTHONINTERP_FOUND
37-
MPLIB_FOUND
38-
spdlog_FOUND
39-
pybind11_FOUND
40-
Volk_FOUND)
41-
else()
42-
gr_register_component(
43-
"gnuradio-runtime"
44-
ENABLE_GNURADIO_RUNTIME
45-
Boost_FOUND
46-
PYTHONINTERP_FOUND
47-
MPLIB_FOUND
48-
spdlog_FOUND
49-
Volk_FOUND)
50-
endif()
31+
gr_register_component(
32+
"gnuradio-runtime"
33+
ENABLE_GNURADIO_RUNTIME
34+
Boost_FOUND
35+
PYTHONINTERP_FOUND
36+
MPLIB_FOUND
37+
spdlog_FOUND
38+
Volk_FOUND)
5139

5240
get_filename_component(GNURADIO_RUNTIME_PYTHONPATH ${PROJECT_SOURCE_DIR}/python ABSOLUTE)
5341
########################################################################

gnuradio-runtime/include/gnuradio/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ install(
1717
basic_block.h
1818
block.h
1919
block_detail.h
20-
block_gateway.h
2120
block_registry.h
2221
buffer.h
2322
buffer_double_mapped.h

gnuradio-runtime/include/gnuradio/block_gateway.h

-121
This file was deleted.

gnuradio-runtime/lib/CMakeLists.txt

-14
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ add_library(
9494
vmcircbuf_prefs.cc
9595
vmcircbuf_sysv_shm.cc)
9696

97-
if(ENABLE_PYTHON)
98-
target_sources(gnuradio-runtime PRIVATE block_gateway_impl.cc)
99-
endif()
100-
10197
# Messages
10298
target_sources(
10399
gnuradio-runtime
@@ -130,18 +126,8 @@ target_link_libraries(
130126
Boost::thread
131127
spdlog::spdlog
132128
MPLib::mplib
133-
# INTERFACE/PRIVATE split so users of the library can choose how to link to Python
134-
# (importantly, extension modules can avoid linking against Python and resolve
135-
# their own Python symbols at runtime through the Python interpreter's linking)
136129
PRIVATE libunwind::libunwind)
137130

138-
if(ENABLE_PYTHON)
139-
target_link_libraries(
140-
gnuradio-runtime
141-
INTERFACE Python::Module
142-
PRIVATE Python::Python pybind11::pybind11)
143-
endif()
144-
145131
# Address linker issues with std::filesystem on Centos 8 and Debian
146132
target_link_libraries(
147133
gnuradio-runtime

gnuradio-runtime/lib/block_gateway_impl.cc

-73
This file was deleted.

gnuradio-runtime/lib/block_gateway_impl.h

-85
This file was deleted.

0 commit comments

Comments
 (0)