Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dzbarsky/static-clang
Statically-linked clang distribution. Uses musl libc on Linux and only depends on libSystem on OSX
https://github.com/dzbarsky/static-clang
Last synced: about 6 hours ago
JSON representation
Statically-linked clang distribution. Uses musl libc on Linux and only depends on libSystem on OSX
- Host: GitHub
- URL: https://github.com/dzbarsky/static-clang
- Owner: dzbarsky
- Created: 2023-09-26T15:06:00.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-15T04:04:39.000Z (4 months ago)
- Last Synced: 2024-08-03T09:06:04.026Z (4 months ago)
- Language: Starlark
- Homepage:
- Size: 2.29 MB
- Stars: 28
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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 https://github.com/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](https://github.com/dzbarsky/static-clang/releases) page for pre-built artifacts.### Building from source
You can also compile from source as follows:
1. [Install Bazelisk](--remote_header=x-buildbuddy-api-key=)
2. (Optional, but highly recommended). Setup remote execution by making a free account with [Buildbuddy](https://app.buildbuddy.io/). 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
This satifies my current needs, but I'm happy to tag additional releases as LLVM upstream releases them. I will probably add additional binaries that are used in Bazel as I need them: llvm-cov, llvm-dwp, llvm-objdump, llvm-profdata. I'm also open to adding extra pre-built artifacts with a more full set of tools (flang, clang-format, etc.) if there is interest.