Skip to content

Keep sqlite3ext.h and sqlite-vec.h out of the public CSQLiteVec module - #13

Open
laurentbigsool wants to merge 1 commit into
jkrukowski:mainfrom
ArchipadDev:private-extension-headers
Open

laurentbigsool wants to merge 1 commit into
jkrukowski:mainfrom
ArchipadDev:private-extension-headers

Conversation

@laurentbigsool

Copy link
Copy Markdown

Problem

CSQLiteVec exposes the bundled sqlite3ext.h in its public include/ directory. When a target also imports the SDK's SQLite3 module (directly, or through an Objective-C header in a bridging header), Clang sees two definitions of sqlite3_api_routines and fails as soon as the SDK's SQLite differs from the bundled one:

.../iPhoneOS.sdk/usr/include/sqlite3ext.h:379:10: error: 'sqlite3_api_routines' has different definitions in different modules; first difference is definition in module 'SQLite3.Ext' found field
.../SQLiteVec/Sources/CSQLiteVec/include/sqlite3ext.h:375:1: note: but in 'CSQLiteVec' found end of class

Xcode 27.1 ships SQLite 3.54.0, which added str_truncate to the struct, against the bundled 3.51.0. #11 hit the same problem with an earlier SDK; bumping the amalgamation fixes it only until the next SDK update.

Change

  • Move sqlite3ext.h and sqlite-vec.h from Sources/CSQLiteVec/include/ to Sources/CSQLiteVec/. The Swift wrapper only uses core_vec_init from extinit.h, and sqlite-vec.c / extinit.c include these headers with quotes, so they resolve next to the sources.
  • deps.sh copies them to the new location.

The public module now contains only sqlite3.h and extinit.h, so it no longer conflicts with the SDK's SQLite3.Ext, whatever the SDK SQLite version.

Testing

  • swift test: 14 tests pass.
  • An iOS app importing both SQLite3 (via its bridging header) and SQLiteVec builds again with Xcode 27.1, and its SQLiteVec-based tests pass on the simulator.

Related: #11

The bundled sqlite3ext.h defines sqlite3_api_routines for the bundled SQLite.
When an app also imports the SDK's SQLite3 module, whose sqlite3ext.h comes
from a different SQLite version, Clang rejects the two definitions of the
struct ("has different definitions in different modules"). Xcode 27.1 ships
SQLite 3.54.0 against the bundled 3.51.0, so any target importing both fails.

The Swift wrapper only needs extinit.h, and sqlite-vec.c and extinit.c include
these headers with quotes, so they now sit next to the sources instead of in
include/. deps.sh copies them there too.

Co-Authored-By: Claude <noreply@anthropic.com>
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