Skip to content

Instantly share code, notes, and snippets.

@coopbri
Created August 10, 2022 16:38
Show Gist options
  • Save coopbri/bdbdae57c8bedc2b7185781a65985d31 to your computer and use it in GitHub Desktop.
Save coopbri/bdbdae57c8bedc2b7185781a65985d31 to your computer and use it in GitHub Desktop.
Install Carbon language on Arch Linux

⚠️ Note that these instructions may not be entirely correct, as Carbon is under heavy development. I will try to keep this up to date, but please let me know if you find any errors or improvement opportunities. See here for generic Linux installation instructions.

In particular, I was unable to build Carbon using extra/clang and aur/bazelisk, and had to shim similar packages with brew.

  1. Install build tools
 # sync key required for `libunwind-carbon`
gpg --recv-keys 015A268A17D55FA4

yay -S brew lld libunwind-carbon libc++ zlib
  1. Fix any Brew context issues with brew doctor

  2. Install Brew packages

brew install bazelisk llvm
  1. Clone Carbon language repo
git clone https://github.com/carbon-language/carbon-lang carbon

cd carbon
  1. Build and run the explorer project
bazel run //explorer explorer/testdata/print/format_only.carbon

From here, you can execute other source files in a similar fashion with bazel run //explorer PATH_TO_FILE.carbon. It's kind of a hack, but you could alias the explorer command to something like carbon. Note that I redacted -- suggested in the Carbon documentation, which is used to represent the end of command options. I also redacted the prefixing ./ in front of the source file path option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment