A lot of times the dreaded 'Module Not Found' error is caused by linker
issues.

In 3.8, the cmake files were modernized, but there are a few caveats
especially if your OOT links against other GR modules (e.g. gr-digital).
In order to use GR modules in your code, the target_link_libraries needs to
specify the entire dependence.  For example, if you want to use functions
from gr-analog, your target_link_libraries needs to have
gnuradio::gnuradio-runtime gnuradio::gnuradio-fft gnuradio::gnuradio-filter
gnuradio::gnuradio-analog

You also have to specify the gnuradio components in the top level cmake
file.

Also make sure any external libraries are linked as well.

Take a look at these as well as there may be some clues:
https://wiki.gnuradio.org/index.php/GNU_Radio_3.8_OOT_Module_Porting_Guide
https://wiki.gnuradio.org/index.php/ModuleNotFoundError


On Sun, Jul 12, 2020 at 8:21 PM Nemanja Savic <vlasi...@gmail.com> wrote:

> Hi all,
>
> haven't been using GR and posting here for about 5 years. A few days ago I
> installed GR on my machine which runs under Manjaro. I wanted to port some
> of my old GR blocks (from 3.6.5) to the current GR version. I created a new
> module and started adding some blocks. Making module works just fine but
> when I want to use the blocks a python exception occurs saying my module
> doesn't have the attribute it needs. My block is called TPMS and the error
> is following:
>
> self.TPMS_min_max_threshold_detector_fb_0 =
> TPMS.min_max_threshold_detector_fb(samp_rate, 0.01)
> AttributeError: module 'TPMS' has no attribute
> 'min_max_threshold_detector_fb'
>
> I dont seem to understand why is this happening. Namely, under this path:
> /usr/lib/python3.8/site-packages/TPMS
> I can see TPMS_swig.py and within that file there is a class
> class min_max_threshold_detector_fb(object):
>
> It looks like something is wrong in the python but cant figure out what.
>
> sudo ld config didnt help.
>
> The output of cmake when preparing the block is following
>
> -- Build type not specified: defaulting to release.
> CMake Warning (dev) at
> /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272
> (message):
>   The package name passed to `find_package_handle_standard_args`
> (PkgConfig)
>   does not match the name of the calling package (GMP).  This can lead to
>   problems in calling code that expects `find_package` result variables
>   (e.g., `_FOUND`) to follow a certain pattern.
> Call Stack (most recent call first):
>   /usr/share/cmake-3.17/Modules/FindPkgConfig.cmake:45
> (find_package_handle_standard_args)
>   /usr/lib64/cmake/gnuradio/FindGMP.cmake:1 (include)
>   /usr/lib64/cmake/gnuradio/FindMPLIB.cmake:1 (find_package)
>   /usr/share/cmake-3.17/Modules/CMakeFindDependencyMacro.cmake:47
> (find_package)
>   /usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:26 (find_dependency)
>   CMakeLists.txt:88 (find_package)
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
> CMake Warning (dev) at
> /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272
> (message):
>   The package name passed to `find_package_handle_standard_args`
> (PkgConfig)
>   does not match the name of the calling package (MPIR).  This can lead to
>   problems in calling code that expects `find_package` result variables
>   (e.g., `_FOUND`) to follow a certain pattern.
> Call Stack (most recent call first):
>   /usr/share/cmake-3.17/Modules/FindPkgConfig.cmake:45
> (find_package_handle_standard_args)
>   /usr/lib64/cmake/gnuradio/FindMPIR.cmake:1 (include)
>   /usr/lib64/cmake/gnuradio/FindMPLIB.cmake:2 (find_package)
>   /usr/share/cmake-3.17/Modules/CMakeFindDependencyMacro.cmake:47
> (find_package)
>   /usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:26 (find_dependency)
>   CMakeLists.txt:88 (find_package)
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
> -- Checking for module 'mpir >= 3.0'
> --   Package 'mpir', required by 'virtual:world', not found
> -- Could NOT find MPIR (missing: MPIRXX_LIBRARY MPIR_INCLUDE_DIR)
> CMake Warning (dev) at
> /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272
> (message):
>   The package name passed to `find_package_handle_standard_args` (VOLK)
> does
>   not match the name of the calling package (Volk).  This can lead to
>   problems in calling code that expects `find_package` result variables
>   (e.g., `_FOUND`) to follow a certain pattern.
> Call Stack (most recent call first):
>   /usr/lib64/cmake/volk/VolkConfig.cmake:32
> (find_package_handle_standard_args)
>   /usr/share/cmake-3.17/Modules/CMakeFindDependencyMacro.cmake:47
> (find_package)
>   /usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:46 (find_dependency)
>   CMakeLists.txt:88 (find_package)
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
> -- User set python executable /usr/bin/python3
> -- Found PythonLibs: /usr/lib/libpython3.8.so (found suitable exact
> version "3.8.3")
> -- Using install prefix: /usr/local
> -- Building for version: v1.0-compat-xxx-xunknown / 1.0.0git
> -- No C++ unit tests... skipping
> --
> -- Checking for module SWIG
> -- Found SWIG version 4.0.1.
> -- Found PythonLibs: /usr/lib/libpython3.8.so (found version "3.8.3")
> -- Configuring done
> -- Generating done
> -- Build files have been written to:
> /home/user/work/gnuradio_module_test/gr-TPMS/build
>
> In the past I used Red Hat, this is my first time using a distro based on
> Arch Linux and I don't know if I am missing something regarding shared
> libraries.
>
> Best regards and thank you for your help
>

Reply via email to