解决GNURadio自定义C++ OOT块-导入块时报错问题


前言

本文记录在 GNURadio 自定义 C++ OOT 块后导入块时报错 AttributeError: module 'myModule' has no attribute 'multDivSelect'


一、问题描述

参考官方教程 Creating C++ OOT with gr-modtool 创建自定义的 OOT块(OOT 模块是不存在于 GNU Radio 源代码树中的 GNU Radio 组件。全拼:Out-Of-Tree),运行时出现了如下报错:

Traceback (most recent call last):
  File "/home/gnep/GNURadio_test/test.py", line 189, in <module>
    main()
  File "/home/gnep/GNURadio_test/test.py", line 167, in main
    tb = top_block_cls()
  File "/home/gnep/GNURadio_test/test.py", line 129, in __init__
    self.myModule_multDivSelect_0 = myModule.multDivSelect(True)
AttributeError: module 'myModule' has no attribute 'multDivSelect'

在这里插入图片描述

二、解决方法

1、安装依赖

安装特定于你环境的依赖项(包括swig):
https://wiki.gnuradio.org/index.php/UbuntuInstall#Bionic_Beaver_.2818.04.29_through_Eoan_Ermine_.2819.10.29

我这里做的修改为:

sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy python3-gi python3-gi-cairo gir1.2-gtk-3.0 \
libcodec2-dev libgsm1-dev libusb-1.0-0 libusb-1.0-0-dev libudev-dev

2、配置环境变量

根据以下步骤配置 PYTHONPATH 和/或 LD_LIBRARY_PATH:https://wiki.gnuradio.org/index.php/ModuleNotFoundError

参考上面内容,我做的修改为:

export PYTHONPATH=/usr/lib/python3/dist-packages:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH

这里确定没问题可以将其写入 ~/.bahsrc 使其永久生效
在这里插入图片描述

3、重新编译及安装

cd /home/gnep/gr-customModule/build
cmake -DCMAKE_INSTALL_PREFIX=$(gnuradio-config-info --prefix) .. 
make
sudo make install
sudo ldconfig 

相关操作及打印信息如下:

gnep@Gnep:~/gr-myModule/build$ cmake -DCMAKE_INSTALL_PREFIX=$(gnuradio-config-info --prefix) 
  • 13
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

须尽欢~~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值