You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Undefined symbols for architecture arm64:
"_require", referenced from: perry_fn_..._warmAndSummarize ...
Mechanism
A body-less declare function require(...) has always been registered as an external FFI declaration (register_imported_func) by lower_module_fn.rs — the generic "no body ⇒ extern" rule.
fix(cjs-wrap): stop HIR from dropping built-in require bindings in wrapped modules #8343 added require_is_shadowed_by_local, which bails out of that destructuring path when lookup_imported_func("require") is Some — which the ambient declare makes true. The call now falls through to plain call lowering, resolves to the "imported func" require, and codegen emits a call to the symbol require, which no archive defines (it was always a compile-time intrinsic).
Blast radius: test-files/test_issue_8002_8003_thread_realm_caches.ts (COMPILE_FAIL in the 08-19 dispatch run 32298711372: compile-smoke red + one of parity's 27 compile_fails). Any user code using the ambient-declare idiom hits the same wall.
Fix direction: an ambient declare function requirenames the global intrinsic — it must not register as an FFI extern. #8343's CJS-wrap shadowing (a synthetic function require(...)with a body) is unaffected: that registers via register_func/locals, which correctly keeps shadowing.
Reproduced locally on a 0.5.1512 binary (macOS arm64); same failure as CI's Linux undefined reference to 'require'.
Since #8343 (6674f59, 2026-08-18), a module that carries the standard TypeScript ambient declaration
fails to link:
Mechanism
declare function require(...)has always been registered as an external FFI declaration (register_imported_func) bylower_module_fn.rs— the generic "no body ⇒ extern" rule.const x = require("<builtin>")shape: the destructuring var-decl pass consumed the call into a native-module namespace binding before call lowering, so the FFI registration was never consulted.require_is_shadowed_by_local, which bails out of that destructuring path whenlookup_imported_func("require")is Some — which the ambient declare makes true. The call now falls through to plain call lowering, resolves to the "imported func"require, and codegen emits a call to the symbolrequire, which no archive defines (it was always a compile-time intrinsic).Blast radius:
test-files/test_issue_8002_8003_thread_realm_caches.ts(COMPILE_FAIL in the 08-19 dispatch run 32298711372: compile-smoke red + one of parity's 27 compile_fails). Any user code using the ambient-declare idiom hits the same wall.Fix direction: an ambient
declare function requirenames the global intrinsic — it must not register as an FFI extern. #8343's CJS-wrap shadowing (a syntheticfunction require(...)with a body) is unaffected: that registers viaregister_func/locals, which correctly keeps shadowing.Reproduced locally on a 0.5.1512 binary (macOS arm64); same failure as CI's Linux
undefined reference to 'require'.