Files
fruix/docs/reports/phase1-guile-freebsd.md

3.6 KiB

Phase 1.1: Guile verification on FreeBSD amd64

Date: 2026-04-01

Scope

This step covers the first item in docs/PLAN.md: verify that GNU Guile is usable on FreeBSD as a foundation for the Guix port.

The work in this step is limited to the current host (FreeBSD 15.0-STABLE on amd64). Cross-architecture verification for i386 is still outstanding.

Environment

  • Host: FreeBSD fruixdev 15.0-STABLE stable/15-n282801-29dce45d8c50 GENERIC amd64
  • FreeBSD version: 15.0-STABLE
  • Guile package: guile3-3.0.10
  • Guile executables present: /usr/local/bin/guile3, /usr/local/bin/guile-3.0
  • Guix source tree: ~/repos/guix
  • Guix source revision used for module loading: 62b61c20bcd20d3e8ec251a96e31f283d6a89374

Artifacts added

  • tests/guile/run-phase1-verification.sh
  • tests/guile/verify-phase1.scm
  • tests/guile/modules/phase1/sample.scm

Verification command

./tests/guile/run-phase1-verification.sh

Result

The verification suite passes on this FreeBSD amd64 host.

Covered checks:

  1. Guile module loading for a local test module
  2. Deterministic Scheme output (alpha=1;beta=2;gamma=3;sum=14)
  3. File I/O
  4. Process creation and reaping via primitive-fork + waitpid
  5. Loopback TCP socket communication
  6. FFI calls through (system foreign) using getpid(2)
  7. Execution of Guix bootstrap-related code by importing (guix build make-bootstrap) and successfully running copy-linux-headers

Expected deterministic payload hash:

7465da3704e9af1a71aaf4be99e62cff2631e410d7fe8b0bfbe3daf095de9b49

Two consecutive runs produced the same deterministic payload.

Important findings

1. Positive: core Guile functionality works

The following are confirmed working on this machine:

  • Scheme evaluation
  • module resolution
  • file I/O
  • process management with primitive-fork
  • TCP sockets on loopback
  • FFI into libc
  • loading and executing Guix bootstrap module code

This is enough to justify proceeding with the next Guix porting steps on FreeBSD.

2. Negative: system* and open-pipe* currently crash

These commands segfaulted on this host:

guile3 -c '(system* "/usr/bin/true")'
guile3 -c '(use-modules (ice-9 popen)) (open-pipe* OPEN_READ "/usr/bin/true")'

Observed exit status:

exit:139

This is a significant portability issue because Guix and related tooling commonly rely on subprocess helpers in this area.

3. Packaging detail: no unversioned guile executable

The FreeBSD package provides guile3 and guile-3.0, but not an unversioned guile binary in PATH. Any automation should invoke guile3 or detect one of the provided versioned names.

Assessment against plan item 1.1

Achieved now

  • Verified Guile availability on FreeBSD amd64
  • Built a reusable verification suite for repeated testing
  • Confirmed module loading, file I/O, processes, sockets, and FFI
  • Confirmed execution of Guix bootstrap-related Scheme code from make-bootstrap.scm
  • Confirmed deterministic output for a fixed Scheme workload

Still missing for full completion of 1.1

  • Verification on i386
  • Broader bootstrap coverage beyond copy-linux-headers
  • Linux vs. FreeBSD output comparison from the same suite
  • Root-cause analysis or workaround for system* / open-pipe* crashes

Before moving deeply into daemon and build-system work, investigate the FreeBSD Guile subprocess crash (system* / open-pipe*). If it is a Guile-on-FreeBSD issue rather than a local packaging issue, document a minimal reproducer and determine whether Guix can avoid those code paths or needs a local patch.