Skip to content

miinso/flang-releases

Repository files navigation

flang-releases

Flang (LLVM Fortran compiler) binaries with wasm32 cross-compilation support.

Platforms

Target Host
x86_64-unknown-linux-gnu Linux x86_64
aarch64-unknown-linux-gnu Linux ARM64
x86_64-apple-darwin macOS x86_64
arm64-apple-darwin macOS ARM64
x86_64-pc-windows-msvc Windows x86_64

Linux builds are compiled on Alpine (musl libc), producing portable binaries that work on any Linux distribution regardless of glibc version.

Each release includes libflang_rt.runtime.wasm32.a for cross-compiling Fortran to WebAssembly.

Release Assets

Release artifact naming is stable:

  • flang+llvm-{version}-{target_triple}.tar.gz (Linux, macOS)
  • flang+llvm-{version}-{target_triple}.zip (Windows)

Every release also includes:

  • SHA256SUMS.txt
  • release-metadata.json

Compiler entrypoints are normalized in every archive:

  • Unix: bin/flang and bin/flang-new
  • Windows: bin/flang.exe and bin/flang-new.exe

Usage

Download from Releases and extract.

# Native compilation
flang-new -o hello hello.f90

# Cross-compile to wasm32 (requires Emscripten)
flang-new -c --target=wasm32-unknown-emscripten -o hello.o hello.f90
emcc hello.o -L$FLANG/lib/clang/21/lib/wasm32-unknown-emscripten -lflang_rt.runtime.wasm32 -o hello.js

CMake

set(CMAKE_Fortran_COMPILER /path/to/flang-new)

Or via command line:

cmake -DCMAKE_Fortran_COMPILER=/path/to/flang-new ..

Make

FC = /path/to/flang-new
FFLAGS = -O2

%.o: %.f90
	$(FC) $(FFLAGS) -c $< -o $@

Bazel

Use with rules_fortran:

load("@rules_fortran//fortran:repositories.bzl", "flang_register_toolchains")

flang_register_toolchains()

Why

Fortran remains widely used in numerical computing, scientific simulation, and optimization libraries. This project enables running such code in browsers and other WebAssembly runtimes—useful for interactive demos, client-side computation, or porting legacy numerical code to the web.

Further Reading

Build

CI Topology

  • ci-pr.yml: lightweight PR validation (Linux x86_64, preset linux-x86_64, wasm32 e2e)
  • ci-full.yml: full 5-platform builds (scheduled Tue/Fri 01:00 UTC + manual)
  • release.yml: release-only workflow, consumes artifacts from ci-full run or rebuilds

release.yml workflow_dispatch inputs:

  • rebuild (bool): rebuild all platforms in release run
  • source_run_id (string): consume artifacts from a specific ci-full run
  • tag (string): override release tag
  • version (string): single source of version truth for artifact/tag/build (recommended to fill this only)
  • llvm_fork_repo (string, advanced): LLVM fork repo override
  • llvm_fork_ref (string, advanced): LLVM fork ref override
  • draft (bool): draft/public release toggle

When rebuild=false, release.yml downloads artifacts from an existing successful ci-full.yml run (same commit SHA by default, or explicit source_run_id). When rebuild=true, release.yml builds from llvm_fork_repo/llvm_fork_ref (input override or versions.env/auto defaults).

All build jobs use .github/workflows/_build-platform.yml.

LLVM Source Policy

LLVM source is pulled from fork, not from upstream llvm/llvm-project directly.

  • LLVM_FORK_REPO and LLVM_FORK_REF are defined in versions.env
  • CI fails immediately if LLVM_FORK_REF is empty
  • Fork ref is expected to include wasm32 patch set already applied

EMSDK Selection Policy

EMSDK is selected automatically from emsdk-llvm-map.json based on build LLVM major.

  • Selector: scripts/resolve_emsdk_for_llvm.py
  • Validation: scripts/check_tool_llvm_major.py --tool llvm-nm
  • CI fails if downloaded emsdk's llvm-nm --version major does not match mapped expectation.

versions.env still keeps EMSDK_VERSION/EMSDK_HASH as fallback metadata, but CI selection is map-driven.

Automatic LLVM Version Tracking

llvm-version-watch.yml runs daily and:

  1. Finds latest LLVM patch version in TRACKED_LLVM_MINOR
  2. Opens a PR when versions.env needs an update
  3. Updates LLVM_VERSION and LLVM_FORK_REF using flang-wasm32-llvmorg-{version} convention

About

Flang (LLVM Fortran compiler) binaries with wasm32 cross-compilation support

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors