Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update/verify build instructions #1

Open
Giszmo opened this issue Dec 30, 2022 · 6 comments
Open

Please update/verify build instructions #1

Giszmo opened this issue Dec 30, 2022 · 6 comments

Comments

@Giszmo
Copy link

Giszmo commented Dec 30, 2022

I tried to compile the Android wallet and while I don't have a Mac, I didn't even succeed to check out all the code required.

git submodule add --force -b main https://gitlab.com/nunchuck/libnunchuk.git

looks wrong. The GitLab project does not exist, at least not publicly.

The project has a git submodule defined but it's this non-existing repo to a different path than the build instruction says.

I tried working around this by using ninchuk-io's GitHub alternative but there, a dependency failed to clone:

$ git submodule set-url src/main/native/libnunchuk https://github.com/nunchuk-io/libnunchuk.git
$ git submodule update --init --recursive
Cloning into '/home/leo/tmp/nunchuk-android-nativesdk/src/main/native/libnunchuk'...
Submodule path 'src/main/native/libnunchuk': checked out 'c168cf715cbe768b5cd5004609f2db6d0ebfe254'
...
error: object e35e28f52d20df27561b2780f6b9c86669a9de21: zeroPaddedFilemode: contains zero-padded file modes
fatal: fsck error in packed object
fatal: index-pack failed
fatal: clone of 'https://github.com/sqlcipher/sqlcipher' into submodule path '/home/leo/tmp/nunchuk-android-nativesdk/src/main/native/libnunchuk/contrib/sqlcipher' failed
Failed to clone 'contrib/sqlcipher'. Retry scheduled

So ... we can't clone that dependency. Seriously?

$ git clone https://github.com/sqlcipher/sqlcipher
Cloning into 'sqlcipher'...
remote: Enumerating objects: 15498, done.
remote: Counting objects: 100% (1910/1910), done.
remote: Compressing objects: 100% (816/816), done.
error: object e35e28f52d20df27561b2780f6b9c86669a9de21: zeroPaddedFilemode: contains zero-padded file modes
fatal: fsck error in packed object
fatal: index-pack failed
@bakaoh
Copy link
Contributor

bakaoh commented Dec 30, 2022

Thanks @Giszmo , i've updated libnunchuk submodule url (https://github.com/nunchuk-io/libnunchuk.git).

It seems sqlcipher repo has a file with zero-padded file modes

% git fsck   

Checking object directories: 100% (256/256), done.
warning in tree e35e28f52d20df27561b2780f6b9c86669a9de21: zeroPaddedFilemode: contains zero-padded file modes
Checking objects: 100% (15745/15745), done.

Normally it's only a warning. But if you enabled receive.fsckObjects and transfer.fsckObjects config it will stop you from cloning the code. You can check it with git config --list command

% git config --list                                  
receive.fsckobjects=true
transfer.fsckobjects=true

Please unset these 2 configs and retry

% git config --global --unset receive.fsckObjects
% git config --global --unset transfer.fsckObjects

@Giszmo
Copy link
Author

Giszmo commented Dec 30, 2022

Ok. Now I remember I did activate the fsck and was wondering why it wasn't on by default. Now I'm wondering what are the consequences of zeroPaddedFilemode.

Either way I'll figure out how to compile your app.

@emanuelb
Copy link

emanuelb commented Jan 2, 2023

it's possible to build this repo on linux with instructions more or less like: (tested on debian)

  1. Install commandline tools & ndk 21.0.6113669 (or reuse newer ndk 21.4.7075529 installed by gradle if no new ndk installed yet) and setup all needed android env vars (ANDROID_*), related issue is to specify ndkVersion in build.gradle Add ndkVersion with static value to build.gradle for newer&reproducible NDK usage and use newer supported version #4
  2. Install packages: (looks like ibboost-dev and libevent-dev are not needed, they from documentation, it compiles without installing them, the build process itself compile boost version)
    git automake libtool libboost-dev pkg-config libevent-dev openjdk-11-jdk make curl bzip2 gcc unzip g++ patch
    unzip needed only if used to unzip ndk downloaded directly from google via curl command to use specified version instead of currently default version installed with gradle with commands:
    cd /home/appuser/app/sdk/; \
    curl -o commandlinetools.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip; \
    echo "0bebf59339eaa534f4217f8aa0972d14dc49e7207be225511073c661ae01da0a  commandlinetools.zip" | sha256sum -c; \
    unzip commandlinetools.zip; \
    rm commandlinetools.zip; \
    /home/appuser/app/sdk/cmdline-tools/bin/sdkmanager --sdk_root=/home/appuser/app/sdk/ --install "ndk;21.0.6113669";
  1. avoid git submodule add call (not needed anymore after recent change)
  2. Run script .install_linux_deps.sh instead of .install_deps.sh and use bash instead of sh to invoke it, related issue Make .install_linux_deps.sh sh compatible or add bash shebang to it #3

