#mlir #cubecl #llvm #bindings

tracel-llvm-bundler

Creates a bundle of a portable version of LLVM Rust bindings

7 releases

Uses new Rust 2024

20.1.4-7 Jan 30, 2026
20.1.4-6 Jan 13, 2026
20.1.4-5 Sep 25, 2025

#311 in FFI

Download history 723/week @ 2025-10-18 1511/week @ 2025-10-25 2133/week @ 2025-11-01 2735/week @ 2025-11-08 2597/week @ 2025-11-15 2766/week @ 2025-11-22 2883/week @ 2025-11-29 3008/week @ 2025-12-06 4247/week @ 2025-12-13 2785/week @ 2025-12-20 2862/week @ 2025-12-27 4941/week @ 2026-01-03 4779/week @ 2026-01-10 5171/week @ 2026-01-17 6876/week @ 2026-01-24 6933/week @ 2026-01-31

24,366 downloads per month
Used in 111 crates (4 directly)

MIT/Apache

30KB
681 lines

llvm-bundler-rs

llvm-bundler-rs is a Rust crate designed to automatically bundle LLVM and statically link MLIR into your project. By downloading prebuilt LLVM artifacts and configuring the necessary environment variables, it simplifies the setup process for projects that rely on LLVM and MLIR tooling.

Features

  • Automatic LLVM Bundling: Downloads and decompresses prebuilt LLVM artifacts (currently using Linux x64 tarballs) from a GitHub release.
  • Static Linking for MLIR: Configures environment variables to link LLVM and MLIR libraries properly with the correct order by parsing the CMake with a Regex and doing a topological sort.

Installation

Add llvm-bundler-rs to your project's Cargo.toml and use it in your build.rs to compile in the right order:

[dev-dependencies]
llvm-bundler-rs = "0.1.0"

To set the env variable and download if missing:

tracel_llvm_bundler::bundler::bundle_cache()?;

To get the compile order of MLIR .a:

use tracel_llvm_bundler::{dependency_graph::DependencyGraph, topological_sort::TopologicalSort};

let prefix =
    Path::new(&env::var(format!("MLIR_SYS_{LLVM_MAJOR_VERSION}0_PREFIX")).unwrap_or_default())
        .join("lib")
        .join("cmake")
        .join("mlir")
        .join("MLIRTargets.cmake");
let path = DependencyGraph::from_cmake(prefix)?;
let mlirlib = TopologicalSort::get_ordered_list(&path);

Dependencies

~13–33MB
~442K SLoC