Submitting libsql updates

Re-compile the C binary for iOS and Android

I have forked the repo and added the necessary changes to compile the c bindings for iOS and Android. I have created a PR here:

https://github.com/tursodatabase/libsql/pull/1423/files

You only need to navigate to the bindings/c folder and run the ios and android make scripts to generate the files

cd libsql/bindings/c
make ios
make android

I disabled sqlcipher/crypto support as I was having trouble with it. I can take a look afterwards but I have run out of the allocated time. The makefile compiles libsql for iOS/Android, nothing to do with RN yet.

Submit a PR to op-sqlite

Afterwards you will have a bunch of files on the bindings/c/generated folder. You need to copy the libsql.xcframework to op-sqlite/ios/libsql.xcframework. Then you need to copy the jniLibs to op-sqlite/android/.

As long as you have not changed the headers and bindings submitting a PR will be enough, you can open a PR and there are automated tests that will build the app to make sure everything is compiling. If you did modify the headers you also need to update the file at cpp/libsql/libsql.h .

This is not however enough to make sure nothing is broken, due to the nature of React Native bindings to C++ it is necessary to run the app on a device or simulator. The op-sqlite/example app contains a set of tests for the sql functionality:

// Make sure you have node 18, ruby >2.76, xcode, android sdk, ndk, etc
cd op-sqlite
yarn i
cd example
yarn i
gem install bundler // in case you don't have bundler installed already
bundle install
// modify the package.json to turn on libsql
// on "package.json" turn on the libsql flag
"op-sqlite": {
  "libsql": true
}
// for iOS you need to do a pod install
yarn pods
// Then just run the example app
yarn ios
// or run android
yarn android

Sometimes you might get a Hermes error that has no real output. Check example/ios/xcode.env.local sometimes the script will mess up the detection of node (if you are using asdf or mise), whatever command is there should give a valid node command, in my case using mise it broke, so I created a symbolic link sudo ln -s $(which node) /usr/local/bin/node and then normal detection should work:

export NODE_BINARY=$(command -v node)

You should then see the app running the test suite:

CleanShot 2024-05-27 at 20.48.11@2x.png