openwallet-foundation / bifold-wallet

Aries Mobile Agent React Native - Part of the Aries Bifold effort to provide SSI capabilities in a production ready app.
Apache License 2.0
143 stars 134 forks source link

indy-vdr support for Android 6+ / API 23+ #695

Closed cvarjao closed 1 year ago

cvarjao commented 1 year ago

Source

Testing

Move the “.so” file to a specific directory inside your node modules of bifold, for example. The path, IIRC, is “node_modules/@hyperledger/indy-vdr-react-native/native/mobile/android//libindyvdr.so”

References

cvarjao commented 1 year ago

It took me almost 2 hours to build 1 image:

$ docker buildx build --platform linux/amd64 --label 'org.cross-rs.for-cross-target=aarch64-linux-android' --label 'org.cross-rs.workspace_root=/Users/cvarjao/Documents/GitHub/indy-vdr' --tag cross-custom-indy-vdr:aarch64-linux-android-98066 --build-arg 'CROSS_BASE_IMAGE=ghcr.io/cross-rs/aarch64-linux-android:main' --file ../cross/docker/Dockerfile.aarch64-linux-android ../cross/docker
[+] Building 6229.6s (26/26) FINISHED                                                                                                                                                                                                     
 => [internal] load build definition from Dockerfile.aarch64-linux-android                                                                                                                                                           0.0s
 => => transferring dockerfile: 2.69kB                                                                                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                    0.0s
 => => transferring context: 260B                                                                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                      2.2s
 => CACHED [ 1/21] FROM docker.io/library/ubuntu:20.04@sha256:24a0df437301598d1a4b62ddf59fa0ed2969150d70d748c84225e6501e9c36b9                                                                                                       0.0s
 => [internal] load build context                                                                                                                                                                                                    0.0s
 => => transferring context: 91.38kB                                                                                                                                                                                                 0.0s
 => [ 2/21] COPY common.sh lib.sh /                                                                                                                                                                                                  0.0s
 => [ 3/21] RUN /common.sh                                                                                                                                                                                                         272.7s
 => [ 4/21] COPY cmake.sh /                                                                                                                                                                                                          0.0s 
 => [ 5/21] RUN /cmake.sh                                                                                                                                                                                                           23.8s 
 => [ 6/21] COPY xargo.sh /                                                                                                                                                                                                          0.0s 
 => [ 7/21] RUN /xargo.sh                                                                                                                                                                                                          254.0s 
 => [ 8/21] COPY qemu.sh /                                                                                                                                                                                                           0.0s 
 => [ 9/21] RUN /qemu.sh aarch64                                                                                                                                                                                                   741.9s 
 => [10/21] COPY validate-android-args.sh /                                                                                                                                                                                          0.0s 
 => [11/21] RUN /validate-android-args.sh arm64                                                                                                                                                                                      0.5s 
 => [12/21] COPY android-ndk.sh /                                                                                                                                                                                                    0.0s 
 => [13/21] RUN /android-ndk.sh arm64                                                                                                                                                                                              150.8s 
 => [14/21] COPY android-system.sh /                                                                                                                                                                                                 0.0s 
 => [15/21] RUN mkdir -p /tmp/android                                                                                                                                                                                                0.3s 
 => [16/21] COPY android /tmp/android                                                                                                                                                                                                0.0s 
 => [17/21] RUN /android-system.sh arm64                                                                                                                                                                                          4773.4s 
 => [18/21] COPY android-symlink.sh /                                                                                                                                                                                                0.0s 
 => [19/21] RUN /android-symlink.sh aarch64 aarch64-linux-android                                                                                                                                                                    1.6s 
 => [20/21] COPY android-runner /                                                                                                                                                                                                    0.0s 
 => [21/21] COPY android.cmake /opt/toolchain.cmake                                                                                                                                                                                  0.0s 
 => exporting to image                                                                                                                                                                                                               8.1s 
 => => exporting layers                                                                                                                                                                                                              8.1s 
 => => writing image sha256:af698ad8b7e4edccfcf53eae6273cf857ecdd4b4dfee1b6968053ac3db6a0125                                                                                                                                         0.0s 
 => => naming to docker.io/library/cross-custom-indy-vdr:aarch64-linux-android-98066                                                                                                                                                 0.0s 
$

Notice that I've used docker buildx build --platform linux/amd64 as opposed to docker build. This is for building images based on linux/amd64 instead of the one from the underline host (MacOS/M1/aarch64)

jleach commented 1 year ago

Work in progress. Since we want to support all the way down to Android 6 I need to get the build working with that version. Running into a missing library libunwind. I've tried installing it both of these to see what one works. Building in the background because it takes such a long time.

Added the following to android-system.sh in tmp_docker at line 83:

        libunwind8 \
        android-libunwind
jleach commented 1 year ago

@cvarjao Got this working and we've handed it back to Animo to take it across the finish line. I've tested on API 23-30 and all is well. There is an ASKAR issue for x86_64 on API 31-33 preventing further testing.

Notes from Clecio on efforts so far:

You can see my code here (I will cleanup/squash my commits, so please don't take them just yet) https://github.com/cvarjao-o/indy-vdr

You can download the binaries from here: https://github.com/cvarjao-o/indy-vdr/packages/1835089?version=0.0.9-1

I got those working with the following setting: ANDROID_NDK: "r13b" ANDROID_SDK: "21" ANDROID_VERSION: "5.0.0_r1"

I tested in a Pixel 6 / API 23 / Android 6 Also, I can get the app started properly, but getting a migration error, I am assuming that is something still being worked on, correct?