From f1bcd56b4257a140bc98a984f8a1d070d0dd1fab Mon Sep 17 00:00:00 2001 From: Tomasz Szymczyszyn Date: Wed, 14 Oct 2026 22:55:03 +0200 Subject: [PATCH] libsql-ffi: do not compile pcre2_internal.h on Apple targets 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. --- libsql-ffi/build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libsql-ffi/build.rs b/libsql-ffi/build.rs index ceda2a6794..8dfaaca16e 100644 --- a/libsql-ffi/build.rs +++ b/libsql-ffi/build.rs @@ -255,7 +255,13 @@ pub fn build_bundled(out_dir: &str, out_path: &Path) { if cfg!(feature = "sqlean-extension-regexp") { enabled_extensions.push("regexp"); sqlean_patterns.push("regexp/*.c"); - sqlean_patterns.push("regexp/pcre2/pcre2_internal.h"); + // This header is passed to the compiler as a source file, which produces a + // precompiled header instead of an object file. On Apple targets `ar` then + // drops the archive members that follow it and linking fails with missing + // symbols, so pass it only on other targets. + if !env::var("TARGET").map_or(false, |v| v.contains("apple")) { + sqlean_patterns.push("regexp/pcre2/pcre2_internal.h"); + } sqlean_patterns.push("regexp/pcre2/*.c"); }