Workflow:CARLA simulator Carla Building from Source
| Knowledge Sources | |
|---|---|
| Domains | Build_Systems, Unreal_Engine, Development |
| Last Updated | 2026-02-15 12:00 GMT |
Overview
End-to-end process for building the CARLA autonomous driving simulator from source on Linux using Unreal Engine 5.5, including dependency installation, compilation, Python API generation, and packaging.
Description
This workflow covers building CARLA from the ue5-dev branch on Linux (Ubuntu 22.04+). The build system uses CMake with Ninja and compiles three major components: LibCarla (the core C++ library in both server and client variants), the Unreal Engine 5 plugin, and the Python API wheel. The automated setup script (CarlaSetup.sh) handles prerequisite installation, Unreal Engine download and compilation, CARLA content download, and the full build pipeline. Optional features like native ROS2 integration can be enabled at configure time.
Usage
Execute this workflow when you need to build CARLA from source for development, when you want to modify the simulator's C++ or Python code, when you need the latest features from the ue5-dev branch, or when you require optional features like ROS2 native support that are not included in packaged releases.
Execution Steps
Step 1: Prepare the Build Environment
Clone the CARLA repository from the ue5-dev branch. Link your GitHub account to an Epic Games account to gain access to the Unreal Engine 5 source repository. Ensure your system meets minimum requirements: Ubuntu 22.04+, at least 250GB free disk space, and sudo privileges for installing system packages.
Key considerations:
- The ue5-dev branch contains the latest UE5-based CARLA development
- Epic Games account linkage is required for UE5 source access (free but mandatory)
- Git credentials must be configured for accessing the UE5 repository
- GIT_LOCAL_CREDENTIALS environment variable can provide credentials non-interactively
Step 2: Install System Prerequisites
Install required system packages including build tools (cmake, ninja-build, build-essential), Python 3 with development headers, Vulkan graphics libraries, and other dependencies. The setup script automates this step but requires root/sudo access.
Key considerations:
- Key packages: cmake, ninja-build, build-essential, python3-dev, libvulkan1
- The --skip-prerequisites flag bypasses this step if dependencies are already installed
- Python 3.10+ is required for the Python API build
- Vulkan drivers must be installed for GPU rendering
Step 3: Download and Build Unreal Engine 5.5
Clone or update the Unreal Engine 5.5 source repository. Run the UE5 setup and generate project files, then compile the engine. This is the most time-consuming step, potentially requiring several hours on a first build.
Key considerations:
- UE5 compilation requires approximately 200GB of disk space
- Set CARLA_UNREAL_ENGINE_PATH if using an existing UE5 installation
- First build of UE5 from source takes significant time
- Subsequent builds only recompile changed files
Step 4: Download CARLA Content
Clone the CARLA content repository containing all 3D assets (maps, vehicles, pedestrians, props). This repository is stored separately from the main code and is linked into the Unreal project's Content directory.
Key considerations:
- Content is hosted on Bitbucket and requires separate download
- Content size is approximately 20-30GB
- The content version must match the CARLA source version
- Missing content results in empty maps with no visual assets
Step 5: Configure and Build CARLA
Run CMake configuration with the Ninja generator and the CARLA-specific toolchain file. Build the project, which compiles LibCarla in both server and client variants, builds the Unreal Engine plugin, and generates all intermediate files. Enable optional features like ROS2 support at this stage.
Key considerations:
- Use CMake presets (Development, Release, Debug) for standard configurations
- Enable ROS2 with -DENABLE_ROS2=ON flag at configure time
- The toolchain file (CMake/Toolchain.cmake) configures cross-compilation settings
- Build targets include: carla-server, carla-client, Unreal plugin
Step 6: Build and Install the Python API
Build the Python API wheel package that provides the carla Python module. This compiles the Boost.Python bindings that expose the C++ client library to Python, packages the agent navigation code, and installs the wheel into the active Python environment.
Key considerations:
- The target is carla-python-api-install for combined build and install
- The Python API links against the client variant of LibCarla
- The generated wheel includes the compiled C extension and pure Python agent code
- Verify installation by importing carla in Python
Step 7: Launch or Package
Either launch the Unreal Engine editor for development and testing, or create a packaged distribution for deployment. The editor provides visual tools for map editing and real-time testing. Packaging creates a standalone executable that can be distributed without UE5 installed.
Key considerations:
- Use cmake --build Build --target launch to open the UE5 editor
- Use cmake --build Build --target package to create a distributable build
- The packaged build includes CarlaUnreal.sh as the launch script
- Pass --ros2 to the launch script to enable ROS2 native support at runtime