Skip to content

Installation

Narta Xaymar Dirks edited this page Nov 27, 2026 · 39 revisions

Installation

Nightly builds

Every push to the root branch builds BlitzLLVM for Windows (x64 and arm64), Linux (x64) and macOS (arm64) and publishes the result as the nightly release: https://github.com/Xaymar/BlitzLLVM/releases/tag/nightly

  • Linux: install the two Flatpaks, blitzllvm-<version>-<commit>-linux-x64-runtime.flatpak first and then blitzllvm-<version>-<commit>-linux-x64.flatpak (-linux-arm64 on ARM), with flatpak install --user --bundle <file>. There is no zip, and no deb, rpm, Arch or snap package. The first holds the shared libraries that every program made by BlitzLLVM uses, the second the compiler and tools; see Flatpak.
  • macOS: install blitzllvm-<version>-<commit>-macos-universal.pkg.
  • Windows: run blitzllvm-<version>-<commit>-windows-setup.exe. It works on x64 and on arm64 Windows, installs the tools of your computer and can build programs for both. It looks for LLVM (clang and lld) on PATH and in C:\Program Files\LLVM\bin, offers to install it with winget install -e --id LLVM.LLVM when it is missing, can add BlitzLLVM to PATH, and comes with an uninstaller. Silent installs (/VERYSILENT) install only BlitzLLVM, add /INSTALLLLVM=yes to install LLVM too. Or download blitzllvm-<version>-<commit>-windows.zip and extract it yourself: bin/x86_64 has the x64 tools and bin/arm64 the arm64 tools.

For the zip:

  1. Extract it anywhere. The layout is:

    bin/blitzcc          the compiler (blitzcc.exe on Windows)
    bin/blitz-format     formats source code, see [[blitz-format]]
    bin/blitz-recompiler turns executables of the original Blitz compilers into BlitzLLVM programs, see [[Blitz-Recompiler]]
    lib/blitzllvm/runtime/  the runtime sources (inline/) and the libraries per architecture (x86_64/, arm64/; macOS has them directly), keep lib next to bin
    userlibs/            user libraries
    help/                the HTML help in the layout of the Blitz3D help: open help/index.html (the Flatpak has it in /app/share/doc/blitzllvm/help)
    samples/             the samples of BlitzLLVM: tutorials/, games/ and v1.0/ (feature showcases); the samples and games of the original Blitz3D (original-blitz3d/, with its tutorials) and BlitzPlus (original-blitzplus/) with their media; share/blitzllvm/samples in the deb, rpm and pkg packages
    
  2. Optionally add the bin directory to your PATH.

Tagged releases are published at https://github.com/Xaymar/BlitzLLVM/releases with the same files.

If you built it yourself, cmake --install produces the same layout, see Building.

Clang

BlitzLLVM writes LLVM IR and hands it to clang, which has to be installed and on your PATH. Use another one with --cc <path> or the BLITZLLVM_CC environment variable.

Graphics

Programs draw through Vulkan 1.3 into an SDL3 window, so a Vulkan 1.3 capable driver has to be installed. The Vulkan loader is loaded when the program starts, and the result is a single executable. AVIF, JPEG XL, TIFF and WebP images are decoded by shared libraries (avif, dav1d, jxl, tiff, webp and the libraries they use), which blitzcc copies next to programs that open a window; keep them next to the program when you ship it, or those four formats don't load (the program says so on the console). Set BLITZLLVM_HEADLESS=1 to run a program without a window or GPU.

On Windows computers with more than one graphics card (a laptop with an integrated and a dedicated one), programs ask the driver for the high performance card, as blitzcc exports NvOptimusEnablement, NvOptimusEnablementCuda and AmdPowerXpressRequestHighPerformance for them. The setting of Windows for the program (Settings, Display, Graphics) still wins over this.

Your first program

Save this as hello.bb:

Print "Hello from BlitzLLVM"

and run it (blitzcc builds it in a temporary directory and runs it, like the original), or build an executable:

blitzcc hello.bb
blitzcc -o hello hello.bb
./hello          # hello.exe on Windows

Useful options:

blitzcc program.bb              # build and run right away (arguments for the program go after --args)
blitzcc -o program program.bb  # only build the executable
blitzcc -O2 -o program program.bb   # a lower optimization level (the default is -O3)
blitzcc --fast-math full -o program program.bb   # also assume that Float math never produces NaN or Infinity (see below)
blitzcc -S program.bb          # only write the LLVM IR (program.ll)
blitzcc --target <triple> program.bb   # cross-compile (the Windows package builds for x64 and arm64: --target aarch64-w64-mingw32 or x86_64-w64-mingw32)
blitzcc -q program.bb          # quiet: no version banner and no warnings
blitzcc -W4 -Werror program.bb   # more warnings (-W0 to -W4, -W2 is the default), and any warning is an error, see [[Warnings]]
blitzcc -Wno-implicit-lossy-real-to-int program.bb   # turn off one warning
blitzcc +q program.bb          # very quiet: no messages from the compiler at all, errors included (it still returns a non-zero exit code)
blitzcc -c program.bb          # compile only: check the program, don't create an executable (unless -o is given)
blitzcc -d program.bb          # debug: no optimization, with debug information (DWARF, or CodeView for Windows MSVC)
blitzcc -g -O2 program.bb      # debug information in an optimized build
blitzcc --console -o program program.bb   # Windows: a console program (by default programs have no console window, see [[Differences]])
blitzcc --icon game.ico -o game game.bb      # Windows: the icon of the program (without it, programs get the BlitzLLVM icon)
blitzcc -k                     # list all keywords, runtime functions and userlib functions
blitzcc +k                     # same, with the syntax of the functions, the way Blitz3D lists them (Left$ ( string$,count% ))
blitzcc --dump-keywords        # same, with the syntax in our own notation, every type by its name (Left:String string:String, count:Int32)
blitzcc -v                     # print the version of the compiler and runtime, like the original
blitzcc --version              # print "blitzcc <version>" and exit
  • -v prints the version like the original does, and still compiles a file that is given with it.
  • --version prints blitzcc <version>, like blitz-format --version and blitz-tidy --version. --version and --help stop right away, whatever else is given.
  • --verbose prints the verbose output of the commands that are run.
  • +k turns every integer type into a % and every float type into a #, so tools that expect the list of Blitz3D can read it.
  • --dump-keywords does not convert anything. It uses the notation of this wiki: the types are written out (Int8, Int32, Int64, Float32, Float64, String, Pointer, ...), a parameter with a default value has it behind an =, and a function that returns nothing has no type behind its name.

The userlibs for -k, +k and --dump-keywords are the .decls files in userlibs next to bin (or in share/blitzllvm/userlibs), or in the directory given with --userlibs-dir.

Userlibs work like they do in Blitz3D. A program that calls a function from a .decls file loads the library it names when it runs, with LoadLibrary (Windows) or dlopen (Linux, macOS), and looks the function up with GetProcAddress or dlsym. The library is loaded on the first call of one of its functions, so it does not have to exist when the program is built.

  • The library is looked for in the userlibs directory, next to the program, next to the source file, and then by the system. user32.dll or libm.so.6 work without being copied anywhere.
  • The userlibs directory is --userlibs-dir, then the environment variable BLITZLLVM_USERLIBS, then the one of the installation.
  • The name in the .lib line is tried as written, and with the extension of the platform (mylib.dll finds libmylib.so or libmylib.dylib), so one .decls file works everywhere.
  • If the library or the function can not be found, the program stops with a runtime error when the function is called.
  • Functions use the C calling convention. Strings are C strings, and banks and objects are passed as the address of their memory.
  • A decorated name (_Name@8) falls back to Name if the library does not export it as written.
  • Static libraries (.a, .lib) can not be loaded this way.

blitzcc --help lists all of them.

Optimization

Programs are built with -O3 and loop unrolling by default. -d builds without optimization.

Float math is controlled with --fast-math:

  • precise (the default, also called off) is exact IEEE behavior, with no reordering and no fused multiply-add. The result is the same on every CPU.
  • safe compiles with the LLVM fast-math flags reassoc nsz arcp contract afn. They allow reordering, fused multiply-add and reciprocal math, so results may differ from the original and between CPUs in the last digits.
  • full also assumes that NaN and Infinity never occur. Checks like x <> x (is this NaN?) are then always false, so it is opt-in.

Arguments and operands are evaluated in the order of the original Blitz3D, which is not left to right (see Language Quirks). --sane-evaluation-order evaluates them from left to right.

The original accepts default values of fields (Field lives% = 3) but never uses them. --field-defaults lets New set the fields to them, see Language Quirks.

--entity-overrides lets EntityColor, EntityAlpha, EntityFX, EntityShininess and PaintEntity replace what the brushes of a model say, where the original combines them (colors and alphas multiplied, FX OR'd, shininess added).

--modern turns on all of them, and --no-<name> turns one off again (--modern --no-field-defaults); the last option for a feature wins. A program can also ask for them itself, with a comment the original ignores in the comments at the top of its main file: ;#pragma modern, ;#pragma entity-overrides or ;#pragma no-sane-evaluation-order. That wins over the options, see Modern Mode.

Programs written for BlitzPlus need --blitzplus: BlitzPlus kept images and fonts when Graphics or EndGraphics ran, while Blitz3D freed them, see Graphics.

The default targets a generic CPU of the architecture. Add --llvm-flag -march=native for a program that only runs on the machine that built it.

Console window on Windows

Programs on Windows are GUI programs, so starting one does not open a console window. Started from a terminal, a program uses it: Print, Write, Input, DebugLog and runtime errors follow the redirection of the terminal (program.exe > out.txt, 2> log.txt), and the prompt may come back before the output ends (use start /wait program.exe). Started without a terminal there is nothing to print to: Print and DebugLog show nothing (DebugLog still goes to an attached debugger) and a runtime error is shown in a message box. For a program that never opens a window, build it with blitzcc --console, which opens a console window when started without a terminal.

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally