react-native-quick-sqlite icon indicating copy to clipboard operation
react-native-quick-sqlite copied to clipboard

Expo SDK49 upgrade errors

Open derekstavis opened this issue 1 year ago • 10 comments

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.

derekstavis avatar Jul 30 '23 17:07 derekstavis

Having the same error without expo.

Jokerwolf avatar Aug 04 '23 16:08 Jokerwolf

~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

derekstavis avatar Aug 15 '23 02:08 derekstavis

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"
        }
  }

peterferguson avatar Aug 16 '23 18:08 peterferguson

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.

derekstavis avatar Aug 16 '23 22:08 derekstavis

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 {
       ^

nmalzieu avatar Aug 22 '23 14:08 nmalzieu

I chime in also face this issue with Expo SDK 49 that I would need with MacOS Sonoma

L-U-C-K-Y avatar Sep 29 '23 15:09 L-U-C-K-Y

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!

nmalzieu avatar Oct 02 '23 15:10 nmalzieu

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 avatar Oct 12 '23 20:10 derekstavis

@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?

nmalzieu avatar Oct 13 '23 07:10 nmalzieu

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.

ospfranco avatar Nov 09 '23 13:11 ospfranco