Repository navigation
libsql-ffi: do not compile pcre2_internal.h on Apple targets - #57
Draft
tszymczyszyn-shopify wants to merge 1 commit into
Draft
tszymczyszyn-shopify wants to merge 1 commit into
tszymczyszyn-shopify wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS, anything that links against
libsql-ffiwith thesqlean-extension-regexpfeature fails with undefined_sqlite3_*symbols.libsql-serverenables that feature throughsqlean-extensions, socargo test -p libsql-serverdoes not link on a Mac.build_bundledpassesregexp/pcre2/pcre2_internal.hto the C compiler as a source file (added in a35fd1a). The compiler emits a precompiled header, not an object file, and it is archived intoliblibsql.a. Apple'sarwarns (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
TARGETis 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):
liblibsql.aregexp.o_sqlite3_openand_pcre2_compile_8defined in the archiveranlib"not a mach-o file" warningcargo test -p libsql-server --no-run_sqlite3_*symbolsrustfmt --checkpasses. Linux behaviour is covered by CI; the change does not alter the file list there.