Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.
/ static-clang Public archive

Statically-linked clang distribution. Uses musl libc on Linux and only depends on libSystem on OSX

License

Notifications You must be signed in to change notification settings

dzbarsky/static-clang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This project is no longer receiving updates. Development has been subsumed to https://github.com/cerisier/toolchains_llvm_bootstrapped which provides smaller, more optimized, and more feature complete toolchain distributions, as well as a fully featured Bazel cc_toolchain, with full support for LLVM runtimes, sanitizers, from-source bootstraps, and more.

If you are only interested in consuming a statically-linked prebuilt LLVM, look for an LLVM prebuilts release. If you are a Bazel user, check the README for directions how to integrate into your build.

Please migrate your usage and reach out to us on that repository!

Historical README

This repository builds a custom LLVM distribution that comes with statically linked tools (clang, lld, llvm-ar, llvm-as, llvm-nm, llvm-objcopy). This is the minimum set needed to use the outputs as a Bazel cc toolchain with toolchains_llvm (previously grailbio/bazel-toolchain).

Linux

On Linux, we link against musl libc.

OSX

On OSX, fully statically linked executable is impossible. We dynamically link only libSystem.

Usage

The easiest way to consume this is to check the releases page for pre-built artifacts. See the example in toolchains_llvm for where the artifact URLs should be configured.

Building from source

You can also compile from source as follows:

  1. Install Bazelisk
  2. (Optional, but highly recommended). Setup remote execution by making a free account with Buildbuddy. Add the following to your .bazelrc or ~/.bazelrc: build --remote_header=x-buildbuddy-api-key=YOUR_KEY_HERE
  3. Build for your platform: bazel build //:dist

You can also cross-compile for a different platform:

  • bazel build //:for_darwin_amd64
  • bazel build //:for_darwin_arm64
  • bazel build //:for_linux_arm64_musl
  • bazel build //:for_linux_amd64_musl
  • bazel build //:for_all_platforms (builds all of the above)

Roadmap

Please migrate to https://github.com/cerisier/toolchains_llvm_bootstrapped to continue following along our roadmap.

About

Statically-linked clang distribution. Uses musl libc on Linux and only depends on libSystem on OSX

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors