在NanoPi2上安装编译ROS中错误集锦

也是折腾了好久,大约将近两周,最终还是乖乖使用前辈们已经测试好的~

嵌入式系统版本:Debian jessie
ROS版本:ROS indigo
工具:
NanoPi2,网络。
ROS在linux的发行版中,对Ubuntu的支持最佳。,刚开始我用的是ubuntu-mate系统,装了一周各种bug,后来在一帖子上看到说友善的板子对Ubuntu-mate的支持不是很好,而且据有经验人士介绍,还是Debian比较稳定,毕竟已经有人用它测试过,之前opencv图像处理也是在它上面进行的。因此只好在官方提供的Debian系统上进行编译,官方的Debian系统是Jessie,但ROS对Debian的支持只是测试安装在Wheezy上,因此是否能在Jessie上成功编译完成,在我安装之前是不知道的,最终用了一周时间,解决了所有问题,将ROS成功编译在了Jessie上。
ROS至今已8年之久,但本人刚接触一个多月,在最后的三个版本Hydro、Indigo、Jade是相差不大的,,我选择了indigo版本。
过程笔记:
一 准备工作

1 在ros-latest.list上添加安装软件源的支持

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list'

2 设置密钥


wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -

由于自己之前重新刷过系统固件,开机的时候没插网线,出现此错误:

 ha.pool.sks-keyservers.net:Host not found

连接有线网络

NanoPi M1在加电开机前如果已正确的连接网线,则系统启动时会自动获取IP地址,如果没有连接网线、没有DHCP服务或是其它网络问题,则会导致获取IP地址失败,同时系统启动会因此等待约15~60秒的时间。

本来时间就不多,网络问题就废了一早上,也是醉了。。。

3 再更新源

sudo apt-get update

4 安装bootstrap依赖项,否则会在编译时提示缺少库而中断:

sudo apt-get install python-rosdep python-rosinstall-generator python-wstool build-essential

5 依赖配置程序初始化及更新:


sudo rosdep init

rosdep update

二 安装

1 创建工作空间

$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws

2 下载ROS源代码

下载ROS源程序,ROS有Desktop-Full、Desktop、ROS-Comm三个版本,ROS-Comm只含有ROS基本的功能包与必须的库文件,Desktop在ROS-Comm基础上添加了一些GUI工具,Desktop-Full在Desktop基础上又添加了2D/3D仿真、导航等工具,我安装了Desktop-Full版本

$ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-ros_comm-wet.rosinstall
$ wstool init -j8 src indigo-ros_comm-wet.rosinstall

下面是一段漫长的时间,网速好的话也需要进2个小时,才把所有源码下完,会占用5.5G的空间,如果中途中断,请用下面的命令继续:

wstool update -j 4 -t src

3 等源码下载完整后,进行依赖问题的解决:

rosdep install --from-paths src --ignore-src --rosdistro hydro -y -r --os=debian:wheezy

出现错误:
1)

the following packages could not have their rosdep keys resolved to system dependencies:
tf2_bullet:No definition of [bullet] for OS version [wheezy]

解决:What you can do to ignore the bullet rosdep key is providing an empty definition for it locally.

Create the file sudo gedit /etc/ros/rosdep/sources.list.d/10-local.list with contents:

yaml file:///etc/ros/rosdep/local.yaml

And create the filesudo gedit /etc/ros/rosdep/local.yamlwith contents:


bullet:
  debian:
    wheezy: []

Then executerosdep update and try again.

2)在sudo apt-get upgrade的时候,遇到:

E: Could not get lock /var/cache/apt/archives/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the download directory

解决:

sudo rm -rf /var/cache/apt/archives/lock
sudo apt-get upgrade

然后apt-get就恢复正常了。继而rosdep时apt: \Package <packagename> has no installation candidate的问题也得以解决~
如未解决:E: Package has no installation candidate
则:

# apt-get update
# apt-get upgrade
# apt-get install <packagename>

3) Could not open lock file/var/lib/dpkg/lock的解决方法
解决办法:

sudo rm -rf /var/lib/dpkg/lock   

sudo rm -rf /var/cache/apt/archives/lock   

sudo apt-get update  

然后运行sudo dpkg --configure -a重新配置

回家防止遗忘,写了备忘,请忽略(。。。。。注:未写完 下次从 sudo apt-get build-dep libbullet-dev开始,也许是这里rosdep install --from-paths src --ignore-src --rosdistro hydro -y -r --os=debian:wheezy 还有bug…..。)

后续:
4 还有一些其他的包需要安装,并用Checkinstall工具生成Debian程序包,首先安装Checkinstall:

mkdir ~/ros_catkin_ws/external_src

sudo apt-get install checkinstall

5 添加其他包的源支持:
(这个是教程上给的 ,但是后来我不得已放弃它了,因为用这个源并不行)

sudo sh -c \'echo "deb-src http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list\'

