Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for Extension Loading #64

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ For example: ([GRDB.swift](https://github.com/groue/GRDB.swift)).

## Customization:

By default, SQLiteLib builds SQLite with options that match the built-in system version of SQLite on OSX and iOS (as of OSX 10.11.6, iOS 9.3.5), [with one exception*](#additional-details).
By default, SQLiteLib builds SQLite with options that match the built-in system version of SQLite on OSX and iOS (as of OSX 10.11.6, iOS 9.3.5), [with two exception*](#additional-details).


#### Specifying Additional SQLite Compilation Options:
Expand Down Expand Up @@ -125,24 +125,24 @@ The built-in OSX/iOS version of SQLite were built with the following compilation
- `SYSTEM_MALLOC`
- `THREADSAFE=2`

SQLiteLib uses these settings with one exception - on iOS:
These settings are reused, with two exceptions.

The SQLite code uses a deprecated function (`gethostuuid()`).
- SQLiteLib does not use `OMIT_LOAD_EXTENSION`, allowing applications to load SQLite extensions.
- SQLiteLib uses `SQLITE_ENABLE_LOCKING_STYLE=1` on OSX, **but on iOS, SQLiteLib compiles with `ENABLE_LOCKING_STYLE=0`**.

D. Richard Hipp (SQLite architect), suggests working around this on iOS using `-DSQLITE_ENABLE_LOCKING_STYLE=0`:
> "The SQLITE_ENABLE_LOCKING_STYLE thing is an apple-only extension that
> boosts performance when SQLite is used on a network filesystem. This
> is important on MacOS because some users think it is a good idea to
> put their home directory on a network filesystem.
>
> I'm guessing this is not really a factor on iOS."
The reason for this is that the SQLite code uses a deprecated function (`gethostuuid()`).

Thus, SQLiteLib uses `SQLITE_ENABLE_LOCKING_STYLE=1` on OSX,
**but on iOS, SQLiteLib compiles with `ENABLE_LOCKING_STYLE=0`**.
D. Richard Hipp (SQLite architect), suggests working around this on iOS using `-DSQLITE_ENABLE_LOCKING_STYLE=0`:
> "The SQLITE_ENABLE_LOCKING_STYLE thing is an apple-only extension that
> boosts performance when SQLite is used on a network filesystem. This
> is important on MacOS because some users think it is a good idea to
> put their home directory on a network filesystem.
>
> I'm guessing this is not really a factor on iOS."

This removes the code that uses the deprecated function, but doesn't get rid of the warning that "`gethostuuid() is disabled`".
This removes the code that uses the deprecated function, but doesn't get rid of the warning that "`gethostuuid() is disabled`".

To prevent this warning, SQLiteLib separately specifies `-Wno-#warnings` when building for iOS.
To prevent this warning, SQLiteLib separately specifies `-Wno-#warnings` when building for iOS.

All of these base settings are configured in the SQLiteLib.xcconfig file.
It is strongly recommended that you do not edit this file. If you'd like to specify additional compilation options, see [the instructions above](#specifying-additional-sqlite-compilation-options).
Expand Down
2 changes: 1 addition & 1 deletion SQLiteLib.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ SUPPORTED_PLATFORMS = iphonesimulator macosx iphoneos appletvsimulator appletvos

// The common set of compilation options (on OSX and iOS).
// NOTE: To add more compilation options, see SQLiteLib-USER.xcconfig.
SQLLIBRARY_BASE_CFLAGS = -DSQLITE_ENABLE_API_ARMOR -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_OMIT_AUTORESET -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_SYSTEM_MALLOC -DSQLITE_THREADSAFE=2 -DSQLITE_OS_UNIX=1 $(CUSTOM_SQLLIBRARY_CFLAGS)
SQLLIBRARY_BASE_CFLAGS = -DSQLITE_ENABLE_API_ARMOR -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_OMIT_AUTORESET -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_SYSTEM_MALLOC -DSQLITE_THREADSAFE=2 -DSQLITE_OS_UNIX=1 $(CUSTOM_SQLLIBRARY_CFLAGS)

SQLLIBRARY_OSX_ADDITIONAL_CFLAGS = -DSQLITE_ENABLE_LOCKING_STYLE=1
SQLLIBRARY_IOS_ADDITIONAL_CFLAGS = -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_MAX_MMAP_SIZE=0
Expand Down