android-app icon indicating copy to clipboard operation
android-app copied to clipboard

Missing x86_64 folder in ./app/src/main/cpp/*/lib with lib*.a files & Instructions to reproduce binaries in lib folders

Open emanuelb opened this issue 3 years ago • 4 comments

building the app from tag v0.32.6 fail with error:

ninja: error: '/home/appuser/app/mixin/android-app/app/src/main/cpp/opus/lib/x86_64/libopusenc.a', needed by '/home/appuser/app/mixin/android-app/app/build/intermediates/cxx/RelWithDebInfo/5h42116x/obj/x86_64/libmixin.so', missing and no known rule

this happen even on alpine when installing libopusenc-dev

Containerfile debian based to reproduce:

FROM docker.io/debian:sid-slim

RUN set -ex; \
    mkdir -p /usr/share/man/man1/; \
    apt-get update; \
    DEBIAN_FRONTEND=noninteractive apt-get install --yes -o APT::Install-Suggests=false --no-install-recommends \
         openjdk-11-jdk git; \
    rm -rf /var/lib/apt/lists/*; \
    useradd -ms /bin/bash appuser;

USER appuser

ENV ANDROID_SDK_ROOT="/home/appuser/app/sdk" \
    ANDROID_HOME="/home/appuser/app/sdk"

RUN set -ex; \
    mkdir -p "/home/appuser/app/sdk/licenses" "/home/appuser/app/mixin/"; \
    printf "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "/home/appuser/app/sdk/licenses/android-sdk-license"; \
    cd /home/appuser/app/mixin/; \
    git clone https://github.com/MixinNetwork/android-app; \
    cd android-app; \
    git checkout v0.32.6;
    
WORKDIR /home/appuser/app/mixin/android-app/

RUN set -ex; \
    sed -i 's/PASTE_YOUR_SECRET_TOKEN_HERE/sk.eyJ1Ijoicm9vdHJvb3QxIiwiYSI6ImNrdXZvN3hnODBmeGoydXFmdm1wamZzYWkifQ.2tvLMLnZ2cAI4_yKlYEPCQ/g' ./gradle.properties; \
    echo "{ \
  \"project_info\": { \
    \"project_number\": \"623252783566\", \
    \"firebase_url\": \"https://blockchaintest-ecd1c.firebaseio.com\", \
    \"project_id\": \"blockchaintest-ecd1c\", \
    \"storage_bucket\": \"blockchaintest-ecd1c.appspot.com\" \
  }, \
  \"client\": [ \
    { \
      \"client_info\": { \
        \"mobilesdk_app_id\": \"1:623252783566:android:02baff6e6c46ed96232b9f\", \
        \"android_client_info\": { \
          \"package_name\": \"one.mixin.messenger\" \
        } \
      }, \
      \"oauth_client\": [ \
        { \
          \"client_id\": \"623252783566-o6j47jlpan97fnibnr0vosvc4lh71sm1.apps.googleusercontent.com\", \
          \"client_type\": 3 \
        } \
      ], \
      \"api_key\": [ \
        { \
          \"current_key\": \"INSERT KEY HERE\" \
        } \
      ], \
      \"services\": { \
        \"appinvite_service\": { \
          \"other_platform_oauth_client\": [ \
            { \
              \"client_id\": \"623252783566-o6j47jlpan97fnibnr0vosvc4lh71sm1.apps.googleusercontent.com\", \
              \"client_type\": 3 \
            } \
          ] \
        } \
      } \
    } \
  ], \
  \"configuration_version\": \"1\" \
}" > /home/appuser/app/mixin/android-app/app/google-services.json;

Run ./gradlew assembleRelease in it.

full error log:

C/C++: ninja: error: '/home/appuser/app/mixin/android-app/app/src/main/cpp/opus/lib/x86_64/libopusenc.a', needed by '/home/appuser/app/mixin/android-app/app/build/intermediates/cxx/RelWithDebInfo/5h42116x/obj/x86_64/libmixin.so', missing and no known rule to make it

> Task :app:buildCMakeRelWithDebInfo FAILED
> Task :app:processReleaseManifestForPackage

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:buildCMakeRelWithDebInfo'.
> Build command failed.
  Error while executing process /home/appuser/app/sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /home/appuser/app/mixin/android-app/app/.cxx/RelWithDebInfo/5h42116x/x86_64 mixin rlottie}
  ninja: Entering directory `/home/appuser/app/mixin/android-app/app/.cxx/RelWithDebInfo/5h42116x/x86_64'
  
  ninja: error: '/home/appuser/app/mixin/android-app/app/src/main/cpp/opus/lib/x86_64/libopusenc.a', needed by '/home/appuser/app/mixin/android-app/app/build/intermediates/cxx/RelWithDebInfo/5h42116x/obj/x86_64/libmixin.so', missing and no known rule to make it

emanuelb avatar Oct 17 '21 21:10 emanuelb

These libraries can be compiled from https://github.com/xiph/opus https://github.com/xiph/ogg https://github.com/xiph/libopusenc

Tougee avatar Oct 18 '21 05:10 Tougee

The problem is that in directory: https://github.com/MixinNetwork/android-app/tree/master/app/src/main/cpp/opus/lib There only folders:

arm64-v8a/ armeabi-v7a/ x86/

That contain files:

libogg.a libopus.a libopusenc.a

But no folder x86_64 that also need to contain above files.

Also script to re-create (by compiling) above files is needed, how they was compiled or from where they was downloaded, they can be downloaded from: https://pkgs.alpinelinux.org/package/edge/community/x86_64/libopusenc-dev https://pkgs.alpinelinux.org/package/edge/main/x86_64/opus-dev https://pkgs.alpinelinux.org/package/edge/main/x86_64/libogg-dev https://pkgs.alpinelinux.org/package/edge/main/x86_64/lz4-static and also needed the file: ./app/src/main/cpp/rlottie/lib/x86_64/librlottie_internal.a

emanuelb avatar Oct 18 '21 11:10 emanuelb

@crossle Should we add x86_64 support to the project ?

Tougee avatar Oct 18 '21 12:10 Tougee

@crossle Should we add x86_64 support to the project ?

It's ok to support x86_64, we publish on google play use app bundle. but the universal apk will be bigger than before.

crossle avatar Oct 18 '21 12:10 crossle

Workaround for this issue is to run commands before ./gradlew assembleRelease that will build release variant:

keytool -genkey -alias mixin_alias -keystore app/mixin.pfx -storetype PKCS12 -keyalg RSA -keysize 4096 -storepass mixin_alias -keypass mixin_alias -validity 10000 -dname CN=IL; \
printf "\nRELEASE_STORE_FILE=mixin.pfx\nRELEASE_STORE_PASSWORD=mixin_alias\nRELEASE_KEY_PASSWORD=mixin_alias\nRELEASE_KEY_ALIAS=mixin_alias\n" >> gradle.properties;

as the code will build release variant only if RELEASE_STORE_FILE is specified (even when using assembleRelease it's not enough) which use different abiFilters without x86 that cause the build failure in this issue (affect debug variant) https://github.com/MixinNetwork/android-app/blob/59d13898f079e73140b571a5b79bcebbef4f5440/app/build.gradle#L144-L156

emanuelb avatar Apr 22 '23 20:04 emanuelb

https://github.com/MixinNetwork/android-app/pull/3899

Tougee avatar Jul 31 '23 03:07 Tougee