Ubuntu20.04安装UHD及GUN Radio3.9

目录

1、安装UHD依赖库及UHD

 2、安装GNU Radio3.9.3


1、安装UHD依赖库及UHD

总结自:USRP Hardware Driver and USRP Manual: Building and Installing UHD from source 以及 Building and Installing the USRP Open-Source Toolchain (UHD and GNU Radio) on Linux - Ettus Knowledge Base

先安装依赖库:

 sudo apt-get -y install autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool fort77 g++ gir1.2-gtk-3.0 git gobject-introspection gpsd gpsd-clients inetutils-tools libasound2-dev libboost-all-dev libcomedi-dev libcppunit-dev libfftw3-bin libfftw3-dev libfftw3-doc libfontconfig1-dev libgmp-dev libgps-dev libgsl-dev liblog4cpp5-dev libncurses5 libncurses5-dev libpulse-dev libqt5opengl5-dev libqwt-qt5-dev libsdl1.2-dev libtool libudev-dev libusb-1.0-0 libusb-1.0-0-dev libusb-dev libxi-dev libxrender-dev libzmq3-dev libzmq5 ncurses-bin python3-cheetah python3-click python3-click-plugins python3-click-threading python3-dev python3-docutils python3-gi python3-gi-cairo python3-gps python3-lxml python3-mako python3-numpy python3-numpy-dbg python3-opengl python3-pyqt5 python3-requests python3-scipy python3-setuptools python3-six python3-sphinx python3-yaml python3-zmq python3-ruamel.yaml swig wget

======================== BUG ========================

如果安装依赖过程中出现一下错误:

The following packages have unmet dependencies:  libasound2-dev : Depends: libasound2 (= 1.2.2-2.1ubuntu2.4

可以执行以下命令解决:

sudo dpkg -P --force-depends libasound2 && sudo apt-get -f install

参考链接:

Bug #264534 “broken package: libasound2-dev” : Bugs : alsa-lib package : UbuntuOn a fully updated Hardy system, I cannot install libasound2-dev. apt-get reports the following:-----------------------------------------------$ apt-get install libasound2-devSome packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.Since you only requested a single operation it is extremely likely that the package ...https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/264534======================== END ========================

然后下载源代码:

git clone https://github.com/EttusResearch/uhd.git

或者在https://github.com/EttusResearch/UHD/tags里找到想要的版本下载后解压。

接着编译安装源代码,在源代码文件中依次输入以下命令:

cd uhd
cd host
mkdir build
cd build
# 如果想设置UHD的安装位置,则可使用-DCMAKE_INSTALL_PREFIX参数,如:cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../   默认的安装位置为/usr/local/lib
cmake ../   
make
make test # This step is optional
sudo make install

之后确认是否定义环境变量LD_LIBRARY_PATH,看该环境变量是否定义了包含安装了UHD的文件夹(若在上述步骤中使用cmake的默认参数,则此处默认为/usr/local/lib),并将该变量添加到.bashrc文件的后面:

#注意替换{your-prefix}为你的UHD的安装路径
export LD_LIBRARY_PATH={your-prefix}/lib:$LD_LIBRARY_PATH
例如:export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

然后是下载 UHD FPGA 镜像文件,当连接USRP时用来烧录

sudo uhd_images_downloader

卸载UHD的方法:

在cd到uhd/host/build文件中输入以下指令即可

sudo make uninstall

 2、安装GNU Radio3.9.3

首先是安装依赖:

总结自:UbuntuInstall - GNU Radio

(不同版本的Ubuntu所需的依赖不尽相同,其他版本的可查看上述链接):

GNU Radio3.8需要以下依赖

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

GNU Radio3.9 除了以上依赖外还需要安装以下依赖:

sudo apt install python3-matplotlib libsndfile1-dev

 然后必须先安装 volk 再安装 GNURadio,命令如下,顺序执行一般不会有问题:

cd
git clone --recursive https://github.com/gnuradio/volk.git
cd volk
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make
make test
sudo make install

接下来开始下载gnuradio的源码进行编译安装:

总结自:InstallingGR - GNU Radio

依次输入以下指令:

git clone https://github.com/gnuradio/gnuradio.git
cd gnuradio
git checkout maint-3.9
git submodule update --init --recursive
mkdir build
cd build
# 如果想设置GNU Radio的安装位置,则可使用-DCMAKE_INSTALL_PREFIX参数,默认的安装位置为/usr/local
cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
# 可在终端输入proc指令查询线程数,并替换下面命令中的n,如果直接-j,则只使用单线程
make -jn 
sudo make install
sudo ldconfig

======================== BUG ========================

如果安装依赖过程中出现一下错误:

CMake Error at CMakeLists.txt:344 (find_package):
  By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "pybind11",
  but CMake did not find one.

  Could not find a package configuration file provided by "pybind11" with any
  of the following names:

    pybind11Config.cmake
    pybind11-config.cmake

  Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
  "pybind11_DIR" to a directory containing one of the above files.  If
  "pybind11" provides a separate development package or SDK, be sure it has
  been installed.

可以执行以下命令解决:

sudo apt install pybind11-dev

======================= END ========================

与安装UHD类似,这里还需要在.bashrc文件中添加PYTHONPATH环境变量:

#注意替换{your-prefix}为你的UHD的安装路径
export PYTHONPATH={your-prefix}/lib/{Py-version}/dist-packages:{your-prefix}/lib/{Py-version}/site-packages:$PYTHONPATH
例如:export PYTHONPATH=/usr/local/lib/python3/dist-packages:/usr/local/lib/python3/site-packages:$PYTHONPATH

添加完之后还需要执行一次 sudo ldconfig就可以啦~

在命令行中执行以下指令就可以启动gnuradio的gui界面啦~

gnuradio-companion

初始界面如下:

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

地球被支点撬走啦

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

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

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

打赏作者

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

抵扣说明:

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

余额充值