本文记录安装Apollo的踩坑记录,本人系统配置为:ubuntu 20.04.5,cuda 11.4;
一些apollo安装记录的博客:
首先Apollo预安装包括:
\
目录的存储空间加大,或者安装的时候直接把系统分区弄成\
(我分配了400G左右)和swap
(分配了10G左右)即可。不需要再细分成\boot
和\home
。这是我踩的第一个坑,最开始只给了\
50G,安装完之后ubuntu图形界面直接不显示了,只能重装系统。sudo apt install gcc g++ git vim curl make cmake gedit unzip cutecom can-utils net-tools -y
)如果网速不好或被qiang,建议docker和Nvidia Container Toolkit的安装过程中用**手机热点(**手机热点太关键了)。安装指令搬运在这,具体也可以参考这篇博客和apollo官网:
curl https://get.docker.com | sh
sudo systemctl start docker && sudo systemctl enable docker
docker安装好之后,将Docker加入super权限以及开机启动:
sudo groupadd docker
sudo usermod -aG docker $USER
之后logout再重新login,再继续执行以下命令
newgrp docker
以下步骤用于检测docker是否安装成功,如果正确会出现下图:
docker run hello-world
之后安装Nvidia Container Toolkit,如果网速不行,试试手机热点!
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get -y update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
update过程中可能会出现以下错误,
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_
train.so.8 is not a symbolic link
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn.so.8
is not a symbolic link
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_
infer.so.8 is not a symbolic link
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_
train.so.8 is not a symbolic link
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_
train.so.8 is not a symbolic link
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_
infer.so.8 is not a symbolic link
/sbin/ldconfig.real: /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_
infer.so.8 is not a symbolic link
解决方案:
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.0.1 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.0.1 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.0.1 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.0.1 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.0.1 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
sudo ln -sf /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.0.1 /usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
Apollo安装可以见官网guide,首先把apollo代码clone到本地,这里直接从gitee上clone即可(我用的HTTPS方式)。
# SSH
git clone [email protected]:ApolloAuto/apollo.git
# HTTPS
git clone https://gitee.com/ApolloAuto/apollo.git
克隆到本地之后,进入./apollo
目录,
sudo bash ./docker/scripts/dev_start.sh
这一步下载量比较大,如果非常慢的话可以把docker的源改为国内,将\etc\docker\daemon.json
文件改为以下:
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"registry-mirrors" : [
"https://mirror.ccs.tencentyun.com",
"http://registry.docker-cn.com",
"http://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
],
"debug" : true,
"experimental" : true
}
之后重新启动docker:
systemctl daemon-reload
systemctl restart docker
"runtimes"
这部分是安装完Nvidia Container Toolkit之后出现的,只需在后面加加上国内的源即可。如果出现下载中断,可以不停重启docker,但不建议连热点,一是费流量二是特别慢。(我至少重启了4次,都是因为qiang)
之后就是进入apollo对应的docker对apollo进行编译,这一步一开始可能会出现zlib
找不到的情况,再次运行编译指令问题就会消失。
sudo bash docker/scripts/dev_into.sh
root@in-dev-docker:/apollo#
运行以下指令进行编译:
sudo bash apollo.sh build
这一步还是非常顺利的。出现下面的提示说明安装成功!
(11:21:38) INFO: Elapsed time: 1188.489s, Critical Path: 336.32s
(11:21:38) INFO: 25392 processes: 17444 internal, 7948 local.
(11:21:38) INFO: Build completed successfully, 25392 total actions
==============================================
[ OK ] Done building apollo. Enjoy!
==============================================
首先,在docker中运行,并在浏览器中打开localhost:8888
root@in-dev-docker:/apollo $ bash scripts/bootstrap.sh
目的是开启Dreamview,如果打不开再次运行指令即可,参考该博客。
之后下载record包,指令如下:
cd /apollo/docs/demo_guide
python3 record_helper.py demo_3.5.record
之后将返回/apollo
下执行source cyber/setup.bash
,并运行以下指令:
cyber_recorder play -f demo_3.5.record --loop
选择地图:Sunnyvale loop
,之后Dreamview成功运行。
停止Dreamview可以用:
bash scripts/bootstrap.sh stop
退出容器:
root@in-dev-docker:/apollo# exit
系统重启之后再次打开Apollo,与上文类似,运行以下指令:
cd $APOLLO_DIREC$
sudo bash docker/scripts/dev_start.sh
sudo bash docker/scripts/dev_into.sh
root@in-dev-docker:/apollo# bash scripts/bootstrap.sh
root@in-dev-docker:/apollo# cd /apollo/docs/demo_guide
root@in-dev-docker:/apollo/docs/demo_guide# python3 record_helper.py demo_3.5.record
root@in-dev-docker:/apollo/docs/demo_guide# cd /apollo
root@in-dev-docker:/apollo# source cyber/setup.bash
root@in-dev-docker:/apollo# cd /apollo/docs/demo_guide
root@in-dev-docker:/apollo/docs/demo_guide# cyber_recorder play -f demo_3.5.record --loop
重新得到以上结果。
总之,Apollo的安装还算顺利,只要prerequisites和网速没问题就还算容易。