Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:CARLA simulator Carla Build From Source Requirements

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Build_System
Last Updated 2026-02-15 07:00 GMT

Overview

Linux/Windows build environment for compiling CARLA from source with CMake 3.28+, Ninja, C++20 compiler (Clang from UE5 sysroot), and Unreal Engine 5.5.

Description

This environment defines the complete build toolchain required to compile CARLA from source. On Linux, the build uses the Clang compiler bundled with the CARLA fork of Unreal Engine 5.5 (accessed via the CMake toolchain file). The project requires C++20 standard support (set in CMake/Common.cmake:5) and C11 for C code. The Ninja build system generator is mandatory. All C++ dependencies (Boost, Eigen, rpclib, Recast, zlib, libpng, SQLite) are fetched automatically via CMake FetchContent.

Usage

Use this environment when building CARLA from source, whether for development or packaging. This is the mandatory prerequisite for the Building_from_Source workflow and all its implementations: Git_Clone_Repository, InstallPrerequisites_Script, UE5_Setup_And_Build, Content_Clone, CMake_Configure_Build, CMake_Build_Python_API, and CMake_Build_Launch_Package.

System Requirements

Category Requirement Notes
OS Ubuntu 22.04 LTS or Windows 11 UE5.5 does not support Ubuntu 20.04 or Windows 10 (README.md:31)
CPU Intel i7/i9 gen 9-11 or AMD Ryzen 7/9 README.md:24
RAM 32 GB minimum README.md:25
GPU NVIDIA RTX 3070/3080/3090/4090 README.md:26; 16 GB VRAM minimum
Disk 100+ GB SSD Unreal Engine source + CARLA content assets are large
Architecture x86_64 or aarch64 Toolchain.cmake:30-36 supports both target triples

Dependencies

System Packages (apt)

From Util/SetupUtils/InstallPrerequisites.sh:42-63:

  • `build-essential`
  • `make`
  • `ninja-build`
  • `libvulkan1`
  • `libpng-dev`
  • `libtiff5-dev`
  • `libjpeg-dev`
  • `tzdata`
  • `curl`
  • `libtool`
  • `rsync`
  • `libxml2-dev`
  • `git`
  • `git-lfs`
  • `libnss3-dev`
  • `libatk-bridge2.0-dev`
  • `libxkbcommon-dev`
  • `libgbm-dev`
  • `libpango1.0-dev`
  • `libasound2-dev`
  • `python3`, `python3-dev`, `python3-pip`

Build Tools

  • CMake >= 3.28.0 (InstallPrerequisites.sh:100 checks; will auto-install 3.28.3 if missing)
  • Ninja build system generator (CMakePresets.json uses Ninja exclusively)
  • Clang compiler from UE5 sysroot (Toolchain.cmake configures automatically on Linux)

C++ Libraries (Auto-fetched via FetchContent)

From CMake/Options.cmake:

  • `Boost` 1.84.0 (asio, iterator, python, date_time, geometry, container, variant2, gil)
  • `Eigen` 3.4.0
  • `Google Test` 1.14.0
  • `libpng` 1.6.40
  • `zlib` 1.3.1
  • `SQLite` 3.50.04.00
  • `rpclib` (CARLA fork)
  • `Recast Navigation` (CARLA fork)

Optional Dependencies

  • PROJ 9.7.0 + xerces-c 3.3.0 (when `ENABLE_OSM2ODR=ON`)
  • Fast-DDS 2.11.2 + Fast-CDR 1.1.x (when `ENABLE_ROS2=ON`)
  • StreetMap UE plugin (when `ENABLE_STREETMAP=ON`)
  • PyTorch (when `ENABLE_PYTORCH=ON`)
  • ad-rss-lib (when `ENABLE_RSS=ON`)

Language Standards

From CMake/Common.cmake:5-9:

  • C++ Standard: C++20 (required)
  • C Standard: C11 (required)

Credentials

The following environment variables must be set:

  • `CARLA_UNREAL_ENGINE_PATH`: Path to the CARLA fork of Unreal Engine 5.5 installation root (Toolchain.cmake:13, Options.cmake:157).
  • `GIT_LOCAL_CREDENTIALS`: GitHub credentials in format `username@token` for unattended builds (CarlaSetup.sh:61-70). Required for cloning the private UE5 fork.

Quick Install

# Clone the repository
git clone -b ue5-dev https://github.com/carla-simulator/carla.git CarlaUE5
cd CarlaUE5

# Run automated setup (interactive mode, prompts for sudo and git credentials)
./CarlaSetup.sh --interactive

# Or run unattended (requires root and GIT_LOCAL_CREDENTIALS)
sudo -E env GIT_LOCAL_CREDENTIALS=github_username@github_token ./CarlaSetup.sh

Code Evidence

CMake minimum version from CMakeLists.txt:12-18:

set (
  CARLA_CMAKE_MINIMUM_REQUIRED_VERSION
  3.27.2
)
cmake_minimum_required (
  VERSION
  ${CARLA_CMAKE_MINIMUM_REQUIRED_VERSION}
)

CMake version check from Util/SetupUtils/InstallPrerequisites.sh:100-114:

CMAKE_MINIMUM_VERSION=3.28.0
if (check_cmake_version $CMAKE_MINIMUM_VERSION cmake); then
    echo "Found CMake $CMAKE_MINIMUM_VERSION"
else
    echo "Could not find CMake >=$CMAKE_MINIMUM_VERSION."
    echo "Installing CMake 3.28.3..."
fi

UE5 path validation from CMake/Toolchain.cmake:24-26:

if (NOT EXISTS ${UE_ROOT})
  message (FATAL_ERROR "The specified Carla Unreal Engine 5 path does not exist (\"${UE_ROOT}\").")
endif ()

Numpy version check from PythonAPI/CMakeLists.txt:27-29:

if ("${NUMPY_VERSION_STRING}" VERSION_GREATER "2.0.0")
  carla_error ("Unsupported Numpy version, please downgrade to a version prior to numpy 2.")
endif ()

Common Errors

Error Message Cause Solution
`FATAL_ERROR: The specified Carla Unreal Engine 5 path does not exist` `CARLA_UNREAL_ENGINE_PATH` not set or pointing to invalid path Set `export CARLA_UNREAL_ENGINE_PATH=/path/to/UnrealEngine5_carla` in .bashrc
`Could not find Unreal Engine clang sysroot` UE5 SDK directory structure not found Verify UE5 installation completed successfully with Setup.sh
`Unsupported Numpy version, please downgrade to a version prior to numpy 2` Numpy 2.x installed, which breaks Boost.Python bindings `pip install "numpy<2.0,>=1.24.4"`
`Git credentials are not set, can not continue setup in unattended mode` `GIT_LOCAL_CREDENTIALS` env var missing in non-interactive mode Set `export GIT_LOCAL_CREDENTIALS=user@token` or use `--interactive` flag
`CARLA is set to be built in Debug mode. This may cause issues when building CarlaUnrealEditor` CMAKE_BUILD_TYPE is Debug Use Release or RelWithDebInfo for Unreal builds (Common.cmake:14-16)

Compatibility Notes

  • Linux: Uses UE5 bundled Clang compiler via toolchain file. Supports x86_64 and aarch64 architectures.
  • Windows: Uses MSVC (Visual Studio 2022 x64 Native Tools Command Prompt). D3D12 is the default RHI.
  • Linux RHI: Vulkan is the default rendering hardware interface on Linux (Options.cmake:186).
  • libpng version pinned: Cannot upgrade beyond 1.6.40 due to zlib compatibility issue (Options.cmake:311-312, references https://github.com/madler/zlib/issues/1019).
  • Content assets: Cloned separately from Bitbucket (`bitbucket.org/carla-simulator/carla-content`), requires significant disk space.
  • PEP 517: Enabled by default for Python wheel builds (Options.cmake:108-111).

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment