gnuradio安装指南——详解ubuntu16.04下使用脚本安装gnuradio&uhd全过程

来源:互联网 发布:c语言带小数点数字求和 编辑:程序博客网 时间:2024/05/16 10:09

一、下载篇

在ubuntu下安装gnuradio有很多方法,gnuradio官网中对不同下载安装方法进行了详细的说明
http://gnuradio.org/redmine/projects/gnuradio/wiki/InstallingGR
其中官网推荐在ubuntu下使用方法
apt-get install gnuradio
这种方法主要可以使用仿真的功能,对大多数用户来说已经足够了,但是博主考虑到今后有可能会根据需要修改一些关键代码等,所以决定Download From Source从源文件下载
http://gnuradio.org/redmine/projects/gnuradio/wiki/InstallingGRFromSource
转到网页发现从源文件下载安装也有好几种方法,综合对比还是选择比较简单的方法——Using the build-gnuradio script直接使用脚本进行下载和安装(会自动安装uhd),即使用命令
wget http://www.sbrac.org/files/build-gnuradio && chmod a+x build-gnuradio && ./build-gnuradio
运行脚本之前先切换到任意一个目录即可,最好建立一个单独的文件夹,需要联网,中途需要输入几次选择(y|Y|Yes|N之类的),所以比较漫长,博主尝试之后注意到chmod命令是需要加sudo的,没加的话会报错,所以上述命令改一下比较好
wget http://www.sbrac.org/files/build-gnuradio && sudo chmod a+x build-gnuradio && ./build-gnuradio

二、异常处理篇

这个脚本使用非常方便,它会自动检查依赖的文件是否具备,不具备的话会自动下载,所以基本不需要我们额外去做任何安装。如果中途提示有几个文件不能获取到,会提示最终构造出的gnuradio可能会存在某些问题,所以有条件的话可以根据提示自己先提前下载到这些不能自动下载的文件重新运行脚本。但是不下载也能继续往下执行,只是可能今后会有什么bug吧,暂时也不太清楚。
博主的脚本检测到两个不具备

Failed to find package 'python-wxgtk2.8' in known package repositoriesSOME THINGS MAY NOT BUILD AS A RESULTFailed to find package 'libzmq1-dev' in known package repositoriesSOME THINGS MAY NOT BUILD AS A RESULT

依赖检测执行完之后,脚本自动从Git下载缺少的依赖文件、gnuradio和uhd和image并构造,这段时间不能断网,而且用时很长,得耐心等待,基本上没什么问题。

三、测试篇

最后提示安装好了,并且提示设置python的路径环境变量(这个可以先不管,如果不行再添加就好)

You should probably set your PYTHONPATH to:     /usr/local/lib/python2.7/dist-packages

然后提示需要先登出系统再登录,所以可以注销后登录也可以重启,
然后运行声卡测试程序安装是否完成,进入声卡实例目录
cd /usr/local/share/gnuradio/examples/audio
然后查看对应目录下的文件
ls
显示如下
声卡测试图
运行dial_tone.py,即在终端输入
./dial_tone.py
显示如图
这里写图片描述
如果电脑声卡发出声音,那么恭喜你,说明PYTHONPATH的路径不用设置了,只需要输入Ctrl+C即可停止运行,如果这一步报错就需要定义环境变量PYTHONPATH路径,方法参考脚本源代码如下

if [ -d /usr/local/lib${type}/python${PYVER}/site-packages/gnuradio ]            then                PYTHONPATH=/usr/local/lib${type}/python${PYVER}/site-packages            fi            if [ -d /usr/local/lib${type}/python${PYVER}/dist-packages/gnuradio ]            then                PYTHONPATH=/usr/local/lib${type}/python${PYVER}/dist-packages            fi

博主的对应路径如下
这里写图片描述
所以设置成对应值即可(环境变量设置不会的话就百度一下)。
最后,输入
gnuradio-companion
就可以进入图形界面了
这里写图片描述
这里写图片描述
到此为止就实现了在ubuntu下使用脚本安装gnuradio了。

四、安装过程中的脚本输出结果

