Skip to content

express link-fails: js_node_http_create_server codegen'd but perry-ext-http-server not linked #846

Closed

Description

@proggeramlug

Surfaced trying tier2 npm package express under the #805 sweep.

Repro

```bash
mkdir /tmp/perry-express && cd /tmp/perry-express
cat > package.json <<'JSON'
{"name":"d","private":true,"type":"module","dependencies":{"express":"*"},"perry":{"compilePackages":["express"]}}
JSON
npm install
cat > main.ts <<'TS'
import express from "express";
const app = (express as any)();
console.log(typeof app.get);
TS
perry main.ts -o out
```

Failure

```
Undefined symbols for architecture arm64:
"_js_node_http_create_server", referenced from:
_perry_closure_node_modules_express_lib_application_js__31 in node_modules_express_lib_application_js.o
Error: Linking failed
```

Diagnosis

`js_node_http_create_server` is exported by `crates/perry-ext-http-server/src/server.rs` — not `perry-runtime` or `perry-stdlib`, but a `perry-ext-*` crate.

The codegen declares the function (`crates/perry-codegen/src/runtime_decls.rs:1626`) and emits a call site for it (`lower_call.rs:9559`) when compiled-package code uses Node's `http.createServer` — but the link step has no idea `libperry_ext_http_server.a` is needed, so it's not linked.

This is the same class of bug as #835 (stream FFIs), one layer deeper: there are 35+ `perry-ext-` crates, each with its own `js_` FFI exports. The codegen emits calls to them based on user code shape, but the manifest doesn't know that emitting a call to symbol X implies linking library Y.

Fix scope

Aligns with the proposal in #835: track each `js_*` FFI's source library at the codegen call site (`ctx.needs_ext_http_server = true` when emitting a call to `js_node_http_create_server`, analogous to `needs_thread` / `needs_plugins`). The set of side-effect flags can be auto-derived from the manifest by labeling each entry with its providing crate.

Closing this individually rather than rolling into #835 because the fix has to cover the whole `perry-ext-*` set, not just stdlib.

Part of #793 + #805. Surfaced by the #805 npm sweep on tier2.

Activity

  1. added
    bugConfirmed defect or regression
    parityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem
    on May 16, 2026
  2. added 2 commits that reference this issue on May 16, 2026
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

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions