DEV Community

Axlfc
Axlfc

Posted on

How to Set Up Carbon Programming Language Manually on Ubuntu 22.04

Here’s how I managed to manually install Google’s programming language as a C++ successor in Ubuntu 22.04 GNU/Linux.

sudo apt install -y apt-transport-https curl git gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update -y && sudo apt install -y bazel clang lldb lld openjdk-8-jdk llvm build-essential libc++-dev
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
export CC=$(which clang)' >> ~/.profile
git clone https://github.com/carbon-language/carbon-lang
cd carbon-lang
bazel run //explorer -- ./explorer/testdata/print/format_only.carbon

The folder(carbon-lang/explorer/testdata) has carbon sample programs.

Did this article helped you? Share it, comment or give a like if it did! 😄

Top comments (0)