carla/Docs/how_to_build_on_linux.md

98 lines
3.0 KiB
Markdown
Raw Normal View History

2018-03-22 01:16:56 +08:00
<h1>How to build CARLA on Linux</h1>
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
2018-07-04 17:59:59 +08:00
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get install build-essential clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python3 python3-pip libboost-python-dev python-dev tzdata sed curl wget unzip autoconf libtool
pip2 install --user setuptools nose2
pip3 install --user setuptools nose2
```
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
2018-07-04 17:59:59 +08:00
and C++ runtime library. We use clang 5.0 and LLVM's libc++. We recommend to
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
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-5.0/bin/clang++ 101
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-5.0/bin/clang 101
```
2017-09-07 21:55:41 +08:00
Build Unreal Engine
-------------------
!!! 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).
2018-07-04 17:59:59 +08:00
Download and compile Unreal Engine 4.19. Here we will assume you install it at
`~/UnrealEngine_4.19", 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
git clone --depth=1 -b 4.19 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.19
cd ~/UnrealEngine_4.19
./Setup.sh && ./GenerateProjectFiles.sh && make
```
2017-09-07 21:55:41 +08:00
Check Unreal's documentation
["Building On Linux"](https://wiki.unrealengine.com/Building_On_Linux) if any of
the steps above fail.
2017-10-25 23:26:49 +08:00
Build CARLA
-----------
2017-09-07 21:55:41 +08:00
Clone or download the project from our
[GitHub repository](https://github.com/carla-simulator/carla)
2018-07-04 17:59:59 +08:00
```sh
git clone https://github.com/carla-simulator/carla
```
Note that the `master` branch contains the latest fixes and features, for the
latest stable code may be best to switch to the latest release tag.
2018-07-04 17:59:59 +08:00
Now you need to download the assets package, to do so we provide a handy script
that downloads and extracts the latest version (note that the package is >10GB,
this step might take some time depending on your connection)
2017-09-07 21:55:41 +08:00
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
export UE4_ROOT=~/UnrealEngine_4.19
```
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-07-04 17:59:59 +08:00
Now that the environment is set up, you can run make to run different commands
2017-10-25 23:26:49 +08:00
2018-07-04 17:59:59 +08:00
```sh
make launch # Compiles CARLA and launches Unreal Engine's Editor.
make package # Compiles CARLA and creates a packaged version for distribution.
make help # Print all available commands.
```
2017-11-08 02:02:45 +08:00
Updating CARLA
--------------
Every new release of CARLA we release a new package with the latest changes in
2018-07-04 17:59:59 +08:00
the CARLA assets. To download the latest version and recompile CARLA, run
```sh
make clean
git pull
./Update.sh
make launch
```