fix(geisterhand): link the geisterhand-built stdlib, not the auto-optimized one (#1383)#2315
Merged
Merged
Conversation
…imized one (#1383) PR #1385 fixed the BUILD half of #1383 by adding `-p perry-stdlib` to the single geisterhand cargo invocation, so a geisterhand-featured, async-enabled `libperry_stdlib.a` lands in target/geisterhand with a hash-consistent perry-runtime. But the LINK half was still broken: the stdlib actually linked under `--enable-geisterhand` was the auto-optimized one, built with `--no-default-features` and a feature set derived from the app's *TS* imports. For a geisterhand UI app whose async surface comes from a native binding (@perryts/storekit / google-auth / play-billing — all using `perry_ffi::async_runtime::JsPromise`) rather than TS, auto-optimize never enables `async-runtime`, so the linked stdlib lacks `perry_ffi_promise_*` and the link fails with `Undefined symbols: _perry_ffi_promise_new`. Fix: - Add `find_geisterhand_stdlib(target)` (mirrors `find_geisterhand_runtime`): searches only the target/geisterhand build dirs, so it returns the geisterhand-built stdlib (full default features incl. async-runtime) and never the auto-optimized one. - In compile.rs, when `ctx.needs_geisterhand`, select that stdlib for the link (falling back to the auto-optimized stdlib if absent). This also keeps the bundled perry-runtime hash-consistent with `gh_runtime`. - Include the geisterhand stdlib in the `gh_missing` cold-build check (both the compile.rs runtime-selection site and the link/mod.rs link site) so a stale target/geisterhand dir built before the stdlib was added triggers a rebuild instead of silently falling back.
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.
Summary
Fixes the remaining link-side half of #1383. PR #1385 already fixed the build side (
-p perry-stdlibis in the geisterhand cargo invocation), but the stdlib that actually got linked under--enable-geisterhandwas still the auto-optimized one.The auto-optimized stdlib is built
--no-default-featureswith a feature set derived from the app's TS imports. A geisterhand UI app pulls its async surface from a native binding (@perryts/storekit/google-auth/play-billing, all usingperry_ffi::async_runtime::JsPromise), not TS — so auto-optimize never enablesasync-runtime, the linked stdlib lacksperry_ffi_promise_*, and the link dies with:Fix
find_geisterhand_stdlib(target)— new finder mirroringfind_geisterhand_runtime; searches only thetarget/geisterhand/…dirs, so it returns the geisterhand-built stdlib (full default features incl.async-runtime, sharing a hash-consistentperry-runtime) and never the auto-optimized one.compile.rs— whenctx.needs_geisterhand, select that stdlib for the link (falling back to the auto-optimized stdlib if absent). Keeps the bundledperry-runtimehash-consistent withgh_runtime.gh_missingcold-build check (both the compile.rs runtime-selection site and the link/mod.rs link site) now includes the geisterhand stdlib, so a staletarget/geisterhanddir built before the stdlib was added rebuilds instead of silently falling back.Verification
cargo build --release -p perry— compiles clean (no new warnings/errors).cargo fmt --all -- --check— clean.@perryts/*native-binding crates, which aren't available in this environment. The change is gated onctx.needs_geisterhandand falls back to prior behavior when no geisterhand stdlib is present, so non-async geisterhand links are unaffected.Closes #1383.