stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.64k stars 1.56k forks source link

Fix building with standalone sqlite3 >= 3.30.0 #970

Closed bmwalters closed 4 years ago

bmwalters commented 4 years ago

Problem

When using SQLite.swift/standalone with sqlite3 pod version >= 3.30.0, attempting to build the project results in "ambiguous use" warning in Xcode pointing here.

Solution

SQLite 3.30.0 changed the definition of SQLITE_DETERMINISTIC:

-#define SQLITE_DETERMINISTIC    0x800
+#define SQLITE_DETERMINISTIC    0x000000800

Meaning that the (older) system sqlite3 library and the pod have different definitions, even though they're the same value.

We've been importing the system SQLite3 module in SQLiteObjc.h even when linking against standalone sqlite.

I added a check to SQLiteObjc.h to import the sqlite3 pod when we're using it, instead of always importing the system module.

This leads to there being only one definition in scope.

ryanholden8 commented 4 years ago

Running into the same issue. Thank you for the solution!

jberkel commented 4 years ago

Thanks, I've just run into this as well.