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.

Principle:CARLA simulator Carla Unreal Engine Build

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

Overview

Building Unreal Engine 5 from CARLA's custom fork provides the rendering and simulation framework that CARLA requires, with patches specific to autonomous driving simulation.

Description

CARLA depends on a customized fork of Unreal Engine 5, maintained at CarlaUnreal/UnrealEngine on GitHub. This fork contains CARLA-specific modifications to the engine that support features such as enhanced sensor simulation, custom rendering pipelines, and integration points for the CARLA plugin system.

The Unreal Engine build process involves three sequential phases:

  1. Setup: Running Setup.sh to download binary dependencies (third-party libraries, content, toolchains) required by Unreal Engine itself.
  2. Project file generation: Running GenerateProjectFiles.sh to create the build system files (Makefiles on Linux) from Unreal Build Tool (UBT) definitions.
  3. Compilation: Running make to compile the engine, which produces the UnrealEditor binary along with all engine modules and tools.

Access to the Unreal Engine source requires an Epic Games account linked to a GitHub account that has been granted access to the Epic Games GitHub organization.

Usage

This principle applies when:

  • Performing an initial CARLA build-from-source setup
  • Updating the Unreal Engine version to incorporate new CARLA patches
  • Debugging rendering or simulation issues that may originate in the engine layer
  • Building on a new platform or architecture

Theoretical Basis

Custom fork rationale: CARLA requires modifications to Unreal Engine that are not present in the mainline Epic Games release. These modifications include optimizations for headless (off-screen) rendering, support for custom sensor types (LIDAR, radar, semantic segmentation cameras), and integration hooks for the CARLA plugin. Using a fork allows the CARLA team to maintain these patches while periodically rebasing on upstream UE5 releases.

Branch alignment: The ue5-dev-carla branch in the CARLA Unreal fork is kept in sync with the ue5-dev branch of the CARLA simulator itself. This branch coupling ensures ABI compatibility between the engine and the CARLA plugin, which is critical because Unreal Engine plugins must be compiled against the exact same engine version they will run in.

Build pipeline phases:

  • Setup phase: Unreal Engine depends on numerous pre-built third-party libraries (e.g., PhysX, FreeType, ICU, OpenSSL). The Setup.sh script downloads these from Epic's CDN and places them in the correct directory structure. This phase is network-intensive but only needs to be run once.
  • Project file generation: Unreal Build Tool (UBT) is a custom build orchestrator written in C# that reads .Build.cs and .Target.cs files to determine module dependencies, compiler flags, and link libraries. GenerateProjectFiles.sh invokes UBT to produce platform-native build files (Makefiles for Linux, Visual Studio solutions for Windows).
  • Compilation: The make step compiles the full engine. This is the most resource-intensive step in the entire CARLA build process, typically requiring 100+ GB of disk space and taking 1-3 hours depending on hardware. The output is the UnrealEditor binary and associated engine libraries.

Disk and memory requirements: Building Unreal Engine is extremely resource-intensive. Developers should expect to need at least 200 GB of free disk space (for source, intermediates, and build output) and 32 GB or more of RAM. Parallel build jobs should be tuned to available memory to avoid OOM kills.

Practical Guide

Step 1: Ensure GitHub access

You must have an Epic Games account linked to your GitHub account and must have accepted the Epic Games GitHub organization invitation. Verify access by checking that you can view https://github.com/CarlaUnreal/UnrealEngine.

Step 2: Clone the CARLA Unreal Engine fork

git clone -b ue5-dev-carla https://github.com/CarlaUnreal/UnrealEngine.git ~/UnrealEngine5.3

Step 3: Run Setup

cd ~/UnrealEngine5.3
bash Setup.sh

This downloads third-party dependencies. Expect significant download time on the first run.

Step 4: Generate project files

bash GenerateProjectFiles.sh

Step 5: Compile the engine

make

This will take a substantial amount of time. You can monitor progress and adjust parallelism with make -jN where N is the number of parallel jobs (recommend matching CPU core count but monitoring memory usage).

Step 6: Set the engine path

After a successful build, note the engine installation path. You will need to provide this as CARLA_UNREAL_ENGINE_PATH during the CMake configuration step:

export UE5_ROOT=~/UnrealEngine5.3

Related Pages

Implemented By

Page Connections

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