This guide helps you understand and configure your Windows development environment for Flux. Rather than providing automated scripts, we believe in helping you understand each component and make informed choices about your setup.
Flux compilation on Windows involves several components working together:
- Python 3.13+ - Runs the Flux compiler itself
- LLVM v21 - Full LLVM pipeline
- if your LLVM does not come with
llc, you will need MSYS2 MinGW64 forllc - Enter MSYS2 MINGw64 and run
pacman -S mingw-w64-x86_64-llvm, this will give youllc
- Clang v21 - Compiles LLVM IR to object files
- if
lldorlld-linkfails to link, Flux falls back toclangto link the object file(s)
- Visual Studio/MSVC - Provides a linker and the Windows SDK
- llvmlite - Python bindings to LLVM for code generation
- Download from python.org
- Ensure it's added to your PATH during installation
- Verify:
python --version
Choose one of these methods:
Option 1: Official LLVM (Recommended)
winget install LLVM.LLVM
winget install clang
Option 2: Manual Installation
- Download from LLVM Releases
- Install to a standard location like
C:\Program Files\LLVM - Add
C:\Program Files\LLVM\binto your PATH
Option 3: Package Manager
# If you use Chocolatey
choco install llvm
# If you use Scoop
scoop install llvm
- If you already have VS installed:
- Select modify
-
Select Individual components
-
Scroll down until you see Compilers, build tools, and runtimes
- Select MSVC v143 based on your architecture.
- Scroll down to SDKs, libraries, and frameworks and select the appropriate C++ ATL for latest build tools based on your architecture, matching the MSCV version you selected.
- If you do not already have VS installed, install it and include the steps for if you did.
Visual Studio Build Tools (Minimal): If you prefer a lighter installation:
- Download "Build Tools for Visual Studio"
- Install the "Visual C++ build tools" package
pip install llvmlite==0.44.0 dataclassespython --version # Should show 3.8+
python -c "import llvmlite; print('llvmlite OK')"
clang --version
clang --print-targets | findstr x86_64 # Should show x86_64 targets
llc --version
- If this fails, you'll need step 3.5
If you had to install MSYS2, follow these steps:
- Inside MSYS2 MinGW64, run
pacman -S mingw-w64-x86_64-llvm - Add
C:\mingw64\mingw64\binto your system or userPATHenvironment variable.
Set it to wherever you installed Flux, where the compiler entrypoint fxc.py lives.
From a command prompt:
cd C:\path\to\Flux
python fxc.py tests\test.fx
Cause: Clang can't locate MSVC tools for linking.
Solutions:
- Run Flux from a Visual Studio Developer Command Prompt
- Ensure Visual Studio includes the "Desktop development with C++" workload
- Verify environment variables are set:
echo $env:VCINSTALLDIR
Cause: Python dependencies not installed.
Solutions:
- Install with:
pip install llvmlite==0.41.0 - If using multiple Python versions, ensure you're using the right pip
- Try:
python -m pip install llvmlite==0.41.0
Cause: Insufficient permissions for installation or compilation.
Solutions:
- Run terminals as Administrator when installing tools
- Ensure you have write permissions to your Flux directory
- Check Windows Defender or antivirus isn't blocking operations
- Use Command Prompt (Recommended) or PowerShell (Not Recommended)
- These terminals automatically configure environment variables for MSVC tools
- Available through: Start Menu -> Visual Studio -> Developer Command Prompt
When properly configured, you should see these environment variables:
VCINSTALLDIR- Points to Visual Studio installationWindowsSdkDir- Points to Windows SDKPATH- Includes LLVM, Python, and MSVC toolsFLUXC_SRCDIR- Your Flux installation wherefxc.pylives
When you run python fxc.py program.fx, Flux:
- Lexes your Flux source code into tokens
- Parses tokens into an Abstract Syntax Tree (AST)
- Generates LLVM Intermediate Representation (IR)
- Compiles IR to object file using Clang
- Links object file to executable using MSVC linker
If you have LLVM installed in a non-standard location, Flux will automatically search:
C:\Program Files\LLVM\bin\clang.execlang.exe(if in PATH)clang(Unix-style name)
You can also set a custom configuration in config\flux_config.cfg
Flux creates temporary files in build/ directory:
program.ll- LLVM IR codeprogram.o- Object fileprogram.exe- Final executable (Windows)
Enable detailed logging to understand what's happening:
python fxc.py program.fx --log-level 4 --log-timestamp
This shows exactly which tools are being called and their output.
Once your environment is working:
- Try compiling the examples in
examples\and tests intests\ - Read the language specification in
docs\ - Explore the standard library in
src\stdlib\ - Write your first Flux program!
As Flux matures, we'll eventually provide a self-hosted installer written in Flux itself - demonstrating the language's capabilities while maintaining transparency about what's being installed.
Happy Flux development!