oven-sh/bun · error · Error
Please run `make compile-ffi-test` to compile the ffi test l
Error message
Please run `make compile-ffi-test` to compile the ffi test library
What it means
Setup error in the FFI-overhead benchmark. It calls dlopen('/tmp/bun-ffi-test.dylib', types) with a large symbol/type map; when dlopen throws (shared library missing, or it exists but does not export the expected symbols), the catch block rethrows this message instructing you to compile the fixture library first. Note: in this checkout there is no Makefile target named compile-ffi-test — the C fixtures live under test/js/bun/ffi/ (e.g. ffi-test.c) and must be compiled to that absolute path manually.
Source
Thrown at bench/snippets/ffi-overhead.mjs:229
returns: "int32_t",
args: ["ptr"],
},
// cb_identity_neg_42_int64_t: {
// returns: "int64_t",
// args: ["ptr"],
// },
return_a_function_ptr_to_function_that_returns_true: {
returns: "ptr",
args: [],
},
};
var opened;
try {
opened = dlopen("/tmp/bun-ffi-test.dylib", types);
} catch (e) {
throw new Error("Please run `make compile-ffi-test` to compile the ffi test library");
}
const {
symbols: {
returns_true,
returns_false,
return_a_function_ptr_to_function_that_returns_true,
returns_42_char,
returns_42_float,
returns_42_double,
returns_42_uint8_t,
returns_neg_42_int8_t,
returns_42_uint16_t,
returns_42_uint32_t,
returns_42_uint64_t,
returns_neg_42_int16_t,
returns_neg_42_int32_t,
returns_neg_42_int64_t,View on GitHub (pinned to 8c5296ac45)
Solutions
- Build the fixture into the expected location: `cc -shared -fPIC -o /tmp/bun-ffi-test.dylib test/js/bun/ffi/ffi-test.c` (adjust source/flags until every symbol in the snippet's `types` map is exported)
- Verify the artifact exists and exports the symbols: `ls -l /tmp/bun-ffi-test.dylib` and `nm -g /tmp/bun-ffi-test.dylib | grep returns_true`
- Re-run bench/snippets/ffi-overhead.mjs
- If dlopen still throws with the file present, diff the snippet's symbol list against the built library and recompile
Example fix
# before: error on run bun bench/snippets/ffi-overhead.mjs # after: build fixture, then run cc -shared -fPIC -o /tmp/bun-ffi-test.dylib test/js/bun/ffi/ffi-test.c bun bench/snippets/ffi-overhead.mjs
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'node:fs';
if (!existsSync('/tmp/bun-ffi-test.dylib')) {
throw new Error('Build the FFI fixture first: cc -shared -fPIC -o /tmp/bun-ffi-test.dylib test/js/bun/ffi/ffi-test.c');
} Prevention
- Gate FFI benches on existence of the shared library and print the compile command in the error instead of a bare 'run make'
- Keep the fixture build scripted (or check in a target) so /tmp cleanup cannot silently break the bench
- When dlopen fails despite the file existing, compare the symbols map against `nm -g` output before debugging Bun itself
When it happens
Trigger: Running bench/snippets/ffi-overhead.mjs before building /tmp/bun-ffi-test.dylib; /tmp being cleaned (macOS purges it periodically); building a library that lacks a symbol declared in the `types` map, which also makes dlopen throw.
Common situations: Fresh clone or rebooted machine; CI runner with a clean /tmp; Linux where the .dylib was never produced (the absolute path with .dylib extension still works for dlopen on Linux, but nothing built it).
Related errors
- openssl failed: ${stderr}
- Second buffer was modified
- Third buffer was modified
- bad result
- Expected ${expected} to be ${equal} for ${description}
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/a679fbfad8eac800.
Report an issue: GitHub.