Compare commits

...

1 Commits

Author SHA1 Message Date
Claude Bot
ec0f811cc1 fix(sqlite): use correct library name on Linux
On Linux, dlopen("sqlite3", ...) fails because the library is installed
as "libsqlite3.so" not "sqlite3". This made bun:sqlite unusable on
Linux systems with system-installed SQLite.

Fixes #26629

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 14:31:38 +00:00
2 changed files with 20 additions and 1 deletions

View File

@@ -215,7 +215,7 @@ static const char* sqlite3_lib_path = "sqlite3.dll";
#elif OS(DARWIN)
static const char* sqlite3_lib_path = "libsqlite3.dylib";
#else
static const char* sqlite3_lib_path = "sqlite3";
static const char* sqlite3_lib_path = "libsqlite3.so";
#endif
static HMODULE sqlite3_handle = nullptr;

View File

@@ -0,0 +1,19 @@
import { expect, test } from "bun:test";
import { bunEnv, bunExe } from "harness";
// Regression test for https://github.com/oven-sh/bun/issues/26629
// bun:sqlite fails to locate the system SQLite library on Linux because
// it searched for "sqlite3" instead of "libsqlite3.so".
test("bun:sqlite should load the system SQLite library", async () => {
await using proc = Bun.spawn({
cmd: [bunExe(), "-e", "import Database from 'bun:sqlite'; new Database(':memory:'); console.log('ok')"],
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const [stdout, , exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
expect(stdout.trim()).toBe("ok");
expect(exitCode).toBe(0);
});