Skip to content

discere-os/flang-wasm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@discere-os/flang.wasm

WebAssembly port of LLVM Flang - Fortran compiler for WebAssembly with SIMD optimization and comprehensive Fortran runtime library.

CI/CD JSR npm version License Status

LLVM Flang for WebAssembly

This repository contains tools to build a patched version of LLVM's flang compiler that can be used to compile Fortran sources for WebAssembly. A pre-built Fortran runtime library is also built for WebAssembly using Emscripten.

What's included

  • A Makefile that downloads, builds and installs the flang compiler from a patched LLVM source. Use the PREFIX make variable to control the installation directory (default, "."). Once installed, the $(PREFIX)/host/bin/ directory will contain flang. The $(PREFIX)/wasm/ directory will contain a pre-built Fortran runtime library compiled for WebAssembly, for use with Emscripten.

  • A Dockerfile, which can be used to build a Docker container with LLVM Flang and the WebAssembly Fortran runtime library installed under the directory /opt/flang.

  • A Nix flake file, flake.nix, which can be used to build LLVM Flang and the WebAssembly Fortran runtime library as a Nix package.

What is this project used for?

The flang compiler is used as part of the build process for webR to compile Fortran sources for WebAssembly. Compiling LLVM takes a long time and is fairly resource intensive. By building LLVM independently with a Docker container and/or Nix package, the result is cached and improves the performance of webR's CI scripts.

Do I need this package to build webR?

Downloading this project as a Docker container or Nix package can shorten the time needed to build webR, but it is not required. WebR will compile LLVM from source in the build tree if it is not provided with Fortran compiler tools.

Can I use this project to build WebAssembly packages for webR?

No, this project does not contain a version of R configured for use with WebAssembly, which is required to build R packages. To build R packages, either build webR from source, or use a Docker image containing a fully pre-built version of webR.

💖 Support This Work

This WebAssembly port is part of a larger effort to bring professional desktop applications to browsers with native performance.

👨‍💻 About the Maintainer: Isaac Johnston (@superstructor) - Building foundational browser-native computing infrastructure through systematic C/C++ to WebAssembly porting.

📊 Impact: 70+ open source WASM libraries enabling professional applications like Blender, GIMP, and scientific computing tools to run natively in browsers.

🚀 Your Support Enables:

  • Continued maintenance and updates
  • Performance optimizations
  • New library ports and integrations
  • Documentation and tutorials
  • Cross-browser compatibility testing

💖 Sponsor this work to help build the future of browser-native computing.

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Nix 50.9%
  • Makefile 29.8%
  • Dockerfile 19.3%