- Windows build command summary
- Necessary software
- CARLA build
Windows build command summary
Show command lines to build on Windows
To execute the
makecommands below, you must use the Visual Studio 2017 native console x64 with administrator rights, otherwise you may be getting permission errors. !!! Important To execute the ```make``` commands below, you **must** use the Visual Studio 2017 native console x64 **with** administrator rights, otherwise you may be getting permission errors.
# Make sure to meet the minimum requirements # Necessary software: # CMake # Git # Make # Python3 x64 # Unreal Engine 4.24 # Visual Studio 2017 with Windows 8.1 SDK and x64 Visual C++ Toolset # Set environment variables for the software # Clone the CARLA repository git clone https://github.com/carla-simulator/carla # make the CARLA client and the CARLA server make PythonAPI make launch # Press play in the Editor to initialize the server # Run example scripts to test CARLA # Terminal A cd PythonAPI/examples python3 spawn_npc.py # Terminal B cd PythonAPI/examples python3 dynamic_weather.py # The PythonAPI will be built based on the installed Python version, but the docs will use Python3 by default.
- x64 system. The simulator should run in any 64 bits Windows system.
- 30GB disk space. Installing all the software needed and CARLA will require quite a lot of space. Make sure to have around 30/50GB of free disk space.
- An adequate GPU. CARLA aims for realistic simulations, so the server needs at least a 4GB GPU. A dedicated GPU is highly recommended for machine learning.
- Two TCP ports and good internet connection. 2000 and 2001 by default. Be sure neither the firewall nor any other application are blocking these.
- CMake generates standard build files from simple configuration files.
- Git is a version control system to manage CARLA repositories.
- Make generates the executables.
- Python3 x64 is the main script language in CARLA. Having a x32 version installed may cause conflict, so it is highly advisable to have it uninstalled.
Be sure that these programs are added to the environment path. Remember that the path added leads to the bin directory.
Visual Studio 2017
Get the 2017 version from here. Community is the free version. Use the Visual Studio Installer to install two additional elements.
- Windows 8.1 SDK. Select it in the Installation details section on the right.
- x64 Visual C++ Toolset. In the Workloads section, choose Desktop development with C++. This will enable a x64 command prompt that will be used for the build. Check it up by pressing the
Winbutton and searching for
x64. Be careful to not open a
Other Visual Studio versions may cause conflict. Even if these have been uninstalled, some registers may persist. To completely clean Visual Studio from the computer, go to
Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout and run
Since CARLA 0.9.11, we have included some fixes to the engine that requires to modify it so it is no longer possible to use the Unreal Engine version provided by Epic Games Launcher. To build this modified version, we need to download the engine's code from source and then apply some patches that we provide. Be aware that to download the Unreal Engine's source code, you need to have a Github account linked to the Unreal's account. If you do not have it, please follow this guide before going any further.
- 1. Open a terminal, go to the folder in which you want to save Unreal Engine and, clone the 4.24 branch on your computer.
git clone --depth=1 -b 4.24 https://github.com/EpicGames/UnrealEngine.git
Keep it as close as
C:// as you can because if the path exceeds certain longitude Setup.bat will return errors in step 3.
- 2. Inside the engine's source folder, we need to download our patch and apply it.
cd UnrealEngine powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/UE4_patch_wheels.patch', 'UE4_patch_wheels.patch')" git apply UE4_patch_wheels.patch
- 3. Run the configuration scripts.
4. Now, we need to compile the engine. Open the UE4.sln file inside the source folder with Visual Studio (Epic recommends 2017 or 2019 versions). Make sure that in the build bar, it is selected the 'Development Editor', 'Win64' and, 'UnrealBuildTool' options. Check this guide if you need any help. Then, in the solution explorer, right-click in UE4 and select Build.
5. Once the solution is compiled you can open the engine to check that everything was correct launching the executable
If the installation was successful, this should be recognised by the Unreal Engine's version
selector and when you use Switch Unreal Engine version when right-clicking on .uproject files, it should appear as Source Build at PATH where PATH is the installation path that you have chosen. If you can not see this selector or the Generate Visual Studio project files when you right-click on .uproject files, something went wrong with the UE4 installation and probably you need to reinstall it correctly.
Lots of things have happened so far. It is highly advisable to restart the computer.
The official repository of the project. Either download and extract it or clone it using the following command line in a x64 terminal.
git clone https://github.com/carla-simulator/carla
Now the latest content for the project, known as
master branch in the repository, has been copied in local.
master branch contains the latest fixes and features. Stable code is inside the
stable and previous CARLA versions have their own branch. Always remember to check the current branch in git with the command
Only the assets package is yet to be downloaded.
\Util\ContentVersions.txt contains the links to the assets for CARLA releases. These must be extracted in
Unreal\CarlaUE4\Content\Carla. If the path doesn't exist, create it.
Download the latest assets to work with the current version of CARLA.
Set the environment variable
This is necessary for CARLA to find the Unreal Engine installation folder. By doing so, users can choose which specific version of Unreal Engine is to be used. If no environment variable is specified, the CARLA will look up in the directories and use the last version in search order.
1. Open the Windows Control Panel and go to
Advanced System Settings.
2. On the
Advanced panel open
New... to create the variable.
4. Name the variable as
UE4_ROOT and choose the path to the installation folder of the desire UE4 installation.
The last step is to finally build CARLA. There are different
make commands to build the different modules. All of them run in the root CARLA folder.
Make sure to run
make PythonAPI to prepare the client and
make launch for the server.
make LibCarla will prepare the CARLA library to be imported anywhere.
- make PythonAPI compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed.
- make launch compiles the server simulator and launches Unreal Engine. Press Play to start the spectator view and close the editor window to exit. Camera can be moved with
WASDkeys and rotated by clicking the scene while moving the mouse around.
The project may ask to build other instances such as
UE4Editor-Carla.dll the first time. Agree in order to open the project. During the first launch, the editor may show warnings regarding shaders and mesh distance fields. These take some time to be loaded and the city will not show properly until then.
Finally, let's test the simulator. Inside
PythonAPI/util there are some example scripts that may be especially useful for starters. The following commands will spawn some life into the town, and create a weather cycle. Each script should be run in one terminal
# Terminal A cd PythonAPI/examples python3 spawn_npc.py # Terminal B cd PythonAPI/examples python3 dynamic_weather.py # The PythonAPI will be built based on the installed Python version, but the docs will use Python3 by default.
If the simulation is running at very low FPS rates, go to
Edit/Editor preferences/Performance in the UE editor and disable Use less CPU when in background.
Now CARLA is ready to go. Here is a brief summary of the most useful
make commands available.
||Prints all available commands.|
||Launches CARLA server in Editor window.|
||Builds the CARLA client.|
||Builds CARLA and creates a packaged version for distribution.|
||Deletes all the binaries and temporals generated by the build system.|
Some recommendations after finishing the build. Learn how to update the CARLA build or take your first steps in the simulation, and learn some core concepts.