Sbcl librarian runtime - #57
Draft
BatmanAoD wants to merge 12 commits into
Draft
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BatmanAoD
force-pushed
the
sbcl-librarian-runtime
branch
from
August 12, 2026 03:10
0c5c26c to
5fb2a7d
Compare
Moves off the 2023 sbcl-librarian pin, which also unblocks modern SBCL. libquil is now the generated C bindings only; the Lisp image lives in a core loaded by the libsbcl_librarian runtime, whose constructor initializes Lisp when it is loaded. The explicit init(core) call is gone, as is libquil's hand-rolled error handling. libquil keeps shipping a core rather than the FASL bundles that CREATE-FASL-LIBRARY-CMAKE-PROJECT produces. FASL bundles are re-loaded on every startup, re-running load-time code, and cl-quil resolves stdgates.quil through ASDF:SYSTEM-RELATIVE-PATHNAME at load time -- so a FASL build only runs where quilc's source tree sits at the path recorded when it was built. A core evaluates that once, at build time. build-image.lisp emits three things from one image: libquil's bindings, the runtime's bindings, and the core exporting both sets of callables. The Makefile builds the runtime too, so plain 'make' still yields a usable artifact. Errors move to the runtime's get_error_message/lisp_err_t. libquil redefines default-error-map so ordinary bad input reports as LISP_ERR_FAILURE rather than an internal bug, handling T rather than CL:ERROR because cl-quil signals conditions that are not subtypes of ERROR. REARCHITECTURE.md records the decisions. Needs three sbcl-librarian fixes, on its fix-secondary-system-bundles branch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- build.yml builds SBCL $SBCL_VERSION (2.6.7) with --with-sb-linkable-runtime,
replacing the sbcl-2.2.4 build that failed in make-host-1 ('undefined variable:
SB-VM::END') because a current host SBCL cannot cross-compile a 2022 target.
sbcl-librarian's repo and ref are workflow inputs, since libquil needs three
fixes that are not upstream yet.
- The artifact is now the bindings library, its header and the whole runtime
directory: libsbcl_librarian, libquil.core, libsbcl.so and the runtime headers.
install.sh and the release archives follow, with libquil.core installed beside
libsbcl_librarian because the runtime finds its core relative to itself.
- The examples drop their init(core) calls and -pagezero_size, link the runtime,
and use get_error_message/lisp_err_t.
- The redundant quickload steps before make are gone; build-image.lisp does it.
Verified by simulating package -> zip -> install and running the libquil-sys
suite against the installed layout.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BatmanAoD
force-pushed
the
sbcl-librarian-runtime
branch
2 times, most recently
from
August 12, 2026 03:18
3297949 to
8fec83f
Compare
magicl looks for Homebrew's reference LAPACK first and otherwise falls back to a bare liblapack.dylib, which on macOS resolves to Accelerate's. Neither works: the reference build returns incorrect eigenvectors on arm64, failing with 'Could not find diagonalizer for matrix ... after 16 attempts', and Accelerate's LAPACK predates 3.3 so routines quilc calls are missing, failing with 'The alien function zuncsd_ is undefined'. OpenBLAS is correct and complete. Loading it first means its symbols are the ones that resolve, and because SBCL records loaded shared objects in the core and reloads them at startup, the choice is baked into the artifact instead of depending on what the loader happens to find. Verified against a stock magicl checkout with Homebrew's lapack installed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BatmanAoD
force-pushed
the
sbcl-librarian-runtime
branch
8 times, most recently
from
August 12, 2026 04:04
47329b2 to
ccce870
Compare
Cutting a prerelease from a branch produced a tag pointing at the wrong code.
knope 0.10/0.11 create the GitHub release against the default branch, so the
version bump landed on the branch while the tag landed on main -- and the publish
job, which checks out whatever that tag resolves to, then tried to republish main's
already-released version:
error: crate libquil-sys@0.4.2 already exists on crates.io index
Adopt the setup rigetti-pyo3 arrived at (36a1850, 9b5235c, 3505971):
- knope 0.23, which tags the ref being released and takes --prerelease-label, so
the separate prerelease workflow in knope.toml is no longer needed;
- the ref decides what gets cut: main releases, anything else prereleases;
- check out ${{ github.ref }} so a release acts on the dispatched branch;
- pass the token to the Release step through GITHUB_TOKEN, which is how it
authenticates;
- dry-run the release on pull requests, so a broken config is visible before it is
dispatched.
The publish job now checks out the release tag explicitly, so it always publishes
exactly what was tagged rather than whatever the target commitish points at.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BatmanAoD
force-pushed
the
sbcl-librarian-runtime
branch
2 times, most recently
from
August 13, 2026 15:22
85ca44b to
b785c52
Compare
… root Two problems with installing a release: magicl loads BLAS and LAPACK at runtime under their unversioned names, libblas.so and liblapack.so, so a missing one does not surface at install or link time: it surfaces much later, in the middle of compiling a program. Check for them before anything is downloaded, and name the ones that are missing. The unversioned names are also why a runtime-only package is not enough -- Debian's libblas3 provides libblas.so.3 and no unversioned symlink -- so say that in the requirements, which is the part users get wrong. Drop libz from the requirements while there: nothing in the release artifacts refers to it. Container images commonly run as root with no sudo installed, where every sudo call here fails with "sudo: command not found" even though nothing needs elevating. That is how CI installs libquil, so the installer was unusable there. Resolve sudo once: empty when already root, sudo when available, and a clear error when neither. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BatmanAoD
force-pushed
the
sbcl-librarian-runtime
branch
from
August 13, 2026 15:23
b785c52 to
b163826
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
more comprehensive alternative to #56 (close that if this is merged)