sudo apt update && sudo apt -y install build-essential git curl gdb make cmake ninja-build meson
curl -4 -L -O --url 'https://go.dev/dl/go1.18.4.linux-amd64.tar.gz'
# wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.18.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin #or add to your .bashrc then source it
go install github.com/bazelbuild/bazelisk@latest
sudo apt install -y llvm-14 clang-14
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 100
sudo apt install libunwind-14-dev zlib1g-dev libllvm14 libc++-14-dev
export CC=clang # if you don't define this, it will try with GNU-GCC which will fail
export CXX=clang++ # if you don't define this, it will try with GNU-G++ which will fail
bazelisk run //explorer -- ./explorer/testdata/print/format_only.carbon
// hello_world.carbon
package Hello api;
fn Main -> i32 {
var s: auto = "Hello World";
Print(s);
return 0;
}
Execute it
bazelisk run //explorer -- hello_world.carbon