# Install the build prerequisites
Set up Rust, a C++ toolchain, and your platform SDK before compiling the dotLottie native runtime, and clone the repository with its ThorVG submodule.

The native runtime is compiled from source, so you need a working Rust toolchain and a C++ compiler before you can build anything. The renderer, [ThorVG](/en/runtimes/overview/thorvg), is vendored as a Git submodule and compiled from source by the build script — that is why a C++ compiler is required even though the runtime itself is Rust.

## Common requirements

Every platform needs all of the following.

| Requirement    | Minimum version | Why it's needed                                               |
| -------------- | --------------- | ------------------------------------------------------------- |
| Rust           | 1.85            | Builds the runtime. Install with [rustup↗](https://rustup.rs) |
| A C++ compiler | clang or MSVC   | Compiles the vendored ThorVG renderer                         |
| libclang       | any recent      | `bindgen` reads ThorVG's C headers with it                    |
| GNU Make       | any recent      | Runs the per-architecture build targets                       |
| Git            | any recent      | Fetches the ThorVG submodule                                  |

## Clone with submodules

ThorVG lives in a submodule, and the build fails without it. Clone recursively:

```bash
git clone --recurse-submodules https://github.com/LottieFiles/dotlottie-rs.git
cd dotlottie-rs
```

If you already cloned the repository without submodules, fetch them now:

```bash
git submodule update --init --recursive
```

<Callout type="warning" title="A missing submodule looks like a compiler error">
  Without `dotlottie-rs/deps/thorvg`, the build script fails while trying to compile renderer sources or run `bindgen`,
  which reads as a C++ toolchain problem rather than a missing checkout. Verify the submodule first with `git submodule
    status` — it should print a commit hash for `dotlottie-rs/deps/thorvg`.
</Callout>

## Platform toolchains

Install the toolchain for each platform you intend to target.

<Tabs
  defaultValue="host"
  items={[
  { label: 'Your own machine', value: 'host' },
  { label: 'Android', value: 'android' },
  { label: 'Apple', value: 'apple' },
  { label: 'Linux (cross)', value: 'linux' },
  { label: 'Windows', value: 'windows' },
]}
>
  <TabsContent value="host">
    To build for the machine you are sitting at, the common requirements are enough. On Debian and Ubuntu:

    ```bash
    sudo apt-get install build-essential clang libclang-dev make git
    ```

    On macOS, install the Xcode command line tools:

    ```bash
    xcode-select --install
    ```
  </TabsContent>

  <TabsContent value="android">
    Install the **Android NDK r28 or newer** and point `ANDROID_NDK_HOME` at it. The build uses the NDK's bundled clang as the cross-compiler.

    ```bash
    export ANDROID_NDK_HOME=/path/to/android-ndk-r28b
    ```

    Then install the four Android Rust targets:

    ```bash
    make android-setup
    ```

    Builds target Android **API level 21** and above.
  </TabsContent>

  <TabsContent value="apple">
    Install **Xcode** (not just the command line tools) and accept its license, then install the Rust targets:

    ```bash
    make apple-setup
    ```

    This installs the seven stable Apple targets and adds the `rust-src` component to the nightly toolchain.

    macOS, iOS, and the iOS simulator build on stable Rust. **macCatalyst, visionOS, tvOS, and watchOS require a nightly toolchain**, because those targets have no prebuilt standard library and are compiled with `-Z build-std`. Install nightly if you need them:

    ```bash
    rustup toolchain install nightly
    rustup component add rust-src --toolchain nightly
    ```
  </TabsContent>

  <TabsContent value="linux">
    Building for your own Linux architecture needs nothing beyond the common requirements. To cross-compile for ARM64 from an x86\_64 host, install the GNU cross toolchain:

    ```bash
    sudo apt-get update
    sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
    ```

    Then install the Rust targets:

    ```bash
    make linux-setup
    ```
  </TabsContent>

  <TabsContent value="windows">
    Install:

    - **Visual Studio 2019 or newer**, or Build Tools, with the "Desktop development with C++" workload
    - **LLVM**, so `bindgen` can find libclang. Set `LIBCLANG_PATH` to its `bin` directory
    - **GNU Make**, via MSYS2, Git Bash, or `choco install make`
    - For ARM64, the **ARM64 build tools** component from the Visual Studio Installer

    ```powershell
    choco install make llvm -y
    ```

    ```powershell
    $env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin"
    ```

    Then install the Rust targets:

    ```bash
    make windows-setup
    ```

    Run `make` from Git Bash or MSYS2 rather than PowerShell — the makefiles are written for a POSIX shell.
  </TabsContent>
</Tabs>

## Confirm your setup

Check that the toolchain resolves and the submodule is present:

```bash
rustc --version          # must report 1.85.0 or newer
git submodule status     # must list dotlottie-rs/deps/thorvg
make list-platforms      # prints the platforms this checkout can build
```

## Next steps

- [Build for your target architecture](/en/runtimes/distributions/native/v0.x/building) — compile the library and generate the C header
- [Link the runtime into your project](/en/runtimes/distributions/native/v0.x/linking) — once you have build output
