--- title: Expect SunOS, sunos and *-solaris2.11 from the build system; fix Linux-only branches in the recipe area: build impact: HIGH tags: [build, autotools, configure, cmake, meson, uname, triple, porting] verified: 2026-11-04 --- # Expect SunOS, sunos and *-solaris2.11 from the build system; fix Linux-only branches in the recipe Build systems name Solnix as illumos: autotools gets a `*-solaris2.11` triple, CMake sets `CMAKE_SYSTEM_NAME` to `SunOS`, and Meson's `host_machine.system()` returns `sunos`, with linker id `ld.solaris`. A script that tests `uname` or `__linux__` then calls the system unsupported, or takes a BSD branch that builds and runs wrong. **Antipattern** ```sh case "$(uname -s)" in Linux) ;; *) echo "unsupported OS" >&2; exit 1 ;; esac # uname -s prints SunOS ./configure # an old bundled config.guess/config.sub: "cannot guess build type" # CMake: a project that lists known CMAKE_SYSTEM_NAME values without SunOS ends in FATAL_ERROR # (SPIRV-Tools and Vulkan-Loader did); cmake reports CMAKE_SYSTEM_PROCESSOR=i386 on 64-bit illumos, # so ggml dropped to its generic, no-SIMD CPU code ``` ```c #if defined(__linux__) /* Linux code */ #else #error Unsupported platform /* seatd hit its #error; the fix is __sun arms */ #endif /* worse: libdrm's __sun took the BSD branch; it built, with the wrong ioctl numbers */ ``` ```meson if host_machine.system() == 'linux' # 'sunos' on Solnix, so the illumos path is skipped ``` **The Solnix way** ```sh uname -s # SunOS gcc -dumpmachine # *-solaris2.11; Nix system x86_64-solaris = x86_64-unknown-solaris2.11, # aarch64-solaris = aarch64-unknown-solaris2.11 # in the recipe's build step, give the answer a probe gets wrong: ./configure --prefix="$out" --build=x86_64-pc-solaris2.11 --host=x86_64-pc-solaris2.11 # old config.guess cmake -DCMAKE_SYSTEM_PROCESSOR=x86_64 # the llama-cpp recipe does this (uname -p prints i386) # patch the source: test SunOS / 'sunos' / ld.solaris / __sun, and read what that branch does touch e.h; gcc -E -dM e.h | grep -E '__sun|__illumos__|__linux__' # which macros this compiler defines ``` Building is a Nix derivation, one `recipes.tsv` row whose `buildsys` is `autotools`, `cmake`, `meson` and so on; see [recipe-write-a-solnix-recipe.md](recipe-write-a-solnix-recipe.md). In Nix code the test is `stdenv.hostPlatform.isSunOS`. Solnix's gcc 14 lacks gcc 15's `__illumos__`; the libdrm fix tests `__sun`. **The illumos way** (OpenIndiana, OmniOS, SmartOS) ```make # OpenIndiana oi-userland: the component Makefile is based on make-rules/configure.mk or cmake.mk CONFIGURE_OPTIONS+= --enable-shared # SmartOS (pkgsrc): SunOS-only knobs in the package Makefile, fixes in patches/patch-* CONFIGURE_ARGS.SunOS+= ``` Detection is the same on every illumos distribution: `SunOS`, `sunos`, `illumos` (Meson `.kernel()`); OpenIndiana's and the arm64 gate's gcc triples both end in `solaris2.11`. Each distribution keeps its fixes in its own build tree (oi-userland, pkgsrc, omnios-build). **The difference.** Solnix uses the same names as other illumos systems (the triple from nixpkgs' `x86_64-solaris`, `uname -s` = `SunOS`), so a pkgsrc or OpenIndiana fix usually carries over; the build team mines pkgsrc's SunOS patches. What differs is where the build runs: in a derivation, and for new recipes with store tools only on PATH (the trial Solnix host had no `/usr/gnu`). Some served builds still read host tool directories (handoff recipes2-W1: shfmt and bzip2-bin; the gcc 14 and rust recipes assume an OpenIndiana build host). A probe that finds a host tool is a bug; cmake found the host's `/bin/git` past PATH. Solnix's gcc 14 carries one illumos patch, not gcc 15's series. **Check.** `touch e.h; gcc -E -dM e.h | grep -E '__sun|__illumos__|__linux__'` shows which of these your compiler predefines (the sources show `__sun` tests in use; expect no `__linux__`). Every branch you patched tests a macro from that output, or `SunOS` / `sunos`. **Unverified** - The `gcc -dumpmachine` string of Solnix's from-source gcc 14. The sources give `x86_64-pc-solaris2.11` only for the OpenIndiana-built gcc 14 and clang 21, and `aarch64-unknown-solaris2.11` on the aarch64 Solnix QEMU guest (an OmniOS-built gcc 14.3.0). - Meson cross files for Solnix: none of the sources shows one. - Which OS macros Solnix's gcc 14 predefines: the sources show `__sun` tests in use, not the predefined list. **Sources** - [.kiro/steering/nix-conventions.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/.kiro/steering/nix-conventions.md) (solnix 5a8e5ce), Platform tuples (`x86_64-solaris` = `x86_64-unknown-solaris2.11`; "autotools/gcc demand the `solaris2.11` triple") - [.kiro/specs/solnix-aarch64/tasks.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/.kiro/specs/solnix-aarch64/tasks.md) (solnix 5a8e5ce), `aarch64-solaris` (triple `aarch64-unknown-solaris2.11`) - [docs/design-build-strategy.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/design-build-strategy.md) (solnix 5a8e5ce), Current state (`isSunOS=true`, `linker=solaris`, `kernel.name=solaris`; `hostPlatform.isSunOS` gating) - [docs/design-toolchains.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/design-toolchains.md) (solnix 5a8e5ce), What OI ships (gcc-14 and clang-21 default-target `x86_64-pc-solaris2.11`) - [docs/aarch64-native-openssl-fix.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/aarch64-native-openssl-fix.md) (solnix 5a8e5ce), Downstream item 4 (`cannot guess build type`; `--build=x86_64-pc-solaris2.11 --host=x86_64-pc-solaris2.11`) - [docs/aarch64-dixa-qemu-pg-buildfarm.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/aarch64-dixa-qemu-pg-buildfarm.md) (solnix 5a8e5ce), PostgreSQL 16.4 built natively (config.guess can't name aarch64-illumos) - [CMAKE_SYSTEM_NAME](https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html), System Name for Host Builds; UNIX Platforms ("SunOS: Oracle Solaris and all illumos operating systems") - [Meson Reference tables](https://mesonbuild.com/Reference-tables.html), Operating system names (`sunos`, `.system()`); Kernel names (`illumos`, `.kernel()`); Linker ids (`ld.solaris`, `get_linker_id`) - [docs/cmake-on-illumos.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/cmake-on-illumos.md) (solnix 5a8e5ce), Premise 1 (cmake `-D` cache flags in a recipe) - [docs/design-desktop-and-local-ai.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/design-desktop-and-local-ai.md) (solnix 5a8e5ce), MILESTONE Phase L (llama-cpp: `CMAKE_SYSTEM_PROCESSOR=x86_64`, `uname -p=i386`) - [handoff: 20261102-toolchain-trials-newer-versions](https://codeberg.org/solnix/solnix-infra/src/commit/c2ecf4535e0fc32261bbfb2414bc7961a73fa6ca/docs/handoff/20261102-toolchain-trials-newer-versions/README.md), host-built gcc 14 and rust - [handoff: from-builder-20261103T045848-recipes2-W1-rows](https://codeberg.org/solnix/solnix-infra/src/commit/c2ecf4535e0fc32261bbfb2414bc7961a73fa6ca/docs/handoff/from-builder-20261103T045848-recipes2-W1-rows/README.md), How they're built (store tools only; whisper-cpp: cmake `i386`, host `/bin/git`) - [handoff: 20261102-toolchain-trials-newer-versions](https://codeberg.org/solnix/solnix-infra/src/commit/c2ecf4535e0fc32261bbfb2414bc7961a73fa6ca/docs/handoff/20261102-toolchain-trials-newer-versions/README.md), Recipes that can't rebuild on a Solnix host (no /usr/gnu); autotools.patch (`./configure --prefix="$out"`) - [docs/progress.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/progress.md) (solnix 5a8e5ce), 2026-07-29 GPU step-1 (SunOS CMake patch; FATAL_ERROR on unknown CMAKE_SYSTEM_NAME) - [docs/mesa-vulkan-userland-status.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/mesa-vulkan-userland-status.md) (solnix 5a8e5ce), M-now: libdrm (`__sun` falls into the BSD branch) - [docs/post-stable-backlog.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/post-stable-backlog.md) (solnix 5a8e5ce), PS-X86-COSMIC-STAGE3 (seatd `#error Unsupported platform`, needs `__sun` arms) - [docs/gcc15.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/gcc15.md) (solnix 5a8e5ce), The patches (gcc 14 lacks `__illumos__`; OmniOS omnios-build) - [docs/package-universe.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/package-universe.md) (solnix 5a8e5ce), SmartOS / illumos-joyent (pkgsrc is SmartOS's primary userland) - [docs/design-pkgsrc-patches.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/design-pkgsrc-patches.md) (solnix 5a8e5ce), §1 Where the fixes live (`CONFIGURE_ARGS.SunOS+=`, `patches/patch-*`); §3 Filter (`__sun`, `__illumos__`) - [docs/registry/recipes.tsv](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/registry/recipes.tsv) (solnix 5a8e5ce), `buildsys` column (autotools, cmake, meson) - [.kiro/steering/builder-queue.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/.kiro/steering/builder-queue.md) (solnix 5a8e5ce), The contract (recipes.tsv, 10 columns) - [uname(1)](https://solnix.io/docs/man/uname.1) (illumos, CDDL), OPTIONS -s, -p - [docs/base-ami-rebuild-runbook.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/base-ami-rebuild-runbook.md) (solnix 5a8e5ce), Measured cold-boot reliability (`uname -s` = SunOS) - [gcc(1)](https://solnix.io/docs/man/gcc.1), -dumpmachine; -E; -dM (predefined macros) - [OpenIndiana: Building with oi-userland](https://docs.openindiana.org/dev/userland/#creating-makefile), Creating Makefile (configure.mk, cmake.mk, `CONFIGURE_OPTIONS+=`)