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.

Implementation:CARLA simulator Carla InstallPrerequisites Script

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

Overview

Concrete tool for installing all system-level build dependencies required by CARLA in the CARLA build pipeline.

Description

The InstallPrerequisites.sh script is a Bash script that automates the detection and installation of all system packages, development libraries, and toolchain components needed to build CARLA from source. It is located at Util/SetupUtils/InstallPrerequisites.sh within the CARLA repository and is invoked with elevated privileges via sudo -E.

The script performs the following operations:

  • Detects the Linux distribution and version
  • Installs C/C++ build tools (build-essential, clang, lld)
  • Installs CMake >= 3.28 and Ninja build system
  • Installs Vulkan SDK and graphics development libraries
  • Installs Python 3 development headers, pip, and venv support
  • Installs serialization libraries (protobuf), compression libraries (zlib, libtiff, libjpeg, libpng)
  • Configures any necessary environment variables or system paths

Usage

Run this script immediately after cloning the CARLA repository and before attempting any build steps. It must be run with sudo privileges and should be executed from the repository root directory. The --python-path flag should point to the desired Python 3 interpreter.

Code Reference

Source Location

  • Repository: CARLA
  • File: Util/SetupUtils/InstallPrerequisites.sh:L39-116, CarlaSetup.sh:L78-82

Signature

sudo -E bash -x Util/SetupUtils/InstallPrerequisites.sh --python-path=python3

I/O Contract

Inputs

Name Type Required Description
--python-path String (path) No Path to the Python 3 interpreter to use for Python dependency detection. Defaults to system python3.
sudo -E Environment flag Yes Preserves calling user's environment variables while running with root privileges.
-x Bash flag No Enables command tracing for debugging. Prints each command before execution.

Outputs

Name Type Description
Installed system packages System state All required packages installed via the system package manager (apt, dnf, etc.).
Vulkan SDK System state Vulkan development libraries and tools installed and configured.
Exit code Integer 0 on success; non-zero if any package installation fails.
Trace output (stderr) Text With -x flag, detailed trace of all commands executed by the script.

Usage Examples

Basic Example

# Navigate to the CARLA repository root
cd CarlaUE5

# Run the prerequisites script with sudo and bash tracing
sudo -E bash -x Util/SetupUtils/InstallPrerequisites.sh --python-path=python3

Using a Custom Python Path

# If using a specific Python installation (e.g., from pyenv or conda)
sudo -E bash -x Util/SetupUtils/InstallPrerequisites.sh --python-path=/usr/local/bin/python3.10

Verifying Installed Dependencies

# After running the script, verify key dependencies
cmake --version       # Expected: cmake version 3.28.x or higher
ninja --version       # Expected: 1.10.x or higher
python3 --version     # Expected: Python 3.8+
pkg-config --modversion vulkan  # Expected: Vulkan version string
clang --version       # Expected: clang version info

Related Pages

Implements Principle

Requires Environment

Page Connections

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