react-native-quick-sqlite
react-native-quick-sqlite copied to clipboard
Expo SDK49 upgrade errors
After upgrading to SDK49 I started getting the following error when using expo run:ios
:
❌ (ios/Pods/Headers/Public/react-native-quick-sqlite/sqlite3.h:723:8)
721 | */
722 | typedef struct sqlite3_file sqlite3_file;
> 723 | struct sqlite3_file {
| ^ redefinition of 'sqlite3_file'
724 | const struct sqlite3_io_methods *pMethods; /* Methods for an open file */
725 | };
726 |
This is an excerpt of the full error, as this block repeats for the various SQLite structs. Reverting to SDK48 solves the problem.
Having the same error without expo.
~expo-sqlite
now uses JSI and so I believe this package can be replaced by that. For who wants to migrate, expo-sqlite
creates the database files in documentDirectory + "SQLite"
, so you'll need to do some file moving.~
Update: I tried replacing by expo-sqlite
but it has inconsistent SQLite versions on Android and iOS, so I reverted to quick-sqlite and SDK48. Also, created this issue https://github.com/expo/expo/issues/23970
I was experiencing this. Seems it was a conflict with the headers of the native sqlite version on IOS
You should be able to solve it using this part of the docs
I just added the env var to my eas.json
{
"production": {
"distribution": "store",
"env": {
"STAGE": "production",
"FLIPPER_DISABLE": "1",
"QUICK_SQLITE_USE_PHONE_VERSION": "1"
},
"channel": "production"
}
}
You should be able to solve it using this part of the docs
Beware that while this is a feasible solution for some use cases, it will result in inconsistent SQLite versions across iOS and Android. It's the same problem that I had with with expo-sqlite
.
I'm having the same kind of errors :
/app/ios/Pods/Headers/Public/react-native-quick-sqlite/sqlite3.h:723:8: error: redefinition of 'sqlite3_file'
struct sqlite3_file {
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/usr/include/sqlite3.h:736:8: note: previous definition is here
struct sqlite3_file {
^
I chime in also face this issue with Expo SDK 49 that I would need with MacOS Sonoma
If I check the header files for the embedded sqlite version for iOS, I see that there is the following ifndef
:
#ifndef _SQLITE3_H_
But in this lib there is the following one:
#ifndef SQLITE3_H
So I created the following patch to use with patch-package:
react-native-quick-sqlite+8.0.5.patch
And the app now builds on my side. I'm unsure if this is dangerous or not!
And the app now builds on my side. I'm unsure if this is dangerous or not!
This will solve duplicated versions of SQLite but it will also cause the OS SQLite version to be used, resulting in inconsistent SQLite versions across iOS and Android.
To be even more precise here, it will use the “first version found” which could be either the OS one or the one embedded in this package, as it depends on the order of compilation
@derekstavis got it. I was printing SQLite version and it printed the one embedded in the lib, but I see what you mean and that could def be dangerous. Any idea why the headers started conflicting while it was ok before though?
I think Expo started embedding their expo-sqlite library by default on their GO version. So it looks like they are importing the OS embedded version. At least that was what I saw went testing the recent versions of Expo. Nothing wrong with this library, in any case, they need to only import the library when expo-sqlite is used.