2018-03-22 01:16:56 +08:00
|
|
|
<h1>How to build CARLA on Linux</h1>
|
2019-09-06 17:07:21 +08:00
|
|
|
---
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2017-11-13 21:55:06 +08:00
|
|
|
!!! note
|
|
|
|
CARLA requires Ubuntu 16.04 or later.
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2017-09-28 18:08:21 +08:00
|
|
|
Install the build tools and dependencies
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
```sh
|
2019-07-08 22:43:45 +08:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install wget software-properties-common
|
2018-07-04 17:59:59 +08:00
|
|
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
2019-04-30 19:41:13 +08:00
|
|
|
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-7 main"
|
2018-07-30 18:11:31 +08:00
|
|
|
sudo apt-get update
|
2019-07-08 22:43:45 +08:00
|
|
|
sudo apt-get install build-essential clang-7 lld-7 g++-7 cmake ninja-build libvulkan1 python python-pip python-dev python3-dev python3-pip libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl unzip autoconf libtool rsync
|
2019-03-29 01:35:31 +08:00
|
|
|
pip2 install --user setuptools
|
|
|
|
pip3 install --user setuptools
|
2018-07-04 17:59:59 +08:00
|
|
|
```
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2019-09-11 00:22:33 +08:00
|
|
|
!!! tip
|
|
|
|
For **Ubuntu 18.04**, change `libpng16-dev` to `libpng-dev` from the previous example.
|
|
|
|
|
2017-09-07 21:55:41 +08:00
|
|
|
To avoid compatibility issues between Unreal Engine and the CARLA dependencies,
|
|
|
|
the best configuration is to compile everything with the same compiler version
|
2019-01-22 22:15:08 +08:00
|
|
|
and C++ runtime library. We use clang 6.0 and LLVM's libc++. We recommend to
|
2018-07-04 17:59:59 +08:00
|
|
|
change your default clang version to compile Unreal Engine and the CARLA
|
|
|
|
dependencies
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
```sh
|
2019-04-30 19:41:13 +08:00
|
|
|
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-7/bin/clang++ 170
|
|
|
|
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-7/bin/clang 170
|
2018-07-04 17:59:59 +08:00
|
|
|
```
|
2017-09-07 21:55:41 +08:00
|
|
|
|
|
|
|
Build Unreal Engine
|
|
|
|
-------------------
|
2019-09-06 17:07:21 +08:00
|
|
|
---
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2018-01-29 18:52:08 +08:00
|
|
|
!!! note
|
|
|
|
Unreal Engine repositories are set to private. In order to gain access you
|
|
|
|
need to add your GitHub username when you sign up at
|
|
|
|
[www.unrealengine.com](https://www.unrealengine.com).
|
|
|
|
|
2019-04-30 19:41:13 +08:00
|
|
|
Download and compile Unreal Engine 4.22. Here we will assume you install it at
|
2019-09-06 17:07:21 +08:00
|
|
|
`~/UnrealEngine_4.22`, but you can install it anywhere, just replace the path
|
2017-09-07 21:55:41 +08:00
|
|
|
where necessary.
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
```sh
|
2019-04-30 19:41:13 +08:00
|
|
|
git clone --depth=1 -b 4.22 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.22
|
|
|
|
cd ~/UnrealEngine_4.22
|
2018-07-04 17:59:59 +08:00
|
|
|
./Setup.sh && ./GenerateProjectFiles.sh && make
|
|
|
|
```
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
Check Unreal's documentation ["Building On Linux"](https://wiki.unrealengine.com/Building_On_Linux)
|
|
|
|
if any of the steps above fail.
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2017-10-25 23:26:49 +08:00
|
|
|
Build CARLA
|
|
|
|
-----------
|
2019-09-06 17:07:21 +08:00
|
|
|
---
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
Clone or download the project from our [GitHub repository](https://github.com/carla-simulator/carla)
|
2018-03-27 21:40:45 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
```sh
|
|
|
|
git clone https://github.com/carla-simulator/carla
|
|
|
|
```
|
2018-03-27 21:40:45 +08:00
|
|
|
|
|
|
|
Note that the `master` branch contains the latest fixes and features, for the
|
2018-08-21 18:51:02 +08:00
|
|
|
latest stable code may be best to switch to the `stable` branch.
|
2018-03-27 21:40:45 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
Now you need to download the assets package, to do so we provide a handy script
|
2018-12-16 07:06:03 +08:00
|
|
|
that downloads and extracts the latest version (note that this package is >3GB,
|
2018-07-04 17:59:59 +08:00
|
|
|
this step might take some time depending on your connection)
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2019-07-08 22:43:45 +08:00
|
|
|
!!! Tip
|
|
|
|
Optionally you can download aria2 (with `sudo apt-get install aria2`) so
|
|
|
|
the following command will take advantage of it and will run quite faster.
|
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
```sh
|
|
|
|
./Update.sh
|
|
|
|
```
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
For CARLA to find your Unreal Engine's installation folder you need to set the
|
|
|
|
following environment variable
|
2017-11-08 02:02:45 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
```sh
|
2019-04-30 19:41:13 +08:00
|
|
|
export UE4_ROOT=~/UnrealEngine_4.22
|
2018-07-04 17:59:59 +08:00
|
|
|
```
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
You can also add this variable to your `~/.bashrc` or `~/.profile`.
|
2017-09-07 21:55:41 +08:00
|
|
|
|
2018-12-16 07:06:03 +08:00
|
|
|
Now that the environment is set up, you can use make to run different commands
|
|
|
|
and build the different modules
|
2017-10-25 23:26:49 +08:00
|
|
|
|
2018-07-04 17:59:59 +08:00
|
|
|
```sh
|
2018-12-16 07:06:03 +08:00
|
|
|
make launch # Compiles the simulator and launches Unreal Engine's Editor.
|
|
|
|
make PythonAPI # Compiles the PythonAPI module necessary for running the Python examples.
|
|
|
|
make package # Compiles everything and creates a packaged version able to run without UE4 editor.
|
|
|
|
make help # Print all available commands.
|
2018-07-04 17:59:59 +08:00
|
|
|
```
|
2017-11-08 02:02:45 +08:00
|
|
|
|
2017-11-27 23:44:43 +08:00
|
|
|
Updating CARLA
|
|
|
|
--------------
|
2019-09-06 17:07:21 +08:00
|
|
|
---
|
2017-11-27 23:44:43 +08:00
|
|
|
|
2018-12-16 07:06:03 +08:00
|
|
|
Every new release of CARLA, we release too a new package with the latest changes
|
|
|
|
in the CARLA assets. To download the latest version and recompile CARLA, run
|
2018-07-04 17:59:59 +08:00
|
|
|
|
|
|
|
```sh
|
|
|
|
make clean
|
|
|
|
git pull
|
|
|
|
./Update.sh
|
|
|
|
make launch
|
|
|
|
```
|
2018-12-16 07:06:03 +08:00
|
|
|
|
|
|
|
- - -
|
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
Assets repository (development only)
|
|
|
|
------------------------------------
|
2018-12-16 07:06:03 +08:00
|
|
|
|
|
|
|
Our 3D assets, models, and maps have also a
|
|
|
|
[publicly available git repository][contentrepolink]. We regularly push latest
|
|
|
|
updates to this repository. However, using this version of the content is only
|
|
|
|
recommended to developers, as we often have work in progress maps and models.
|
|
|
|
|
|
|
|
Handling this repository requires [git-lfs][gitlfslink] installed in your
|
|
|
|
machine. Clone this repository to "Unreal/CarlaUE4/Content/Carla"
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git lfs clone https://bitbucket.org/carla-simulator/carla-content Unreal/CarlaUE4/Content/Carla
|
|
|
|
```
|
|
|
|
|
|
|
|
It is recommended to clone with "git lfs clone" as this is significantly faster
|
|
|
|
in older versions of git.
|
|
|
|
|
|
|
|
[contentrepolink]: https://bitbucket.org/carla-simulator/carla-content
|
|
|
|
[gitlfslink]: https://git-lfs.github.com/
|