1

我用 C++ 在 GNU Radio 中开发了一个 Out of tree 块。我正在使用通过 <zmq.hpp> 库实现的 ZMQ 套接字通过两个线程传递数据。

当我尝试在 GNU Radio 伴侣中执行我的 OOT 块(pthread 块)时,它出现的是:AttributeError: 'module' object has no attribute 'pthread'。

Traceback (most recent call last): File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 161, in <module> main() File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 149, in main tb = top_block_cls() File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 116, in __init__ self.pthread_pthread_0 = pthread.pthread() AttributeError: 'module' object has no attribute 'pthread'

这些天我一直在尝试解决这个错误......我在 CMakeLists.txt 顶部的这一行中添加了 ZEROQM 一词:set(GR_REQUIRED_COMPONENTS RUNTIME ZEROMQ),但它仍然不起作用。

我在 github 中有我的块的 OOT 代码:https ://github.com/isaactd92/gr-pthread.git 。

我非常感谢在这个问题上的任何帮助。问候艾萨克。

4

1 回答 1

1

我解决了这个问题....线索在 CMakeLists.txt 中:

  1. 下载并安装数据包:https ://github.com/zeromq/cppzmq 。这将带来 zmq.hpp 库和 ZeroMQconfig.cmake
  2. 配置位于(${SOURCE_DIRECTORY}). 添加find_package(ZeroMQ)# Find gnuradio build dependencies.
  3. 配置位于 /lib 中的 CMakeLists.txt。在target_link_libraries包括 zmq。

正常构建您的 OOT 块,它将识别 zmq 套接字并消失问题:)

于 2020-10-05T17:40:23.550 回答