Magickbase / neuron-public-issues

Neuron Issues
4 stars 3 forks source link

Research on Light Client for Mobile #393

Open Danie0918 opened 1 month ago

Danie0918 commented 1 month ago

Nowadays, mobile has become the main use of the user's scene, we need to complete the light client mobile adaptation to develop mobile Neuron.

yanguoyu commented 3 weeks ago

There may be two approaches to running a light client on Mobile

  1. Build a Mobile arch target to run it.
  2. Depend on a virtual environment to run computer arch target.

Here is the reference: Build the ios target: https://doc.rust-lang.org/rustc/platform-support/arm64e-apple-ios.html A virtual environment on ios: https://github.com/utmapp/UTM This will start a new OS, so it does not belong to run a node at Mobile.

I will try to see which approach works best.

Update 06-11: Build target x86_64-apple-ios failed with ckb-rocksdb. I will check why the ckb-rocksdb build failed.

yanguoyu commented 1 week ago

Recording the compilation process:

  1. Encountered an issue with not finding the openssl library corresponding to iOS, requiring manual compilation of the openssl library or using a precompiled version from someone else. https://github.com/x2on/OpenSSL-for-iPhone
    export OPENSSL_LIB_DIR=OpenSSL-for-iPhone/bin/iPhoneSimulator17.4-x86_64.sdk/lib
    export OPENSSL_INCLUDE_DIR=OpenSSL-for-iPhone/bin/iPhoneSimulator17.4-x86_64.sdk/include
  2. ckb-rocksdb does not support iOS compilation targets, requiring modification of the compilation script. Here is the fork repo's PR
  3. Currently, iOS does not support the thread_local keyword. I have removed this keyword for now, and further research is needed to determine if it can be replaced with another method.
  4. Currently, it can be compiled into a library and used in an iOS project. The build is successful, but the call fails due to the subCommand not being passed. Reference: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-06-rust-on-ios.html