You need to add the following to your CMake files.
In the top level CMakeLists.txt:
Add the line:
find_package(Gnuradio COMPONENTS zeromq)
after the line:
find_package(Gnuradio "3.8" REQUIRED)
In lib/CMakeLists.txt:
Change the line:
target_link_libraries(gnuradio-xxx gnuradio::gnuradio-runtime)
to:
target_link_libraries(gnuradio-xxx gnuradio::gnuradio-runtime
ZeroMQ::ZeroMQ)
where "xxx" is your module name.
Ron
On 3/9/21 17:49, Ethan C wrote:
> (I am using gnuradio installed from the maint-3.8 branch of the github
> for reference)
>
> Hello, as the title states I am having trouble making custom zmq
> pub/sub message blocks for gnuradio. The problem I am having is when I
> include any code in the block that uses the zmq library (ie
> zmq::context_t) my flowgraph gives a "AttributeError: module 'pduzmq'
> has no attribute 'newzmq'". But if I remove use of the zmq library
> from the block, it builds and runs fine in my flowgraph.
>
> I have a c++ program outside of gnuradio that can use zmq fine. When I
> compile that program program I do it like so:
>
> $ g++ zmq.cpp -o zmq -lzmq
>
> This allows the c++ program to run. But when I compile it without the
> "-lzmq" flag there are a bunch of errors like "undefined references to
> 'zmq_errno'". Not entirely sure, but is this because my c++ program
> can't find the zmq library.
>
> So I'm thinking that the oot module building does not include the
> "-lzmq" flag and so it struggles to find the zmq library just like my
> c++ program. I have tried using '$ cmake -DCMAKE_CXX_FLAGS="-lzmq" ..'
> with the building process but it didn't help.
>
> I'm wondering if anyone has a better idea of what the problem might
> be, or how to use compiler flags with the gnuradio build process, thanks.
No comments:
Post a Comment