3

I try to compile an OOT module for GNURadio, which uses an external device driver (LimeSuite.h) as a dynamically linked shared object (.so file). After adding

find_package(LimeSuite)

and the corresponding module under cmake/Modules (cf. https://github.com/kit-cel/gr-dab/blob/working_branch/cmake/Modules/FindFaad.cmake), I was able to compile with make and I observed, that the following variables changed.

CMAKE_CXX_FLAGS=-lLimeSuite
LIMESUITE_FOUND=1
LIMESUITE_FOUND=1
LIMESUITE_INCLUDE_DIR=/usr/include
LIMESUITE_INCLUDE_DIRS=/usr/include
LIMESUITE_LIBRARIES=/usr/lib/x86_64-linux-gnu/libLimeSuite.so
LIMESUITE_LIBRARY=/usr/lib/x86_64-linux-gnu/libLimeSuite.so

However as soon as I use the library in my code I get the following error when I try to instantiate the python object.

AttributeError: 'module' object has no attribute 'limesdr_source'

As soon as I remove the C++ code using the library from the implementation part of the block, the instantiation works again. I do not receive any error reports executing make. How can this be? Any idea how to debug this further?

EDIT:

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

1 Answer 1

3

You probably forgot to add the limesuite object files to the actually linked libraries in lib/CMakeLists.txt.

Anyway, I see zero good reasons why you should link against limesuite in an OOT that is concerned with DAB+ and pretty much hardware agnostic. Instead, encapsulate your lime interfacing in a block in your own OOT! GNU Radio is designed to be a block-connecting framework, so that you don't have to link your signal processing block code against your hardware interfacing driver.

Generating your own OOT should be very easy, indeed: https://tutorials.gnuradio.org

1
  • Thanks. It was exactly that. I did not link correctly.
    – m3x1m0m
    Feb 3, 2018 at 10:32

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.