Skip to content

OpenCode link fails on main: undefined __perry_wrap_perry_fn_…effect_src_Array_ts__Array_ (and PERRY_NO_AUTO_OPTIMIZE=1 hits a tokio archive mismatch) #10945

Description

@proggeramlug

Compiling OpenCode v1.18.30 (#10107) on current main fails at the link step with an undefined wrapper symbol. Codegen completes; only the link fails.

Undefined symbols for architecture arm64:
  "___perry_wrap_perry_fn_opencode_node_modules__bun_effect_4_0_0_beta_83_node_modules_effect_src_Array_ts__Array_",
  referenced from:
      _perry_closure_..._effect_src_Chunk_ts__25              in c316355eae28ea51.o
      _perry_closure_..._effect_src_Cron_ts__14               in a409843744941715.o
      _perry_closure_..._effect_src_internal_effect_ts__72    in 9c215f79c17003d8.o
      _perry_closure_..._effect_src_internal_effect_ts__541   in 9c215f79c17003d8.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
Error: Linking failed

Four closures across three effect modules reference the wrapper for effect/src/Array.ts's Array export, and it is not in any object handed to the linker.

Where it looks like it comes from

The log shows the auto-optimize pass rebuilding runtime+stdlib immediately before the failure:

auto-optimize: rebuilding runtime+stdlib (panic=abort, features=async-runtime,bundled-streams,crypto,…)

That pass internalizes and dead-strips, and the tree already carries #[used(compiler)] keepalive anchors specifically because it has dropped still-referenced symbols before (#4876 — "the auto-optimize internalize+dead-strip pass can't drop it"). A wrapper reached only from other modules' closures looks like the same class of victim.

PERRY_NO_AUTO_OPTIMIZE=1 is not a workaround

Turning the pass off replaces this with a different hard failure:

Error: error: the wrapper archive(s) below bundle a DIFFERENT tokio compilation
than the stdlib archive they would be linked with.

so there is currently no way to link this program on main: with auto-optimize the wrapper symbol is missing, without it the archives disagree about tokio.

Repro

perry compile src/index.ts --platform bun \
  --output <out> --cache-dir <dir> \
  --asset-module "opencode-web-ui.gen.ts=<repo>/packages/app/dist"

from packages/opencode of OpenCode v1.18.30 (perry.json defines per the tracking issue), macOS arm64, perry v0.5.1633 (0fa3915293, merge train 253). ~2h to reach the link step; the object cache is warm afterwards so a retry reaches it in minutes.

The same program links and runs on v0.5.1592, so this is a regression somewhere in 1592…1633.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions