carla/Docs/how_to_build_on_linux.md

102 lines
3.5 KiB
Markdown
Raw Normal View History

2017-09-07 21:55:41 +08:00
How to build CARLA on Linux
===========================
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
$ sudo apt-get install build-essential clang-3.9 git cmake ninja-build python3-pip python3-requests python-dev tzdata sed curl wget unzip autoconf libtool
2017-09-28 18:08:21 +08:00
$ sudo pip3 install protobuf
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
2017-11-13 21:55:06 +08:00
and C++ runtime library. We use clang 3.9 and LLVM's libc++. You may need to
change your default clang version to compile Unreal
2017-09-07 21:55:41 +08:00
2017-11-08 02:02:45 +08:00
$ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-3.9/bin/clang++ 100
$ sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-3.9/bin/clang 100
2017-09-07 21:55:41 +08:00
Build Unreal Engine
-------------------
Download and compile Unreal Engine 4.17. Here we will assume you install it at
"~/UnrealEngine_4.17", but you can install it anywhere, just replace the path
where necessary.
Unreal Engine repositories are set to private. In order to gain access you need
to add your GitHub username when you sign up at https://unrealengine.com.
$ git clone --depth=1 -b 4.17 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.17
$ cd ~/UnrealEngine_4.17
2017-09-28 19:19:10 +08:00
$ ./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
2017-10-25 23:26:49 +08:00
Run the setup script to download the content and build all dependencies. It
takes a while
2017-09-07 21:55:41 +08:00
$ ./Setup.sh
2017-11-08 02:02:45 +08:00
Once it's done it should print "Success" if everything went well.
2017-10-25 23:26:49 +08:00
Download Epic Games' Automotive Materials package and install it under
"Unreal/CarlaUE4/Content/AutomotiveMaterials".
2017-10-28 01:25:43 +08:00
[How to download automotive materials](how_to_add_automotive_materials.md).
2017-11-13 21:01:55 +08:00
!!! note
Due to license restrictions, pedestrians are not include in the CARLA open
source project (only in the compiled binaries). Some warnings may appear
when starting the project related to this. We are working to find a
solution.
2017-09-07 21:55:41 +08:00
2017-10-25 23:26:49 +08:00
To build CARLA, use the rebuild script. This script deletes all intermediate
files, rebuilds whole CARLA, and launches the editor. Use it too for making a
clean rebuild of CARLA
2017-09-07 21:55:41 +08:00
$ UE4_ROOT=~/UnrealEngine_4.17 ./Rebuild.sh
It looks at the environment variable `UE4_ROOT` to find the right version of
Unreal Engine. You can also add this variable to your "~/.bashrc" or similar.
2017-10-25 23:26:49 +08:00
2017-10-28 01:25:43 +08:00
Once the project is opened, it is required to manually link Epic's Automotive
2017-11-13 21:01:55 +08:00
Materials to our vehicles.
2017-10-28 01:25:43 +08:00
[How to link automotive materials](how_to_add_automotive_materials.md).
2017-11-08 02:02:45 +08:00
Later, if you need to compile some changes without doing a full rebuild, you can
use the Makefile generated in the Unreal project folder
$ cd Unreal/CarlaUE4
$ make CarlaUE4Editor
Updating CARLA
--------------
Every new release of CARLA we release a new package with the latest changes in
the CARLA assets. To download the latest version, run the "Update" script
$ git pull
$ ./Update.sh
2017-11-08 02:02:45 +08:00
Launching the editor
--------------------
To open the editor once the project is already built
$ cd Unreal/CarlaUE4
$ ~/UnrealEngine_4.17/Engine/Binaries/Linux/UE4Editor "$PWD/CarlaUE4.uproject"
2017-10-25 23:26:49 +08:00
Test (Optional)
---------------
A set of unit tests is available for testing the CarlaServer library (note that
these tests launch the python client, they require python3 and protobuf for
python3 installed, as well as ports 2000 and 4000 available)
$ make check