discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding external libs to an OOT block


From: David Cherkus
Subject: Adding external libs to an OOT block
Date: Tue, 22 Feb 2022 16:34:03 +0000 (UTC)

So, I found https://stackoverflow.com/questions/48562304/gnuradio-c-oot-extrernal-so-library which is a very good answer to how to get your OOT block to link to a shared library from another package.
As pointed out by the answer of Marcus Müller below I did not link properly. In fact one has to edit three different cmake files in three places to add an external dynamically loaded library (.so) to an OOT module in GNURadio. I try to explain briefly what to do:
  1. Put a find_package(LIBNAME) in the CMakeLists.txt in the base directory of the OOT module.
  2. Corresponding to that a FindLIBNAME.cmake file in the cmake module path is necessary. This file has the purpose to implement the search for include directories and library files (.so files).
  3. Once found the path to the library has to be used with target_link_libraries(...) in lib/CMakeLists.txt (linking).
  4. The include file path, i.e. LIBNAME.h has to be added as include directory using include_directories(...) in the CMakeLists.txt in the base directory of the module.
With ldd it is possible to find out if the external library is linked correctly.

ldd /usr/local/lib/YOURLIB.so
Am wondering if this is documented on the GNUradio web site?  I could use a bit more info, but will give it a go anyway.  I did the C++ tutorial ( https://wiki.gnuradio.org/index.php?title=Guided_Tutorial_GNU_Radio_in_C%2B%2B  ) and this was the very next thing I wanted to do, and I presume many others as well.   I know it's hard to know where to draw the line on teaching enough vs too much, but I think this is a pretty frequent use case, no?  Note that I am teaching myself cmake on the fly.  That's OK, I just taught myself enough C++ to understand the tutorial on the fly as well.

Regards,
Dave.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]