foliSDK is a comprehensive cross-compiler toolchain and system library package for foliOS. It defines the canonical build environment for the foliOS ABI, runtime model, and binary format.
Unlike generic cross-toolchains, foliSDK intentionally removes historical Unix toolchain artifacts and aligns the entire build pipeline with the architectural principles of the foliOS runtime.
-
Custom foliOS ABI & Toolchain: A deeply patched GCC/Binutils toolchain (
x86_64-strata-folios,i686-strata-folios) designed for a clean-room OS environment. -
Unified ELF-Based Link Model: Eliminates legacy
ar/ranlibarchives in favor of a fully ELF-native static and dynamic linking strategy. -
Modern Library Formats:
.sl— A static library format implemented as a single relocatable ELF object generated viald -r. Unlike traditional.aarchives,.slpreserves full relocation metadata and enables fine-grained linker garbage collection..dl— A dynamic library format comparable to traditional.so, including SONAME support, but governed under foliOS package-level ABI management.
-
Package-Level ABI Versioning: foliOS does not implement per-library ABI negotiation. Compatibility is guaranteed and managed at the package level rather than at individual binary granularity.
-
Custom ELF Interpreter: Binaries are natively linked against foliOS's context-aware runtime linker (
/System/Processes/Current/RuntimeLinker.app).
TheCurrentnode is resolved through GNT (Global Namespace Tree), allowing the system to dynamically select the appropriate runtime for the active process context. -
Linker GC as Default: The compiler is configured by default to use
-ffunction-sections -fdata-sectionsand-Wl,--gc-sections, enabling aggressive dead code elimination at function granularity. -
Layered Syscall Architecture: Clean separation between the Kernel RunTime layer (
libstrata.dl) and the POSIX wrapper (libc.dl), seamlessly linked together via GCC's customLIB_SPEC. -
System Libraries Built-in:
-
Core & Math:
gmp,mpfr,mpc,isl -
Cryptography:
nettle,libsodium -
Data & Parsing:
libxml2,libxslt,libexpat,yyjson -
Compression:
zlib,bzip2,xz,lz4,zstd,libarchive -
System & Utilities:
libffi,libuv,libiconv,ncurses,editline,readline,sqlite3 -
Development Tools:
-
CMake Integration: Includes a custom fork (
cmake-strata) and built-in modules (e.g.,UseSIDLC.cmake) tailored to natively support buildingfoliOSprojects. -
sidlc (SIDL Compiler): A custom Interface Definition Language compiler. It parses
.sidldescriptions and generates C type headers, client bindings, server dispatch headers/sources, and combined server-client bindings for foliOS handle-based interfaces. -
sma (Strata Module Archiver): A host-side tool and CMake module for bundling module kernel/user ELF images into a Strata module archive.
-
Environment Management: Includes a structured shell activator (
folisdk-env.sh) for macOS or Linux shells to seamlessly enter the SDK environment without polluting the host environment.
foliSDK intentionally modernizes the traditional Unix toolchain model:
- Removes
ararchive indirection in favor of ELF-native static link units. - Enables deterministic and reproducible builds by reducing container-level metadata variance.
- Improves compatibility with function-level garbage collection.
- Simplifies the toolchain surface area by unifying around a single object model.
GCC was selected as the base compiler due to its mature spec override system, straightforward LIB_SPEC customization, and deep integration with Binutils — allowing precise control over ABI behavior and runtime linkage.
You'll need a set of GNU tools explicitly installed on your host system:
brew install texinfo wget gnu-getopt automake libtool tcl-tk help2manEnsure standard GNU build utilities are installed:
sudo apt-get install build-essential bison flex texinfo wget tar tcl help2man autoconf automake autoconf-archive pkg-config autopoint libssl-devInstall the GNU build utilities from packages. The build runner prefers GNU m4
as gm4 and GNU make as gmake on FreeBSD, because /usr/bin/m4 and
/usr/bin/make are the BSD implementations and cannot build several vendored
GNU packages.
sudo pkg install bash curl git gmake m4 bison flex texinfo wget tcl86 help2man autoconf automake autoconf-archive libtool pkgconf gettext-tools opensslThe SDK is built by the Python graph runner in build.py. It downloads and verifies upstream source archives, initializes missing submodules, prepares patched sources, builds host tools, then builds one graph per target architecture.
./build.py --arch x86_64 --jobs 8By default, build products are staged under ./build/pkgroot. The staged install destination is /opt/homebrew/opt on macOS and /opt on Linux, producing package roots such as:
./build/pkgroot/opt/homebrew/opt/folisdk-host./build/pkgroot/opt/homebrew/opt/folisdk-x86_64./build/pkgroot/opt/homebrew/opt/folisdk-i686
Available build.py options:
-a, --arch <arch>[,...]: Target architecture list (default:x86_64; e.g.,x86_64,i686).-b, --build-dir <path>: Build directory path (default:./build).-d, --destination <path>: Install destination prefix used insidepkgroot(default:/opt/homebrew/opton macOS,/opton Linux).--builddir-layout: Put host and target prefixes directly under the build directory instead ofbuild/pkgroot; cannot be combined with--destination.-j, --jobs <number>: Parallel build job count (default: total CPUs - 1).-n, --no-libs: Build the core cross toolchain and skip the additional target library set.--direct-output: Disable the virtual terminal status UI and stream child process output directly.--rerun-step <step>: Ignore the stamp for one stamped step. Repeatable; accepts eithersteporgraph:step.--dry-run: Print the scheduled work without executing build commands.-h, --help: Show help.
build.pyis the active top-level build entry point. Itsargparseprogram name is stillbuild.shfor compatibility in help output, but the repository currently ships and usesbuild.py.build_steps.pycontains the build graph definitions and step primitives used bybuild.py. The graph order isglobal-prepare,host-build-targets, onearch-<arch>graph per selected target, andhost-cleanup.- Each stamped step writes
.<step>.stampfiles in the build directory. Use--rerun-stepwhen one completed step needs to be forced without deleting the whole build tree. - The build writes DOT graph files to
./build/graphs, which can be useful when debugging dependencies. make_package.shis the packaging step, not the compiler build step. It expects a completed staged tree frombuild.py, creates per-roottar.gzarchives, and can render Homebrew formulae and Debian packages.
After build.py finishes, generate local package artifacts from the staged roots:
./make_package.sh --build-dir ./build --format homebrew,deb --version 0.0.1Available make_package.sh options:
-b, --build-dir <path>: Build directory containingpkgroot(default:./build).-d, --destination <path>: Install destination used bybuild.py(default:/opt/homebrew/opton macOS,/opton Linux).-f, --format <format>[,...]: Package formats to generate (homebrew,deb; default:homebrew,deb).-v, --version <version>: Package version (default:0.0.1).-h, --help: Show help.
make_package.sh scans $build_dir/pkgroot/$destination for folisdk-* roots. For each package root it creates $build_dir/<package>.tar.gz; when templates are present, it also renders Homebrew formulae into the build directory and Debian control files/packages on Linux. Debian package generation is skipped outside Linux or when dpkg-deb is unavailable.
The repository includes Homebrew formula templates under dist/homebrew. Generate formulas with make_package.sh, then install the generated package formula from the build directory.
-
Complete the build and packaging steps.
-
Install the generated host formula and the target package you need:
brew install --build-from-source ./build/folisdk-host.rb brew install --build-from-source ./build/folisdk-x86_64.rb
-
Initialize the SDK framework in your shell environment (
~/.zshrcor~/.bash_profile):source $(brew --prefix folisdk-host)/share/folisdk/folisdk-env.sh
Activate SDK Environment:
folisdk_activate x86_64You can now freely call gcc commands (e.g., x86_64-strata-folios-gcc) or configure scripts directly inside the active framework.
Deactivate SDK Environment:
folisdk_deactivateThe host tools are built as part of the folisdk-host package.
sidlccompiles SIDL source into.sifinterface artifacts and generates language bindings. Seesidlc/README.md.smapackages module kernel/user ELF images and interface metadata into.smaStrata module archives. Seesma/README.md.
With the SDK activated, you can write native applications using the modern foliOS ABI. The toolchain handles .dl (dynamic) and .sl (static) links seamlessly.
Use the SDK CMake toolchain files under folisdk/cmake when configuring
native projects. For interface binding generation, see
sidlc/README.md.
Alternatively, extract the generated artifact and add the SDK's bin directory into your $PATH.
export PATH="/path/to/extracted/opt/folisdk/bin:$PATH"
x86_64-strata-folios-gcc main.c -o out.app
x86_64-strata-folios-strip out.app