stack_wallet icon indicating copy to clipboard operation
stack_wallet copied to clipboard

Reproducability issue

Open keraliss opened this issue 1 year ago • 8 comments

Hi, keraliss from walletscrutiny. i was trying to test your wallet, and got stuck.

this was the dockerfile i was using -

# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Set environment variables
ENV FLUTTER_HOME=/opt/flutter
ENV ANDROID_SDK_ROOT=/opt/android-sdk
ENV PATH="${PATH}:${FLUTTER_HOME}/bin:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools"

# Install dependencies
RUN apt-get update && apt-get install -y \
    curl \
    git \
    unzip \
    xz-utils \
    zip \
    libglu1-mesa \
    openjdk-11-jdk-headless \
    wget \
    clang \
    cmake \
    ninja-build \
    pkg-config \
    libgtk-3-dev \
    liblzma-dev \
    python3 \
    python3-pip \
    libssl-dev \
    automake \
    build-essential \
    file \
    libtool \
    libtinfo5 \
    libgit2-dev \
    libncurses5-dev \
    libncursesw5-dev \
    zlib1g-dev \
    llvm \
    g++ \
    gcc \
    gperf \
    libc6-dev-i386 \
    && rm -rf /var/lib/apt/lists/*

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup install 1.67.1 1.72.0 1.73.0 && \
    rustup default 1.67.1 && \
    rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android && \
    cargo install cargo-ndk --version 2.12.7 --locked

# Install Flutter
RUN git clone https://github.com/flutter/flutter.git -b 3.22.1 $FLUTTER_HOME
RUN flutter doctor

# Install Android SDK
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
    wget https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip -O android-sdk.zip && \
    unzip -q android-sdk.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
    mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \
    rm android-sdk.zip

# Accept licenses and install necessary Android SDK components
RUN yes | sdkmanager --licenses
RUN sdkmanager "platform-tools" "platforms;android-30" "build-tools;30.0.3" "ndk;25.1.8937393"

# Clone Stack Wallet repository
WORKDIR /app
RUN git clone https://github.com/cypherstack/stack_wallet.git && \
    cd stack_wallet && \
    git submodule update --init --recursive

# Run prebuild script
WORKDIR /app/stack_wallet/scripts
RUN chmod +x prebuild.sh && ./prebuild.sh

# Check directory structure after prebuild
WORKDIR /app/stack_wallet
RUN find /app/stack_wallet

# Add debugging output before running build_app.sh
WORKDIR /app/stack_wallet/scripts
RUN echo "APP_PROJECT_ROOT_DIR: $APP_PROJECT_ROOT_DIR" && \
    echo "Environment variables:" && env && \
    ls -la /app/stack_wallet && ls -la /app/stack_wallet/scripts

# Run build_app.sh script with debugging information and skip confirmation
RUN chmod +x build_app.sh && \
    sed -i 's/confirmDisclaimer/#confirmDisclaimer/' build_app.sh && \
    set -x && ./build_app.sh -a stack_wallet -p android -v 1.0.0 -b 1 || { echo "build_app.sh failed"; exit 1; }

# Set up entrypoint
WORKDIR /app/stack_wallet
ENTRYPOINT ["flutter", "build", "apk", "--release"]

and got this -

+ ./build_app.sh -a stack_wallet -p android -v 1.0.0 -b 1
/app/stack_wallet /app/stack_wallet/scripts
/app/stack_wallet/scripts
+ echo build_app.sh failed
+ exit 1
build_app.sh failed

what i was able to get from this was, the build_app.sh file is causing the issue. would be very helpful if you can look into the issue!

keraliss avatar Sep 11 '24 07:09 keraliss

Thanks for this compose file! It looks like you got close. I'm not sure how your build_app.sh options were wrong or what the output was... Can you use set -x and/or set -v and paste that output here?

sneurlax avatar Sep 11 '24 19:09 sneurlax

I tried replicating the above Docker commands in an Ubuntu 20.04 VM, checking out the staging branch instead of master:

./build_app.sh -a stack_wallet -p linux -v 2.1.7 -b 251
+ ./build_app.sh -a stack_wallet -p linux -v 2.1.7 -b 251
~/app/stack_wallet ~/app/stack_wallet/scripts
~/app/stack_wallet/scripts
Please confirm you understand that when using certain values for <version> and <build_number> there is a chance that the resulting app WILL DELETE CRITICAL WALLET DATA. Are you sure you want to continue? (yes/no): yes
Continuing...
./build_app.sh: line 26: syntax error near unexpected token `}'

Removing sed -i 's/confirmDisclaimer/#confirmDisclaimer/' build_app.sh allows build to proceed, where it ran into other unrelated errors.

justanwar avatar Oct 25 '24 11:10 justanwar

Yea, that sed is breaking things. the staging branch is usually the most up to date branch. The interactive disclaimer is not something I plan on removing or making is easily disabled. Certain platforms will delete your app data if the build number and version are lower than the previously installed version.

julian-CStack avatar Nov 21 '24 18:11 julian-CStack

hey, tried building again, with the latest version. was unable to build the apk. you can see the build report here - https://walletscrutiny.com/android/com.cypherstack.stackwallet/#verificationId=510861b1ffea43ea60767c05214887f6a063eba08e83cf35b31d3d49d25b8943

keraliss avatar Aug 30 '25 14:08 keraliss

hey, tried building again, with the latest version. was unable to build the apk. you can see the build report here - https://walletscrutiny.com/android/com.cypherstack.stackwallet/#verificationId=510861b1ffea43ea60767c05214887f6a063eba08e83cf35b31d3d49d25b8943

@keraliss, that report mentions that there's not documentation for producing a pubspec.yaml, but it's in the ### Build plugins and #### Build script: \build_app.sh`` section and we had discussed how to use it in the comments above.

That being said, I now use Ubuntu 24.04 almost exclusively (20.04 is still used for builds for glibc-backwards-compatibility reasons) so it looks like we either need to reverify and/or update the docs and/or invest some time into a Docker (which we don't use) compose file

sneurlax avatar Aug 30 '25 18:08 sneurlax

hey thanks for responding, and sorry i missed it. would be great if you can take some of your time and update the docs. then i can give it another go and update the findings.

keraliss avatar Aug 30 '25 18:08 keraliss

we've made a lot of changes recently and dependencies may have changed and things may not have been fully documented. I think ubuntu 24.04 is now required

julian-CStack avatar Oct 21 '25 16:10 julian-CStack

okay, will try to figure it out once the next version releases!

keraliss avatar Oct 22 '25 14:10 keraliss