OP-Engineering / op-sqlite

Fastest SQLite library for react-native by @ospfranco
MIT License
598 stars 41 forks source link

Load extensions on runtime #40

Closed ospfranco closed 10 months ago

ospfranco commented 10 months ago

Previous PR had messed up branches. See for reference. https://github.com/OP-Engineering/op-sqlite/pull/38

efstathiosntonas commented 10 months ago

@ospfranco Hi, after updating to 2.0.15 I get Use of undeclared identifier 'sqlite3_enable_load_extension' and Use of undeclared identifier 'sqlite3_load_extension' on iOS on the bridge:

Screenshot 2024-01-21 at 20 07 57

I'm using rn 0.73.2 and iOS 17.2 on Xcode 15.2

ospfranco commented 10 months ago

Are you using the Phone embedded sqlite or any flags? Have you cleared your Build Cache?

efstathiosntonas commented 10 months ago

Not embedded, no special flags on pod install. I have cleaned the Product and Derived Data. Downgrading to 2.0.13 works as a charm.

ospfranco commented 10 months ago

Just created a new expo project and installed 2.0.15 and it is compiling without issues. Maybe you can create a reproduction repo. (The failed builds had to do with my node setup and not with the compilation of the app itself)

Oscar Franco Screen 000859

efstathiosntonas commented 10 months ago

Thank you for looking into this. I created an empty bare react-native project with expo-modules-core (that's what I do in current app) and it compiled just fine.

What I've tried:

  1. delete yarn.lock and node_modules
  2. pod deintegrate
  3. delete Derived Data, clean build folder
  4. install packages again
  5. pod install

Cannot get it to compile.

Tried with OP_SQLITE_USE_PHONE_VERSION=1 npx pod-install and the same error pops.

This is my Podfile:

Click me ```ruby require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") # required for react-native-permissions def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') platform :ios, '13.4' prepare_react_native_project! $RNVideoUseVideoCaching=true flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled setup_permissions([ 'Camera', 'LocationWhenInUse', 'Microphone', 'Notifications', 'PhotoLibrary' ]) flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end IS_CI = ENV['APPCENTER_BUILD_ID'] target 'app' do use_expo_modules! post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end config = use_native_modules! use_frameworks! :linkage => :static use_react_native!( :path => config[:reactNativePath], # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. :flipper_configuration => FlipperConfiguration.disabled, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) pod 'FirebaseAppCheckInterop', '=' + "10.19.0" pod 'FirebaseAuthInterop', '=' + "10.19.0" pod 'FirebaseMessagingInterop', '=' + "10.19.0" pod 'FirebaseSharedSwift', '=' + "10.19.0" pod 'FirebaseCoreInternal', '=' + "10.19.0" pod 'FirebaseInstallations', '=' + "10.19.0" pod 'SDWebImageWebPCoder', '=' + "0.14.1" $VCDisableFrameProcessors = true $RNVideoUseVideoCaching=true $FirebaseSDKVersion = '10.19.0' pod 'RNLocalize', :path => '../node_modules/react-native-localize' pod 'react-native-image-crop-tools', :path => '../node_modules/react-native-image-crop-tools' target 'appTests' do inherit! :complete # Pods for testing end post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) end end ```
efstathiosntonas commented 10 months ago

It seems it does not like use_frameworks! :linkage => :static. I updated the repro repo Podfile to include it and it breaks.

static linkage is needed because of react-native-firebase.

this is a repro repo: https://github.com/efstathiosntonas/bare-react-native-expo-svg-transformer-issue , I had created it a while ago for a bug on react-native-svg-transformer so just ignore that.

ospfranco commented 10 months ago

That's weird, considering the source files are compiled with the rest of the code. Please create a new issue and I will take a look when I can although the use framework issues are usually not fixable.

efstathiosntonas commented 10 months ago

@ospfranco done, linked issue: https://github.com/OP-Engineering/op-sqlite/issues/42