How to run Argentum compiler (and try examples)

Supported platforms: Windows10-11, MacOS15, Linux.
Supported architectures: x64 (aka x86-64) ARM64.

Steps:

  1. Download a zip archive for your architecture and operation system.
  2. Extract to any directory, for example:
    • ~ag/ on Linux and Mac
    • your home dir - %USERPROFILE%/ag on Windows
  3. Install prerequisites (because Argentum compiler builds standard obj/o files it needs linker and C-standard library):
    • on Windows:
      • install Visual Studio (community edition is ok),
      • or Build Tools for Visual Studio 2026,
      • or (if you know what you're doing) llvm-mingw, MinGW or Cygwin.
    • on Linux: install build-essential:
      • for Ubuntu it's sudo apt-get install build-essential
      • for other distributions, you already know what to do
    • on Mac install Xcode Command Line Tools:
      • with xcode-select --install
  4. Open Terminal
    • on Windows from the start menu launch x64 Native Tools Command Prompt
    • on Linux/Mac open system terminal
  5. CD to your working directory (where all build files and final executable to be build and where your program starts.
    • It can be any directory you want,
    • but for provided examples it should be ag/examples/work-dir
  6. Build and run Hello World example:
    • Windows: ..\..\bin\run-release.bat ..\helloWorld.ag
    • Linux/Mac: ../../bin/run-release.sh ../helloWorld.ag
  7. Build and run other simple examples
    • fizzBuzz - demonstrates lambdas, loops, variables
    • bottles - prints text of 100 wine bottles, demonstrates string interpolation
    • graph - demonstrates building of graph data structure and traversal with finding loops (this example is intended to show that Argentum can easily handle data structures with loops)
    • cardDom - example demonstrates operations on a rich DOM or an imaginary document editors discussed in a series of Linkedin publications and other resources
    • threadTest - example showcasing multithreading and asynchronous message passing
  8. Build and run example demonstrating Package Manager: run-release sqliteDemo
    This example uses an sqliteFfi module that is not presented in the compiler binary.
    • When launched, compiler automatically
      • downloads this module from the cloud package repository,
      • checks its format and compatibility with current platform,
      • and installs it. This step performs upon first usage or when a compiled application requests a newer version than cached.
    • Then as usual Argentum compilers this application with this downloaded module sources.
    • If this package provides platform specific libs, object files, resources or DLLs they are automatically included in linking and deployment.
    • In this example tis application gets compiled with SQLite API, linked against SQLite engine and launched in work-dir where it queries a mydb.sqlite database and prints its content to console.
  9. Debugger:
    • If instead of run-release.sh/bat we use build-debug.sh/bat,
      • it builds your application in debug mode with included debug info,
      • and links it against debug versions of all libraries
      • and deploys along with debug versions of all DLLs (and PDBs on Windows).
    • This allows you to launch this app in Visual Studio/VSCode/X-Code/lldb/gdb or whatever debugger you use.
    • Since Argentum debug info is just DWARF/PDB, it allows effectively step between Argentum code and FFI C-code.
    • So far Argentum compiler supports only a small subset of debugging features: source code navigation, breakpoints, stepping, simple variable inspection. It is yet to support polymorphic data types and containers.
  10. There are features yet not ported to the new package manager, so the corresponding examples are not working in this version:
    • SDL integration
    • App platform (OpenGL-Skia)
    • Curl

6 Comments

  1. Could you please clarify how to configure windows version with llvm-mingw ?
    I’ve downloaded llvm-mingw from https://github.com/mstorsjo/llvm-mingw/.
    Archive doesn’t contain lld-link.exe, so I’ve tried ld.lld.exe instead, but it didn’t work:

    ld.lld: error: cannot open /OUT:helloWorld.exe: No such file or directory
    ld.lld: error: cannot open /INCREMENTAL:NO: No such file or directory
    ld.lld: error: helloWorld.obj: unknown file type

    If I try “original” LLVM, lld-link.exe fails with:

    lld-link: error: could not open ‘uuid.lib’: no such file or directory
    lld-link: error: could not open ‘MSVCRT.lib’: no such file or directory
    lld-link: error: could not open ‘OLDNAMES.lib’: no such file or directory

    And once again: agc.exe doesn’t support certain characters in paths (at least “!”)

    • 1. The ld.lld.exe keeps compatibility (by command line) with gcc. While lld-link – with Microsoft link. So you need the `lld-link`. You also need crtl libraries and Windows platform libraries which can be either automatically and effortlessly installed with “Build Tools for Visual Studio” or Visual Studio Community Edition. They also provided by mingw project but it is not that simple. That’s why it’s better to just install “Build Tools”, and you’ll get both linker and all necessary libs perfectly conigured.

      2. I already replied: agc fully supports “!”. the problem is with bat files. If you want to use “!” in paths, just remove the first line (actually not needed) from both run-release.bat and build-debug.bat.

      • I wouldn’t like to install anything (especially on the enterprise PC). I keep most of my soft on a portable drive. Moreover, MS Build tools are huge (at least 2.35Gb, and I’m not sure that build tools alone are enough)

        So, is there a way to make it work with ld.lld.exe by changing command line params ?

        • I’d personally avoid installing anything on a corp. PC and launching 3rd party apps from the USB stick. Especially if it hasn’t preinstalled build tools (which means it isn’t intended for software development role). Anyways, the easiest way to have “USB Stick” style Argentum installation of the minimal storage footprint is:
          1. Download self-contained old demo (https://github.com/karol11/argentum/releases/download/win-demo-v0.0.16/argentum-demo.7z)
          2. Copy from that 7zip a bin\lld-link.exe to your bin directory and copy all crtl-libs from libs (kernel32.Lib msvcrt.lib oldnames.lib ucrt.lib Uuid.Lib vcruntime.lib)
          3. In bat-files add the dir where you placed libs to you linker invocation command line: set linker=”%~dp0lld-link.exe” /libpath:”%~dp0\libs”
          “VS/MS Build tools” is much better option – it’s standard, it should be installed anyways for any kind of Windows native code development in general.
          If you want to stick to llc/gcc path. Look at the run-release.sh, it uses non-Microsoft syntax.

  2. It seems that agc doesn’t support paths with certain characters like “!”. Initially I put ag into c:\tools\!coding\ag. Launching run-release.bat led to the error
    “The system cannot find the path specified.”

    Moving ag to the c:\tools\_ag fixed this.

    • Thanks for the heads-up — it’ll be fixed in the next release.
      For now, just delete the first line in both run-release.bat and build-debug.bat.

Leave a Reply

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