{"record":{"id":"a679fbfad8eac800","repo":"oven-sh/bun","slug":"please-run-make-compile-ffi-test-to-compile-the","errorCode":null,"errorMessage":"Please run `make compile-ffi-test` to compile the ffi test library","messagePattern":"Please run `make compile-ffi-test` to compile the ffi test library","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/snippets/ffi-overhead.mjs","lineNumber":229,"sourceCode":"    returns: \"int32_t\",\n    args: [\"ptr\"],\n  },\n  // cb_identity_neg_42_int64_t: {\n  // returns: \"int64_t\",\n  // args: [\"ptr\"],\n  // },\n\n  return_a_function_ptr_to_function_that_returns_true: {\n    returns: \"ptr\",\n    args: [],\n  },\n};\n\nvar opened;\ntry {\n  opened = dlopen(\"/tmp/bun-ffi-test.dylib\", types);\n} catch (e) {\n  throw new Error(\"Please run `make compile-ffi-test` to compile the ffi test library\");\n}\n\nconst {\n  symbols: {\n    returns_true,\n    returns_false,\n    return_a_function_ptr_to_function_that_returns_true,\n    returns_42_char,\n    returns_42_float,\n    returns_42_double,\n    returns_42_uint8_t,\n    returns_neg_42_int8_t,\n    returns_42_uint16_t,\n    returns_42_uint32_t,\n    returns_42_uint64_t,\n    returns_neg_42_int16_t,\n    returns_neg_42_int32_t,\n    returns_neg_42_int64_t,","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/snippets/ffi-overhead.mjs#L211-L247","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"# before: error on run\nbun bench/snippets/ffi-overhead.mjs\n# after: build fixture, then run\ncc -shared -fPIC -o /tmp/bun-ffi-test.dylib test/js/bun/ffi/ffi-test.c\nbun bench/snippets/ffi-overhead.mjs","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync('/tmp/bun-ffi-test.dylib')) {\n  throw new Error('Build the FFI fixture first: cc -shared -fPIC -o /tmp/bun-ffi-test.dylib test/js/bun/ffi/ffi-test.c');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["ffi","dlopen","native-library","benchmark","setup"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}