Verify Crystal stdlib is installed #60

Closed
opened 2026-10-18 15:28:59 +00:00 by alex · 2 comments
Owner

Agents runs involving Crystal produce consistently this message:

"Note: the Crystal stdlib is missing in this sandbox, so the suite couldn't run locally — CI is the first to exercise it."

Let's verify we're installing it properly.

Agents runs involving Crystal produce consistently this message: "Note: the Crystal stdlib is missing in this sandbox, so the suite couldn't run locally — CI is the first to exercise it." Let's verify we're installing it properly.
alex changed title from ?3 to Verify Crystal stdlib is installed 2026-10-18 15:29:18 +00:00
Author
Owner

/pi verify and, if fixes are needed, create a PR

/pi verify and, if fixes are needed, create a PR
Contributor

Found the root cause. The Crystal binary looks up its stdlib relative to its own location ($ORIGIN/../share/crystal/src), but the Containerfile relocates the binary to /usr/local/bin while copying the stdlib to /usr/share/crystal — so the stdlib is present in the image but never found. Verified locally: copying binary to /usr/local/bin + stdlib to /usr/local/share/crystal makes crystal run and crystal build work. Applying the fix:Reproduced the exact failure mode with the old layout (Error: can't find file 'prelude'), and confirmed the fix works. Creating the PR:Verified the issue and opened PR #61 with the fix.

Root cause

The Crystal binary locates its stdlib and libgc relative to its own path ($ORIGIN/../share/crystal/src and $ORIGIN/../lib/crystal). The Containerfile copies the binary to /usr/local/bin, so it looks in /usr/local/share/crystal/src — but the stdlib was copied to /usr/share/crystal. Result: the files were in the image but the compiler never found them, failing with Error: can't find file 'prelude' — which agents reported as "the stdlib is missing".

Verification performed

  • Extracted the actual crystallang/crystal:1 image filesystem and confirmed the binary's $ORIGIN-relative lookup paths (found via strings on the binary).
  • Reproduced the exact failure (can't find file 'prelude') with the old layout (binary in /usr/local/bin, stdlib in /usr/share/crystal).
  • Confirmed the fix works: with the stdlib at /usr/local/share/crystal, crystal --version, crystal run, and crystal build all succeed.

Fix (PR #61)

  • Copy stdlib to /usr/local/share/crystal and libgc to /usr/local/lib/crystal, matching the binary's lookup paths.
  • Add a build-time smoke test (crystal run of a one-liner) so a broken stdlib now fails the image build immediately instead of surfacing later in agent runs.

PR: #61


View action run | Model: zai/glm-5.3-flash (thinking: low) | Time: 4m 56s | Tokens: 294.6K | Cost: $0.01 | Pi SDK v1.2.0 | Action v2.30.0-develop (develop @ 4ddb1db)

<!-- pi-coding-agent-comment --> Found the root cause. The Crystal binary looks up its stdlib relative to its own location (`$ORIGIN/../share/crystal/src`), but the Containerfile relocates the binary to `/usr/local/bin` while copying the stdlib to `/usr/share/crystal` — so the stdlib is present in the image but never found. Verified locally: copying binary to `/usr/local/bin` + stdlib to `/usr/local/share/crystal` makes `crystal run` and `crystal build` work. Applying the fix:Reproduced the exact failure mode with the old layout (`Error: can't find file 'prelude'`), and confirmed the fix works. Creating the PR:Verified the issue and opened PR #61 with the fix. ## Root cause The Crystal binary locates its stdlib and libgc **relative to its own path** (`$ORIGIN/../share/crystal/src` and `$ORIGIN/../lib/crystal`). The Containerfile copies the binary to `/usr/local/bin`, so it looks in `/usr/local/share/crystal/src` — but the stdlib was copied to `/usr/share/crystal`. Result: the files were in the image but the compiler never found them, failing with `Error: can't find file 'prelude'` — which agents reported as "the stdlib is missing". ## Verification performed - Extracted the actual `crystallang/crystal:1` image filesystem and confirmed the binary's `$ORIGIN`-relative lookup paths (found via `strings` on the binary). - Reproduced the exact failure (`can't find file 'prelude'`) with the old layout (binary in `/usr/local/bin`, stdlib in `/usr/share/crystal`). - Confirmed the fix works: with the stdlib at `/usr/local/share/crystal`, `crystal --version`, `crystal run`, and `crystal build` all succeed. ## Fix (PR #61) - Copy stdlib to `/usr/local/share/crystal` and libgc to `/usr/local/lib/crystal`, matching the binary's lookup paths. - Add a build-time smoke test (`crystal run` of a one-liner) so a broken stdlib now fails the image build immediately instead of surfacing later in agent runs. PR: https://forge.l3x.in/alex/runner-image/pulls/61 --- [View action run](https://forge.l3x.in/alex/runner-image/actions/runs/187) | Model: zai/glm-5.3-flash (thinking: low) | Time: 4m 56s | Tokens: 294.6K | Cost: $0.01 | Pi SDK v1.2.0 | Action v2.30.0-develop (develop @ 4ddb1db)
alex closed this issue 2026-10-18 15:43:50 +00:00
Sign in to join this conversation.
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alex/runner-image#60
No description provided.