From c03b857246d2826268dbd07187cf65a6337df16a Mon Sep 17 00:00:00 2001 From: Swapnil Tripathi Date: Mon, 14 Aug 2023 06:59:29 +0530 Subject: [PATCH] update android ndk Signed-off-by: Swapnil Tripathi --- uniffi_aries_vcx/demo/build.gradle | 6 +++--- uniffi_aries_vcx/scripts/android.build.sh | 4 ++-- uniffi_aries_vcx/scripts/android.prepare.sh | 2 +- uniffi_aries_vcx/scripts/android.toolchain.sh | 2 +- uniffi_aries_vcx/scripts/android.utils.sh | 15 +++++++++++---- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/uniffi_aries_vcx/demo/build.gradle b/uniffi_aries_vcx/demo/build.gradle index 4314313742..f28d7a1826 100644 --- a/uniffi_aries_vcx/demo/build.gradle +++ b/uniffi_aries_vcx/demo/build.gradle @@ -1,6 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.0.2' apply false - id 'com.android.library' version '8.0.2' apply false + id 'com.android.application' version '8.1.0' apply false + id 'com.android.library' version '8.1.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.20' apply false -} \ No newline at end of file +} diff --git a/uniffi_aries_vcx/scripts/android.build.sh b/uniffi_aries_vcx/scripts/android.build.sh index 0fe3e407bc..7c27322773 100644 --- a/uniffi_aries_vcx/scripts/android.build.sh +++ b/uniffi_aries_vcx/scripts/android.build.sh @@ -13,7 +13,7 @@ source ${SCRIPT_DIR}/android.utils.sh # set_android_env # download_and_setup_toolchain -generate_arch_flags "arm" +generate_arch_flags "arm64" set_dependencies_env_vars -# set_android_arch_env +set_android_arch_env build_uniffi diff --git a/uniffi_aries_vcx/scripts/android.prepare.sh b/uniffi_aries_vcx/scripts/android.prepare.sh index df6b7d5abc..ed8d1642a3 100644 --- a/uniffi_aries_vcx/scripts/android.prepare.sh +++ b/uniffi_aries_vcx/scripts/android.prepare.sh @@ -10,5 +10,5 @@ source ${SCRIPT_DIR}/android.utils.sh set_android_env download_sdk -prepare_dependencies "arm" +prepare_dependencies "arm64" download_and_setup_toolchain diff --git a/uniffi_aries_vcx/scripts/android.toolchain.sh b/uniffi_aries_vcx/scripts/android.toolchain.sh index 2a254feb5e..95b560dae7 100644 --- a/uniffi_aries_vcx/scripts/android.toolchain.sh +++ b/uniffi_aries_vcx/scripts/android.toolchain.sh @@ -8,5 +8,5 @@ ANDROID_BUILD_DIR=~/android_build source ${SCRIPT_DIR}/android.utils.sh -create_standalone_toolchain_and_rust_target "arm" +create_standalone_toolchain_and_rust_target "arm64" create_cargo_config diff --git a/uniffi_aries_vcx/scripts/android.utils.sh b/uniffi_aries_vcx/scripts/android.utils.sh index 8a65c3b170..da830a73bd 100644 --- a/uniffi_aries_vcx/scripts/android.utils.sh +++ b/uniffi_aries_vcx/scripts/android.utils.sh @@ -20,7 +20,6 @@ set_android_arch_env mkdir -p ${HOME}/.cargo cat << EOF > ${HOME}/.cargo/config [target.${TRIPLET}] -ar = "$(realpath ${AR})" linker = "$(realpath ${CC})" EOF } @@ -52,10 +51,10 @@ download_and_setup_toolchain() { mkdir -p ${TOOLCHAIN_PREFIX} pushd $TOOLCHAIN_PREFIX echo "${GREEN}Resolving NDK for Linux${RESET}" - download_and_unzip_if_missed "android-ndk-r20" "https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip" + download_and_unzip_if_missed "android-ndk-r25c" "https://dl.google.com/android/repository/android-ndk-r25c-linux.zip" popd fi - export ANDROID_NDK_ROOT=${TOOLCHAIN_PREFIX}/android-ndk-r20 + export ANDROID_NDK_ROOT=${TOOLCHAIN_PREFIX}/android-ndk-r25c echo "${GREEN}NDK RESOLVED AT${RESET} ${ANDROID_NDK_ROOT}" } @@ -154,8 +153,9 @@ prepare_dependencies() { } set_android_arch_env() { + echo $ export CC=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-clang - export AR=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-ar + export AR=${TOOLCHAIN_DIR}/bin/llvm-ar export CXX=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-clang++ export CXXLD=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-ld export RANLIB=${TOOLCHAIN_DIR}/bin/${ANDROID_TRIPLET}-ranlib @@ -198,6 +198,13 @@ set_dependencies_env_vars() { export OPENSSL_STATIC=1 } +fix_ndk() { + find $ANDROID_NDK_ROOT -name 'libunwind.a' | sed 's@libunwind.a$@libgcc.a@' | \ + while read x; do + echo "INPUT(-lunwind)" > $x + done +} + build_uniffi() { echo "**************************************************" echo "ARIES_VCX_ROOT is ${BOLD}${BLUE}${ARIES_VCX_ROOT}${RESET}"