1

I've developed an Out of tree block in GNU Radio with C++. I'm using the ZMQ sockets,which are implemented with the <zmq.hpp> library, to pass data through two threads.

When I try to execute my OOT block (pthread block) in GNU Radio companion, what it appears is: 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'

I've been trying to solve this error these days... I added in the top CMakeLists.txt the word ZEROQM in this line: set(GR_REQUIRED_COMPONENTS RUNTIME ZEROMQ), but it still doesn't work.

I have the OOT code of my block in github: https://github.com/isaactd92/gr-pthread.git.

I really appreciate any help in this issue. Regards Isaac.

  • 1
    Without a full error message and your full source code this will probably remain inanswerable. Somewhere, Python code is trying to access a python object or module called `pthread` (which indeed is a library), but it's not clear where that attempt happens. – Marcus Müller Sep 24 '20 at 17:20
  • Hi Marcus! I have the code of my OOT in this link of github...https://github.com/isaactd92/gr-pthread.git. I used gr_modtool to create a general C++ OOT block. – isaac mario tupac davila Sep 24 '20 at 18:00
  • And this is the complete error message: Traceback (most recent call last): File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py", line 161, in 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' – isaac mario tupac davila Sep 24 '20 at 18:01
  • 1
    edit your question to include that info, please! (also, use code formatting, for the error message, there's a button for that, when adding this to your question). Thanks! – Marcus Müller Sep 24 '20 at 18:45
  • Instead of marking every line as code separately, please copy and paste the error message and mark it as code *completely at once*. – Marcus Müller Sep 24 '20 at 20:30

1 Answers1

1

I resolved the problem.... The clue was in the CMakeLists.txt:

  1. Download and install the packet:https://github.com/zeromq/cppzmq. This will bring the zmq.hpp library and the ZeroMQconfig.cmake
  2. Configure the CMakeLists.txt located in the (${SOURCE_DIRECTORY}). Add find_package(ZeroMQ) in the # Find gnuradio build dependencies.
  3. Configure the CMakeLists.txt located in the /lib. In target_link_libraries includes zmq.

Build your OOT block as normal and It will recognize the zmq sockets and will disappear the problem :)