sudo sh -c \'echo "deb http://ftp.us.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list\'

sudo apt-get update

6 安装Bullet:

    cd ~/ros_catkin_ws/external_src

    mkdir backports

    cd backports

    sudo apt-get build-dep libbullet-dev

    sudo apt-get -b source libbullet-dev

    sudo dpkg -i *.deb

错误:1)执行 sudo apt-get build-dep libbullet-dev的时候报错:

试了好多次 sudo apt-get build-dep libbullet-dev 一直说是什么candidate version of package debhelper can’t satisfy version requirements,两天终于解决这个问题~~~莫名的欣喜感。毕竟是自己琢磨出来的。。。
解决方案:参照这篇文章
把之前教程里给的其他源的包支持替换为

# Testing repository - main, contrib and non-free branches
deb http://http.us.debian.org/debian testing main non-free contrib
deb-src http://http.us.debian.org/debian testing main non-free contrib

sudo apt-get update ,蓝后执行之前的步骤,终于正常了~先允许我缓口气。果然都是源惹得祸哪!

7 安装点云库(Point Cloud):

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-key 19274DEF

sudo echo "deb http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu maverick main" >> /etc/apt/sources.list

sudo apt-get update

sudo apt-get install libpcl-all

错误:1)bash: /etc/apt/sources.list: Permission denied
解决: sudo apt-get install libpcl1

8 安装3D模型库(Collade Dom)
注明:对于此依赖包安装过程中,共有三次 yes/no的选择,分别是 y /n /n。。。

 cd ~/ros_catkin_ws/external_src
 sudo apt-get install libboost-filesystem-dev libxml2-dev
 wget http://downloads.sourceforge.net/project/collada-dom/Collada%20DOM/Collada%20DOM%202.4/collada-dom-2.4.0.tgz
 tar -xzf collada-dom-2.4.0.tgz
 cd collada-dom-2.4.0
 cmake .
 sudo checkinstall make install

当问你是否有需要更改的地方时,选择序号2,”collada-dom” 改为”collada-dom-dev” ,否则,rosdep安装包不能找到它。

9 安装3D模拟器:

其中先要下载player,这里我没有用官网的方法,因为不知道怎么在板子上直接下载文件,于是参照上边的方法,网址是从这里得到
(这个与教程冲突挺多的,不过终于好了。。。)


cd ~/ros_catkin_ws/external_src
wget https://sourceforge.net/projects/playerstage/files/Player/3.0.2/player-3.0.2.tar.gz
tar -zxvf player-3.0.2.tar.gz
cd player-3.0.2
cmake .
make
sudo checkinstall make install 

错误
1)tar -xzf player-3.0.2.tar.gz出错:player-3.0.2.tar.gz:Cannot open: No such file or directory
解决

         tar -zxvf player-3.0.2.tar.gz

         tar -xzvf player-3.0.2.tar.gz

或者试试

2)执行 make的时候
a.unexpected unqualified-id before numeric constant boost::xtime_get(&xt,boost::TIME_UTC)
解决:在/usr/include/boost/thread/xtime.hpp文件里发现是TIME_UTC_,然后在/home/fa/ros_catkin_ws/external_src/player-3.0.2/client_libs/libplayerc++/playerclient.cc里把TIME_UTC改为TIME_UTC_
b. expected “;” before boost
解决:参照这篇博文(boost库初试) ,即是命名空间的问题在/home/fa/ros_catkin_ws/external_src/player-3.0.2/client_libs/libplayerc++/playerclient.cc里添加using namespace boost; 然后注释掉这三行

    //boost::xtime xt;
    //boost::xtime_get(&xt,boost::TIME_UTC_)
    //boost::thread::sleep(xt)

c. //usr/bin/ld:CMakefiles/playerc++_test.dir/test.o:undefined reference to …..
解决:实在蒙了,就重新下了player-3.0.1,再来一遍,就没有这个问题了。
d. file not recognized: File truncated
原因:意思是文件被中断了,可能是因为一些不当的文件被写进去了
解决:

   make clean
   make distclean
   make

e. ‘outb_p’ was not declared in this scope

 我先把这个所在的文件全部注释掉试试了。至少这里先通过编译了,查资料这里要用到c++类知识,简直是个渣,先跳过吧。      sphereptz.cc文件出现同样问题,依然先注释

f. linux videodev.h no such file or directory
sudo
apt-get install libv4l-dev

cd
/usr/include/linux

sudo
ln -s ../libv4l1-videodev.h videodev.h

编译错误:1)到console_bridge的时候退出
解决:$ cd ~/ros_catkin_ws/external_src

 sudo apt-get install libboost-system-dev libboost-thread-dev
 git clone https://github.com/ros/console_bridge.git
 cd console_bridge
 cmake .
 sudo checkinstall make install
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

穿着帆布鞋也能走猫步

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

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

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

打赏作者

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

抵扣说明:

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

余额充值