Page MenuHomePhabricator

Bump SQLCipher Amalgamation version to enable sqlite3 session extension
ClosedPublic

Authored by marcin on Jan 26 2024, 6:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 5:37 AM
Unknown Object (File)
Mar 15 2024, 9:53 AM
Unknown Object (File)
Mar 9 2024, 10:58 AM
Unknown Object (File)
Mar 7 2024, 12:32 PM
Unknown Object (File)
Mar 7 2024, 11:52 AM
Unknown Object (File)
Mar 6 2024, 10:44 PM
Unknown Object (File)
Feb 22 2024, 3:28 AM
Unknown Object (File)
Feb 22 2024, 2:40 AM
Subscribers

Details

Summary

This differential patches SQLCipher amalgamation to enable sqlite 3 session extension usage and to enfore XCode to use sqlite3.h header from SQLCipher
amalgamation instead of sqlite3.h provided by the system.

I don't plan to land this diff, but to make a release of SQLCipher-amalgamation updated with changes in this diff.
EDIT:
This differential bumps sqlcipher-amalgamation version. New version contains changes that force XCode look for sqlite3.h in SQLCipher-amalgamation sources directory instead of its own system-provided header file. XCode system provided header file is very outdated and doesn't contain definitions associated with sqlite 3 session extension.

Adding @ashoat as reviewer since it affects project dependencies.

Test Plan
  1. Build iOS app.
  2. Click "Jump to Definition" on sqlite3.h header. Ensure we are directed to sqlite3.h provided by SQLCipher amalgamation instead of sqlite3.h from the system.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/package.json
53 ↗(On Diff #36160)

I updated from ^4.5.5-b to ^4.5.5-c since ^4.5.5-b is not "patchable" (see here).

patches/@commapp+sqlcipher-amalgamation+4.5.5-c.patch
11–12 ↗(On Diff #36160)

This is explicit requirement from SQLite Session Extension docs

25–26 ↗(On Diff #36160)

I found that when we #include <sqlite3.h> XCode links it to sqlite3.h header provided by the system. Unfortunately this header doesn't provide type and function definitions necessary for sqlite session extension. It is clearly a mistake made by Apple since they claim that every iOS version since 11.0 uses sqlite version greater than or equal to 3.19.3 whereas sqlite session extension is available since sqlite version 3.13.0.

XCode uses system provided headers as a last resort so we can make it use header from amalgamation if we include path to it in HEADER_SEARCH_PATHS.

ashoat added 1 blocking reviewer(s): bartek.

How about Android?

patches/@commapp+sqlcipher-amalgamation+4.5.5-c.patch
20 ↗(On Diff #36160)

What does this change achieve?

23 ↗(On Diff #36160)

Wondering why we need the flags both here and in compiler_flags above

patches/@commapp+sqlcipher-amalgamation+4.5.5-c.patch
20 ↗(On Diff #36160)

Actually this change is not necessary. According to docs it enables XCode to create mapping from header filename to header file path without using HEADER_SEARCH_PATH. But in our case we use HEADER_SEARCH_PATH to link against correct sqlite3.h so this change is not necessary. I tested that code (entire stack not just this diff) compiles and works if it is removed.

23 ↗(On Diff #36160)

Actually after some research I think we don't have to. According to CocoaPods docs the compiler_flags property of podspec tells the XCode to set those flags when compiling the particular pod files. According to apple docs setting OTHER_CFLAGS in this podspec sets those flags globally for all C, C++, Obj-C++ files. I don't think it has ever been an issue - it was just unnecessary. I tested the entire stack after removing OTHER_CFLAGS entry.

  1. Bring back USE_HEADERMAP to "NO"
  2. Remove OTHER_CFLAGS from xcconfig as it is not necessary. compiler_flags is enough.
This revision is now accepted and ready to land.Feb 1 2024, 7:27 AM
marcin retitled this revision from Patch SQLCipher Amalgamation to enable sqlite3 session extension to Bump SQLCipher Amalgamation version to enable sqlite3 session extension.Feb 9 2024, 3:43 AM