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:
- Put a find_package(LIBNAME) in the CMakeLists.txt in the base directory of the OOT module.
- 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).
- Once found the path to the library has to be used with target_link_libraries(...) in lib/CMakeLists.txt (linking).
- 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