px@px-ThinkPad-T450:~$ cd Desktop/build-gnuradio/px@px-ThinkPad-T450:~/Desktop/build-gnuradio$ lspx@px-ThinkPad-T450:~/Desktop/build-gnuradio$ sudo wget http://www.sbrac.org/files/build-gnuradio && sudo chmod a+x build-gnuradio && ./build-gnuradio[sudo] password for px: --2016-10-09 22:03:47--  http://www.sbrac.org/files/build-gnuradioResolving www.sbrac.org (www.sbrac.org)... 67.212.80.242Connecting to www.sbrac.org (www.sbrac.org)|67.212.80.242|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 41528 (41K) [text/plain]Saving to: ‘build-gnuradio’build-gnuradio      100%[===================>]  40.55K  62.6KB/s    in 0.6s    2016-10-09 22:03:49 (62.6 KB/s) - ‘build-gnuradio’ saved [41528/41528]This script will install Gnu Radio from current GIT sourcesYou will require Internet access from the computer on which thisscript runs. You will also require SUDO access. You will requireapproximately 500MB of free disk space to perform the build.This script will, as a side-effect, remove any existing Gnu Radioinstallation that was installed from your Linux distribution packages.It must do this to prevent problems due to interference betweena linux-distribution-installed Gnu Radio/UHD and one installed from GIT source.The whole process may take up to two hours to complete, depending on thecapabilities of your system.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE: if you run into problems while running this script, you can re-run it withthe --verbose option to produce lots of diagnostic output to help debug problems.This script has been written to anticipate some of the more common problems one mightencounter building ANY large, complex software package. But it is not pefect, andthere are certainly some situations it could encounter that it cannot deal withgracefully. Altering the system configuration from something reasonably standard,removing parts of the filesystem, moving system libraries around arbitrarily, etc,it likely cannot cope with. It is just a script. It isn't intuitive or artificiallyintelligent. It tries to make life a little easier for you, but at the end of the dayif it runs into trouble, a certain amount of knowledge on your part aboutsystem configuration and idiosyncrasies will inevitably be necessary.Proceed?yStarting all functions at: Sun Oct 9 22:03:50 CST 2016SUDO privileges are requiredDo you have SUDO privileges?yContinuing with scriptInstalling prerequisites.====> THIS MAY TAKE QUITE SOME TIME <=====Checking for package libqwt6Checking for package libfontconfig1-devChecking for package libxrender-devChecking for package libpulse-devChecking for package swigChecking for package g++Checking for package automakeChecking for package autoconfChecking for package libtoolChecking for package python-devChecking for package libfftw3-devChecking for package libcppunit-devChecking for package libboost-all-devChecking for package libusb-devChecking for package libusb-1.0-0-devChecking for package fort77Checking for package libsdl1.2-devChecking for package python-wxgtk2.8Failed to find package 'python-wxgtk2.8' in known package repositoriesSOME THINGS MAY NOT BUILD AS A RESULTChecking for package git-coreChecking for package libqt4-devChecking for package python-numpyChecking for package ccacheChecking for package python-openglChecking for package libgsl0-devChecking for package python-cheetahChecking for package python-makoChecking for package python-lxmlChecking for package doxygenChecking for package qt4-defaultChecking for package qt4-dev-toolsChecking for package libusb-1.0-0-devChecking for package libqwt5-qt4-devChecking for package libqwtplot3d-qt4-devChecking for package pyqt4-dev-toolsChecking for package python-qwt5-qt4Checking for package cmakeChecking for package git-coreChecking for package wgetChecking for package libxi-devChecking for package python-docutilsChecking for package gtk2-engines-pixbufChecking for package r-base-devChecking for package python-tkChecking for package liborc-0.4-0Checking for package liborc-0.4-devChecking for package libasound2-devChecking for package python-gtk2Checking for package libzmqChecking for package libzmq-devChecking for package libzmq1Checking for package libzmq1-devFailed to find package 'libzmq1-dev' in known package repositoriesSOME THINGS MAY NOT BUILD AS A RESULTChecking for package python-requestsChecking for package python-sphinxChecking for package comedi-devChecking for package python-zmqChecking for package libncurses5Checking for package libncurses5-devChecking for package python-wxgtk3.0Done checking packagesChecking for library libusb ...Found library libusbChecking for library libboost ...Found library libboostChecking for library libcppunit ...Found library libcppunitChecking for library libfftw ...Found library libfftwChecking for library libgsl ...Found library libgslDoneThis script will fetch Gnu Radio version 3.7/maint from the repositories, along with compatibleextras.Is this OK?yFetching various packages (Gnu Radio, UHD, gr-osmosdr, gr-iqbal, etc)via the Internet=======> THIS MAY TAKE QUITE SOME TIME <=========Fetching Gnu Radio via GIT...DoneFetching UHD via GIT...Fetching rtl-sdr (rtl-sdr, gr-osmosdr, gr-iqbal, hackrf, bladeRF and airspy) via GITDoneStarting function uhd_build at: Sun Oct 9 22:19:20 CST 2016Building UHD...=============> THIS WILL TAKE SOME TIME <=============Done building/installing UHDDone function uhd_build at: Sun Oct 9 22:41:51 CST 2016Starting function firmware at: Sun Oct 9 22:41:51 CST 2016Images destination:      /usr/local/share/uhd/imagesDownloading images from: http://files.ettus.com/binaries/images/uhd-images_003.010.000.000-36-g967897e0.zipDownloading images to:   /tmp/tmpIPdGH_/uhd-images_003.010.000.000-36-g967897e0.zip59860 kB / 59860 kB (100%)Images successfully installed to: /usr/local/share/uhd/imagesDone function firmware at: Sun Oct 9 22:42:33 CST 2016Starting function gnuradio_build at: Sun Oct 9 22:42:33 CST 2016/usr/local/lib already in ld.so.conf.dDoing ldconfig...Building Gnu Radio...=========> THIS WILL TAKE QUITE A WHILE <=============...Doing cmake...Cmaking...Building...InstallingDone building and installing Gnu RadioGRC freedesktop icons install ...DoneDone function gnuradio_build at: Mon Oct 10 00:03:17 CST 2016Starting function rtl_build at: Mon Oct 10 00:03:17 CST 2016Building rtl-sdr...Done building rtl-sdrBuilding hackrf...Done building hackrfBuilding gr-iqbal...Done building gr-iqbalBuilding bladeRF...Done building bladeRFDone building airspyBuilding gr-osmosdr...Done building gr-osmosdrDone building/installing rtl-sdr/gr-osmosdrDone function rtl_build at: Mon Oct 10 00:06:15 CST 2016Starting function mod_groups at: Mon Oct 10 00:06:15 CST 2016********************************************************************************This script has just modified /etc/group to place your userid '('$USER')' into group 'usrp'In order for this change to take effect, you will need to log-out and log backin again.  You will not be able to access your USRP1 device until you do this.If you wish to allow others on your system to use the USRP1 device, you will need to use:  sudo usermod -a -G usrp useridFor each userid you wish to allow access to the usrp********************************************************************************Further Done function mod_groups at: Mon Oct 10 00:06:16 CST 2016Starting function mod_udev at: Mon Oct 10 00:06:16 CST 2016udevd: no process foundDone function mod_udev at: Mon Oct 10 00:06:16 CST 2016Starting function mod_sysctl at: Mon Oct 10 00:06:16 CST 2016Applying updates to /etc/sysctl.confGroup 'usrp' now has real-time scheduling privilegesYou will need to log-out and back in again for this totake effectDone function mod_sysctl at: Mon Oct 10 00:06:16 CST 2016Starting function pythonpath at: Mon Oct 10 00:06:16 CST 2016************************************************************You should probably set your PYTHONPATH to:     /usr/local/lib/python2.7/dist-packagesUsing:export PYTHONPATH=/usr/local/lib/python2.7/dist-packagesin your .bashrc or equivalent file prior to attempting to runany Gnu Radio applications or Gnu Radio Companion.*************************************************************Done function pythonpath at: Mon Oct 10 00:06:16 CST 2016Starting function extras at: Mon Oct 10 00:06:16 CST 2016Done function extras at: Mon Oct 10 00:06:16 CST 2016Done all functions at: Mon Oct 10 00:06:16 CST 2016All Done=======================================================================If you have found this script useful and time-saving, consider a donation to help me keep build-gnuradio, simple_ra, SIDsuite,meteor_detector, simple_fm_rcv, and multimode maintained and up to date.A simple paypal transfer to mleech@ripnet.com is all you need to do.======================================================================Send success/fail info to sbrac.org?npx@px-ThinkPad-T450:~/Desktop/build-gnuradio$ 
2 0
原创粉丝点击