Skip to content

libsql-ffi: do not compile pcre2_internal.h on Apple targets - #57

Draft
tszymczyszyn-shopify wants to merge 1 commit into
v0.9.30-shopify-patchesfrom
tszymczyszyn/macos-pcre2-header-link-fix
Draft

tszymczyszyn-shopify wants to merge 1 commit into
v0.9.30-shopify-patchesfrom
tszymczyszyn/macos-pcre2-header-link-fix

Conversation

@tszymczyszyn-shopify

Copy link
Copy Markdown

Problem

On macOS, anything that links against libsql-ffi with the sqlean-extension-regexp feature fails with undefined _sqlite3_* symbols. libsql-server enables that feature through sqlean-extensions, so cargo test -p libsql-server does not link on a Mac.

build_bundled passes regexp/pcre2/pcre2_internal.h to the C compiler as a source file (added in a35fd1a). The compiler emits a precompiled header, not an object file, and it is archived into liblibsql.a. Apple's ar warns (archive member '...-pcre2_internal.o' not a mach-o file) and drops every member after it: the rest of PCRE2 and the generated SQLite/sqlean source.

Change

Skip the header when TARGET is an Apple target. Other targets, including the Linux builds used for releases, get exactly the same file list as before.

Verification

On macOS (Xcode 26.5, Apple clang 21.0.0, ld-1267):

Check Without this change With this change
Members in liblibsql.a 39, ending at regexp.o 67
_sqlite3_open and _pcre2_compile_8 defined in the archive no yes
ranlib "not a mach-o file" warning yes no
cargo test -p libsql-server --no-run fails, undefined _sqlite3_* symbols links

rustfmt --check passes. Linux behaviour is covered by CI; the change does not alter the file list there.

build_bundled passes regexp/pcre2/pcre2_internal.h to the C compiler as a
source file. The compiler emits a precompiled header, not an object
file, and it lands in liblibsql.a. On Apple targets ar then drops every
archive member after it, including the rest of PCRE2 and the SQLite
amalgamation, so anything that links against libsql-ffi fails with
undefined _sqlite3_* symbols.

Skip the header only when the target is an Apple target. Other targets
get exactly the same file list as before.
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