Skip to content

Commit f0d15d1

Browse files
temporarily use csqlite as-is
1 parent 9c2cb29 commit f0d15d1

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.9
1+
// swift-tools-version: 6.1
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -77,7 +77,26 @@ let package = Package(
7777
),
7878
],
7979
dependencies: conditionalDependencies + [
80-
.package(url: "git@github.com:powersync-ja/CSQLite.git", revision: "init")
80+
.package(
81+
url: "https://github.com/sbooth/CSQLite.git",
82+
from: "3.50.4",
83+
traits: [
84+
.defaults,
85+
// CSQLite uses THREADSAFE=0 by default, which breaks PowerSync because we're using SQLite on
86+
// multiple threads (it can lead to race conditions when closing connections sharing resources
87+
// like shared memory, causing crashes).
88+
// THREADSAFE=2 overrides the default, and is safe to use as long as a single SQLite connection
89+
// is not shared between threads.
90+
// TODO: Technically, we should not use .defaults because there's a logical conflict between
91+
// the threadsafe options. Instead, we should spell out all defaults again and remove that
92+
// thread-safety option.
93+
// However, despite the docs explicitly saying something else, it looks like there's no way to
94+
// disable default traits anyway (XCode compiles sqlite3.c with the default option even without
95+
// .defaults being included here).
96+
"THREADSAFE_2",
97+
"ENABLE_SESSION"
98+
]
99+
)
81100
],
82101
targets: [
83102
// Targets are the basic building blocks of a package, defining a module or a test suite.

0 commit comments

Comments
 (0)