Skip to content

iOS SQLite compiled with exqlite's defines, so FTS5 works on device (MOB-487) - #143

Merged
GenericJam merged 2 commits into
masterfrom
fix/MOB-487-sqlite-flags
Oct 15, 2026
Merged

GenericJam merged 2 commits into
masterfrom
fix/MOB-487-sqlite-flags

Conversation

@GenericJam

Copy link
Copy Markdown
Owner

Fixes MOB-487 (iOS half and the single definition; Android templates in GenericJam/mob_new#104, which must merge first: this PR's sync test reads mob_new master's templates in CI).

mob compiled exqlite's SQLite amalgamation with only -DSQLITE_THREADSAFE=1, so on the phone SQLite had no FTS5 (no such module: fts5) and none of exqlite's other features, while the host NIF (exqlite's Makefile) had them.

  • MobDev.Exqlite.defines/0 / cflags/0: exqlite's Makefile CFLAGS += -D… lines, verbatim and in order. The one definition for every mob_dev build of the NIF:
    • iOS simulator sqlite3_nif.so (cross_compile_exqlite_nif_sim)
    • iOS device sqlite3_nif.a, both objects (cross_compile_exqlite_nif_device)
    • mix mob.release --ios (release_device.sh, $SQLITE_CFLAGS)
  • MobDev.ExqliteTest: the set includes FTS5; equals the locked exqlite's Makefile set (exqlite added as a test-only dep with compile: false, app: false: source only, never built or loaded); equals the list in mob_new's Android build.zig.eex and CMakeLists.txt.eex (read via MobDev.Adopt.Generator.templates_root/1, as the -dead_strip test does).
  • CHANGELOG: Fixed + Upgrading (the Android lines existing apps add).

Verified with a throwaway mix mob.new --blank --local app (path deps on these worktrees) whose screen runs CREATE VIRTUAL TABLE t USING fts5(x), an INSERT and a MATCH through Exqlite:

before after
Android emulator (arm64) FTS5 ERROR "no such module: fts5" FTS5 OK rows=[["in the beginning"]]
iOS simulator (iOS 27) FTS5 ERROR "no such module: fts5" FTS5 OK rows=[["in the beginning"]]

iOS device path (no physical iPhone): compiled sqlite3.c with the iphoneos SDK and MobDev.Exqlite.cflags() exactly as cross_compile_exqlite_nif_device does; the object carries the FTS5 module (345 fts5 symbols, sqlite3RtreeInit). release_device.sh passes bash -n and both exqlite compiles use $SQLITE_CFLAGS.

Note: the set includes SQLITE_DQS=0, so the device, like the host, rejects double-quoted string literals.

…MOB-487)

The iOS simulator NIF, the iOS device sqlite3_nif.a and mix mob.release --ios
compiled exqlite's SQLite amalgamation with only -DSQLITE_THREADSAFE=1, so
FTS5 and exqlite's other features were missing on the phone. They now use
MobDev.Exqlite.cflags/0: exqlite's Makefile defines, verbatim. MobDev.ExqliteTest
pins the list against the locked exqlite's Makefile (exqlite added as a
test-only, never-compiled dep) and against mob_new's Android templates.
An installed mob_new archive or a stale ~/code/mob_new (templates_root/1's
other sources) can predate the define list (review).
@GenericJam

Copy link
Copy Markdown
Owner Author

Review: reviewer subagent (Codex rate-limited until 17:26 today): MERGE. First pass: one should-fix (ExqliteTest read mob_new templates through templates_root/1, which can hit an installed archive or stale ~/code/mob_new) and one nitpick (test-only exqlite dep pulls db_connection); both addressed in f5912ba. Re-review: MERGE, no findings. Companion GenericJam/mob_new#104 merged first; CI tests green on f5912ba (run 38808121786, 3036 tests, 0 failures, sync test ran against mob_new master).

@GenericJam
GenericJam merged commit db46955 into master Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant