fix(ios): resolve SQLite linking conflicts with pkgx
Fixes iOS build failures caused by linker picking up macOS SQLite libraries from pkgx instead of iOS system SQLite, resulting in undefined symbol errors for all sqlite3 functions. Changes: - Explicitly link system SQLite library (-lsqlite3) in podspec - Detect and unset pkgx environment variables during iOS builds - Add warnings to guide users if manual intervention needed The issue occurs when pkgx (or similar package managers) set DYLD_LIBRARY_PATH or PKGX_DIR, causing the linker to find macOS SQLite dylibs at /Users/*/.pkgx/sqlite.org/*/lib/libsqlite3.0.dylib instead of the iOS system SQLite library. This fix ensures the iOS build always uses the correct system SQLite library regardless of environment variable interference.
This commit is contained in:
@@ -11,7 +11,13 @@ Pod::Spec.new do |s|
|
||||
s.dependency 'Capacitor', '>= 5.0.0'
|
||||
s.dependency 'CapacitorCordova', '>= 5.0.0'
|
||||
s.swift_version = '5.1'
|
||||
s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1' }
|
||||
# Explicitly link against system SQLite library to avoid conflicts with
|
||||
# macOS SQLite libraries (e.g., from pkgx or other package managers that
|
||||
# may set DYLD_LIBRARY_PATH or similar environment variables)
|
||||
s.xcconfig = {
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
|
||||
'OTHER_LDFLAGS' => '$(inherited) -lsqlite3'
|
||||
}
|
||||
s.deprecated = false
|
||||
# Set to false so Capacitor can discover the plugin
|
||||
# Capacitor iOS does not scan static frameworks for plugin discovery
|
||||
|
||||
Reference in New Issue
Block a user