ubuntu 18.04安装carla (完整编译安装)

https://carla.readthedocs.io/en/latest/build_linux/

0.端口配置

iptables -I INPUT -p tcp --dport 2000 -j ACCEPT
iptables -I INPUT -p tcp --dport 2001 -j ACCEPT
iptables-save

1.安装基础依赖:

sudo apt-get update &&
sudo apt-get install wget software-properties-common &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - &&
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" &&
sudo apt-get update

2.安装ubuntu18.04需要的依赖

sudo apt-get install build-essential clang-8 lld-8 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync libxml2-dev &&
pip2 install --user setuptools &&
pip3 install --user -Iv setuptools==47.3.1 &&
pip2 install --user distro &&
pip3 install --user distro

3.统一clang和LLVM's libc++版本

sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-8/bin/clang++ 180 &&
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-8/bin/clang 180

4.注册github账号并下载git

5.注册unreal engine账号,并与github账号关联

6.安装Unreal Engine 4.24

git clone --depth=1 -b 4.24 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine-4.24

cd ~/UnrealEngine-4.24

wget https://carla-releases.s3.eu-west-3.amazonaws.com/Linux/UE_Patch/430667-13636743-patch.txt 430667-13636743-patch.txt

patch --strip=4 < 430667-13636743-patch.txt

./Setup.sh && ./GenerateProjectFiles.sh && make

cd ~/UnrealEngine-4.24/Engine/Binaries/Linux && ./UE4Editor

7.安装aria2加快carla的安装

sudo apt-get install aria2

8.克隆carla

git clone https://github.com/carla-simulator/carla  #建议使用Gitee加速下载

9.执行安装

cd ~/carla

./Update.sh

10.添加环境变量到~/.bashrc

export UE4_ROOT=~/UnrealEngine-4.24

11.编译carla(cmake的版本最好大于3.12,我用的 cmake 3.17.5)

客户端:make PythonAPI

(遇到错误:fatal error: 'pyconfig.h' file not found 

解决:添加“export CPLUS_INCLUDE_PATH=/你的anaconda路径/include/python3.6m(你的python版本)“到~/.bashrc

           然后记得source ~/.bashrc)

服务器:make launch

12.完成

13.测试python程序

cd /carla/PythonAPI/examples

python spawn_npc.py 

(报错:No module named 'carla':解决:在bashrc中添加 CARLA Python的路径:

export PYTHONPATH=$PYTHONPATH:/home/user/carla/PythonAPI/carla/dist/carla-0.9.10-py3.6-linux-x86_64.egg)

14.其他运行错误:

运行:cd ~/UnrealEngine-4.24/Engine/Binaries/Linux && ./UE4Editor

提示:plugin exampledeviceprofileselector / steamvr / locationservecesBPlibrary / LocationservicesBPLibrary / MobilePatchingUtils failed to load because ...

解决:转到 ~/UnrealEngine-4.24/Engine/Plugins/Runtime/
找到对应的文件如 ExampleDeviceProfileSelector.uplugin ,改 "EnabledByDefault": true -> "EnabledByDefault": false

 

 

 

 

 

 

 

 

  • 4
    点赞
  • 57
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值