Skip to content

Latest commit

 

History

History
189 lines (131 loc) · 4.38 KB

File metadata and controls

189 lines (131 loc) · 4.38 KB

Installation Guide for ApolloSimFuzz

This document provides step-by-step instructions for installing and setting up the environment for ApolloSimFuzz.


Pre-requisites

Before installation, please ensure the following dependencies are available on your system:

GPU support is required for running Baidu Apollo modules.

Install uv if you haven't:

curl -LsSf https://astral.sh/uv/install.sh | sh

Installation

Step 1: Clone the repository

git clone --recurse-submodules git@github.com:MingfeiCheng/ApolloSimFuzz.git
cd ApolloSimFuzz

Step 2: Run the installation script

bash install.sh

The script automatically performs the following:

  1. Clones Baidu Apollo (v7.0.0)
  2. Applies required patches to Apollo
  3. Sets up a Python 3.8 virtual environment via uv
  4. Installs all project dependencies
  5. Builds the TrafficSandbox Docker image

Expected output:

[ApolloSimFuzz] Current Apollo version: 7.0
[ApolloSimFuzz] Cloning Apollo (v7.0.0)...
...
[ApolloSimFuzz] Applying Apollo patches...
[ApolloSimFuzz]   Copied dev_start_ctn.sh -> apollo/docker/scripts/
[ApolloSimFuzz]   Replaced apollo/WORKSPACE
[ApolloSimFuzz] Patches applied.
[ApolloSimFuzz] Ensuring Python 3.8 is available...
[ApolloSimFuzz] Syncing project dependencies (uv sync)...
...
[ApolloSimFuzz] Building TrafficSandbox Docker image...
...
[ApolloSimFuzz] Installation completed.

After installation, the following artifacts should be available:

  • apollo/ -- Baidu Apollo source code (with patches applied)
  • .venv/ -- Python virtual environment
  • Docker image drivora/sandbox:latest (verify with docker images)

Build Baidu Apollo

Apollo must be compiled inside a Docker dev container. You can use the automated script or do it manually.

Option A: Automated (recommended)

bash build_apollo.sh

This script will:

  1. Start the Apollo dev container
  2. Run ./apollo.sh build inside the container

Expected output:

[ApolloSimFuzz] Starting Apollo dev container...
...
 OK  Congratulations! You have successfully finished setting up Apollo Dev Environment.
[ApolloSimFuzz] Using container: apollo_dev_<username>
[ApolloSimFuzz] Building Apollo inside container (this may take a long time)...
...
[ApolloSimFuzz] Apollo build completed.

The build process may take a significant amount of time depending on your hardware configuration.

Option B: Manual

# Step 1: Start the dev container
cd apollo
bash docker/scripts/dev_start.sh

# Step 2: Enter the container
bash docker/scripts/dev_into.sh

# Step 3: Build Apollo (inside the container)
./apollo.sh build

Expected output after dev_start.sh:

 OK  Congratulations! You have successfully finished setting up Apollo Dev Environment.
 OK  To login into the newly created apollo_dev_<username> container, please run the following command:
 OK    bash docker/scripts/dev_into.sh
 OK  Enjoy!

Manual Patch Application (Optional)

If you need to apply patches manually (e.g. you already have Apollo cloned separately), copy the following files:

# Copy the dev container start script
cp apollo_bridge/patches/dev_start_ctn.sh apollo/docker/scripts/dev_start_ctn.sh

# Replace the WORKSPACE file (fixes build issues)
cp apollo_bridge/patches/WORKSPACE apollo/WORKSPACE

Build TrafficSandbox (Optional)

If the TrafficSandbox Docker image was not successfully built during the initial installation, you can build it manually:

cd TrafficSandbox
bash build.sh

Verify the image:

docker images | grep drivora/sandbox

Expected output:

drivora/sandbox   latest   <image_id>   <time>   <size>

Running

Important: Before running the fuzzer, stop the Apollo dev container created by build_apollo.sh. The fuzzer manages its own Apollo containers and will conflict with existing ones.

# Stop the build container first
docker stop apollo_dev_${USER}

# Then run the fuzzer
bash scripts/random.sh

Or run directly:

uv run python start_fuzzer.py

Or activate the environment manually:

source .venv/bin/activate
python start_fuzzer.py

Check and modify config.yaml before running.