Build C3 From Source
C3 has precompiled binaries for Windows, MacOS and Ubuntu.
For other platforms it should be possible to compile it on any platform LLVM can compile to. You will need git
and CMake
installed.
1. Install LLVM
See LLVM the LLVM documentation on how to set up LLVM for development.
- On MacOS, installing through Homebrew works fine.
- Using apt-get on Linux should work fine as well.
- For Windows you can download suitable pre-compiled LLVM binaries from https://github.com/c3lang/win-llvm
2. Clone the C3 compiler source code from Github
This should be as simple as doing:
… from the command line.
3. Build the compiler
Create the build directory:
Use CMake to set up:
Build the compiler:
4. Test it out
Building via Docker
You can build c3c
using either an Ubuntu 18.04 or 20.04 container:
Replace 18
with 20
to build through Ubuntu 20.04.
For a release build specify:
A c3c
executable will be found under bin/
.
Building on Mac using Homebrew
- Install CMake:
brew install cmake
- Install LLVM 17+:
brew install llvm
- Clone the C3C github repository:
git clone https://github.com/c3lang/c3c.git
- Enter the C3C directory
cd c3c
. - Create a build directory
mkdir build
- Change directory to the build directory
cd build
- Set up CMake build for debug:
cmake ..
- Build:
cmake --build .