问题
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:
I resolved the problem.... The clue was in the CMakeLists.txt:
- Download and install the packet:https://github.com/zeromq/cppzmq. This will bring the zmq.hpp library and the ZeroMQconfig.cmake
- Configure the CMakeLists.txt located in the
(${SOURCE_DIRECTORY})
. Addfind_package(ZeroMQ)
in the# Find gnuradio build dependencies
. - 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 :)
来源:https://stackoverflow.com/questions/64050775/gnu-radio-oot-block-attributeerror-module-object-has-no-attribute-pthread