Edit: Containerfile to compile repo

FROM docker.io/debian:sid-slim

RUN set -ex; \
    apt-get update; \
    DEBIAN_FRONTEND=noninteractive apt-get install --yes -o APT::Install-Suggests=false --no-install-recommends \
        git \
        gcc \
        g++ \
        make \
        curl \
        bzip2 \
        patch \
        libtool \ 
        automake \
        pkg-config \
        openjdk-11-jdk; \
    rm -rf /var/lib/apt/lists/*; \
    useradd -ms /bin/bash appuser;
     
USER appuser

ENV ANDROID_SDK_ROOT="/home/appuser/app/sdk" \
    ANDROID_SDK="/home/appuser/app/sdk" \
    ANDROID_HOME="/home/appuser/app/sdk" \
    ANDROID_NDK_HOME="/home/appuser/app/sdk/ndk/21.4.7075529/"

RUN set -ex; \
    mkdir -p "/home/appuser/app/sdk/licenses" "/home/appuser/app/sdk/ndk" "/home/appuser/app/nunchuk/"; \
    printf "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "/home/appuser/app/sdk/licenses/android-sdk-license"; \
    cd /home/appuser/app/nunchuk/; \ 
    git clone --depth 1 https://github.com/nunchuk-io/nunchuk-android-nativesdk; 

WORKDIR /home/appuser/app/nunchuk/

RUN set -ex; \
    cd /home/appuser/app/nunchuk/nunchuk-android-nativesdk; \
    ./gradlew clean; \
    cd /home/appuser/app/nunchuk/nunchuk-android-nativesdk/src/main/native; \
    git submodule update --init --recursive; \
    bash .install_linux_deps.sh arm64-v8a; \
    cd /home/appuser/app/nunchuk/nunchuk-android-nativesdk/; \
    ./gradlew clean assembleArm64_v8aDebug --stacktrace; \
    ./gradlew publish;

@emanuelb
Copy link

emanuelb commented Jan 4, 2023

Container file in previous comment wont work anymore on current version due to issue #5
Containerfile and rb test of nunchuk 1.9.23 version is in issue: nunchuk-io/nunchuk-android#7

@Giszmo
Copy link
Author

Giszmo commented Jan 6, 2023

@emanuelb I tried your container file and it failed at ./gradlew publish at least with podman:

...
BUILD SUCCESSFUL in 10m 13s
40 actionable tasks: 40 executed
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
+ ./gradlew publish

> Configure project :
WARNING:The option 'android.enableR8' is deprecated.
It was removed in version 7.0 of the Android Gradle plugin.
Please remove it from `gradle.properties`.
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
[CXX5202] This app only has 32-bit [armeabi-v7a] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement
[CXX5202] This app only has 32-bit [armeabi-v7a] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement
WARNING:[CXX5202] This app only has 32-bit [armeabi-v7a] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement
[CXX5202] This app only has 32-bit [armeabi-v7a] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement
WARNING:[CXX5202] This app only has 32-bit [armeabi-v7a] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement
[CXX5202] This app only has 32-bit [armeabi-v7a] native libraries. Beginning August 1, 2019 Google Play store requires that all apps that include native libraries must provide 64-bit versions. For more information, visit https://g.co/64-bit-requirement

> Task :generatePomFileForMavenPublication
> Task :publishMavenPublicationToMavenLocalRepository FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishMavenPublicationToMavenLocalRepository'.
> Failed to publish publication 'maven' to repository 'MavenLocal'
   > Invalid publication 'maven': artifact file does not exist: '/home/appuser/app/nunchuk/nunchuk-android-nativesdk/build/outputs/aar/nunchuk-android-nativesdk-arm64_v8a-release.aar'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 815ms
2 actionable tasks: 2 executed
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
Error: error building at STEP "RUN set -ex;     cd /home/appuser/app/nunchuk/nunchuk-android-nativesdk;     ./gradlew clean;     cd /home/appuser/app/nunchuk/nunchuk-android-nativesdk/src/main/native;     git submodule update --init --recursive;     bash .install_linux_deps.sh arm64-v8a;     cd /home/appuser/app/nunchuk/nunchuk-android-nativesdk/;     ./gradlew clean assembleArm64_v8aDebug --stacktrace;     ./gradlew publish;": error while running runtime: exit status 1

In the complete log I see lines like this:

checking command to parse aarch64-linux-android-nm output from /home/appuser/app/sdk/ndk/21.4.7075529//toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang object... failed

but it doesn't abort.

Edit: It fails with the same error using Docker.

@emanuelb
Copy link

emanuelb commented Jan 6, 2023

Yes, you tried the old Containerfile that doesnt work anymore for the latest version on google-play (it worked for the code they published before when the comment was made), the error you see is fixed in #5

Use the newer Containerfile for latest version that is in issue: nunchuk-io/nunchuk-android#7 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants