Build Argentum compiler on Ubuntu


Install GCC and friends:

sudo apt-get update
sudo apt-get install build-essential

Install Ninja build system and CMake

sudo apt-get -y install ninja-build
sudo apt-get install cmake


Get LLVM sources:

mkdir ~/cpp/
cd ~/cpp/
wget -qO llvm.tgz \

tar -xzf llvm.tgz
rm llvm.tgz
mv llvm-project-llvmorg-17.0.4/ llvm-17.0.4-src

Prepare build files:

cd ~/cpp/llvm-17.0.4-src
mkdir build-rel

cmake -S llvm -B build-rel -G Ninja \

Build LLVM (this will take ~~hour)

cmake --build build-rel

Install LLVM to out dir

cmake --build build-rel --target install

Now ~/cpp/llvm17.0.4-rel contains the newly built release version of LLVM


Install dev versions SDL and SDL_image:

sudo apt install libsdl2-dev
sudo apt install libjpeg-dev libwebp-dev libtiff5-dev libsdl2-image-dev
sudo apt install libsdl2-ttf-dev

Some versions of libsdl2-image-dev have no cmake files.

In this case it should be added manually:

Create directories:

  • /usr/lib/x86_64-linux-gnu/cmake/SDL2_image/
  • /usr/lib/x86_64-linux-gnu/cmake/SDL2_ttf/

Copy there four .cmake files from argentum/third-party/SDL2_* directories


# Download and extract CURL sources to ~/cpp/curl-8.5.0/
cd ~/cpp
wget -qO curl-src.tgz
tar -xvzf curl-src.tgz
rm curl-src.tgz

# Build CUR and install its libs-headers to ~/cpp/curl/
mkdir curl-8.5.0/build
cmake -S curl-8.5.0/ -B curl-8.5.0/build -G Ninja -DCMAKE_INSTALL_PREFIX=curl
cmake --build curl-8.5.0/build/

Build Argentum compiler

Get sources

cd ~/cpp
git clone


cd ~/cpp/argentum
cmake -S . -B build -G Ninja -DLLVM_DIR=../llvm17.0.4-rel/lib/cmake/llvm/
cmake --build build

Build and run examples

cd build
./agc --help

Compile helloWorld to asm file out.a

./agc -src  ../demo -start helloWorld -S -o out.a

Build and run helloWorld

# compile
./agc -src  ../demo -start helloWorld -o out.o

# link
gcc -no-pie out.o libag_runtime.a -o hw

# run

Build and run SDL demo application

# compile and link
./agc -src  ../demo -start demo -o demo.o

gcc -no-pie demo.o libag_runtime.a \
-L/usr/lib/x86_64-linux-gnu \
-lSDL2 -lSDL2_image \
-o demo

# copy image resources
cp ../demo/*.jpg .
cp ../demo/*.png .

# run

Build and run CURL demo application

./agc -src  ../demo -start httpDemo -o ht.o
gcc -no-pie ht.o libag_runtime.a ../../curl/lib/ -o ht

Build DEB-package

# prepare release build directory
cd ~/cpp/argentum
cmake -S . -B build-rel \
-G Ninja \

# build deb
cd ~/cpp/argentum/deb

It will create aglan_0.0-1_amd64.deb and give instructions on how to install and uninstall it.

Leave a Reply

Your email address will not be published. Required fields are marked *