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

Improve build docs and optimize Dockerfile for Android and Linux builds #2016

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

sethforprivacy
Copy link
Contributor

@sethforprivacy sethforprivacy commented Feb 10, 2025

Our docs are quite... varied in quality and detail, so I've done my best to clean them up.

In addition, I've worked to optimize @MrCyjaneK's Dockerfile for building Cake Wallet and Monero.com from source for Android and Linux in an attempt to drastically simplify the process, especially for less technical users.

This PR:

  1. Shifts all build docs into docs/builds
  2. Optimizes and moves the build Dockerfile from scripts/linux to the root of the project
  3. Overhauls Android and Linux guides to use the above Docker image to make builds far easier
  4. Fixes a few minor build issues that @MrCyjaneK found.
  5. Resolves Building CakeWallet Android App 4.4.0 failed with haven_wallet errors, Missing cw_haven realted build instructions? #337

@sethforprivacy sethforprivacy marked this pull request as ready for review February 10, 2025 19:53
@sethforprivacy
Copy link
Contributor Author

I think this is all ready for review!

I've tested Android and Linux builds with the new Docker image across three different hosts (a mix of x64 and arm64) and have worked with @MrCyjaneK to iron out the issues.

Please double check the other guides, but I have made sure not to edit the core steps, instead focusing on syntax and formatting.

@sethforprivacy sethforprivacy changed the title Improve build docs and add Dockerfile for Android builds Improve build docs and add Dockerfile for Android and Linux builds Feb 10, 2025
@sethforprivacy sethforprivacy changed the title Improve build docs and add Dockerfile for Android and Linux builds Improve build docs and optimize Dockerfile for Android and Linux builds Feb 10, 2025
@sethforprivacy
Copy link
Contributor Author

NOTE: The output example for Linux is incorrect (shows Android right now) but I will update that when my latest Linux build completes and I can copy-paste it out :)

@sethforprivacy
Copy link
Contributor Author

NOTE: The output example for Linux is incorrect (shows Android right now) but I will update that when my latest Linux build completes and I can copy-paste it out :)

Resolved in 9e19496.

@xrviv
Copy link

xrviv commented Feb 11, 2025

Seth, I found 1 possible problem with the Dockerfile:

image

Does the two == work on your end?


Anyway, I got past that -

The currrent flow is:

  1. docker run --rm -it
    -v "$(pwd)":/app
    ghcr.io/cake-tech/cake_wallet:main-linux
    bash

  2. cd app

  3. git clone https://github.com/cake-tech/cake_wallet.git

  4. cd cake_wallet/

  5. git checkout v4.23.0

  6. git submodule update --init --recursive

  7. ./configure_cake_wallet.sh android

  8. keytool -genkeypair
    -alias myKeyAlias
    -keyalg RSA
    -keysize 2048
    -validity 10000
    -keystore /app/cake_wallet/my-release-key.jks

  9. flutter pub get

  10. flutter build appbundle --release

At this stage I get:

Got dependencies!
2 packages are discontinued.
Dependencies are affected by security advisories:
  [^0]: https://github.com/advisories/GHSA-3hpf-ff72-j67p
81 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/to/flutter-gradle-plugin-apply


FAILURE: Build failed with an exception.

* Where:
Build file '/app/cake_wallet/android/app/build.gradle' line: 71

* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path='null'

* 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 1s
Running Gradle task 'bundleRelease'...                           1,464ms
Gradle task bundleRelease failed with exit code 1

I had to move the release key around. but then I encountered another problem.

At this stage. I suppose I have to look at the new instructions and build from there.

docs/builds/ANDROID.md Outdated Show resolved Hide resolved
docs/builds/ANDROID.md Show resolved Hide resolved
docs/builds/ANDROID.md Show resolved Hide resolved
docs/builds/ANDROID.md Outdated Show resolved Hide resolved
docs/builds/ANDROID.md Show resolved Hide resolved
docs/builds/MACOS.md Outdated Show resolved Hide resolved
docs/builds/MACOS.md Outdated Show resolved Hide resolved
docs/builds/MACOS.md Outdated Show resolved Hide resolved
docs/builds/MACOS.md Outdated Show resolved Hide resolved
docs/builds/MACOS.md Outdated Show resolved Hide resolved
@MrCyjaneK
Copy link
Collaborator

MrCyjaneK commented Feb 11, 2025

@xrviv Current working flow is documented here: https://github.com/sethforprivacy/cake_wallet/blob/build-docs/docs/builds/ANDROID.md#building-cake-wallet-or-monerocom

Dockerfile builds just fine on my end. Can you provide us details at which point of the documentation it resulted in an error and what that error was?

@sethforprivacy
Copy link
Contributor Author

@xrviv Current working flow is documented here: https://github.com/sethforprivacy/cake_wallet/blob/build-docs/docs/builds/ANDROID.md#building-cake-wallet-or-monerocom

Dockerfile builds just fine on my end. Can you provide us details at which point of the documentation it resulted in an error and what that error was?

Same for me, following the new instructions the image builds properly on multiple machines and runs properly as well.

@MrCyjaneK
Copy link
Collaborator

All looks good to me, let me just spin up a macos VM to verify that iOS and macOS docs work and there are no other edge cases

@MrCyjaneK
Copy link
Collaborator

For iOS and macOS there is a requirement for extra step after installing XCode.app

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch

and app_config.sh and build_monero_all.sh need to swap places on iOS/macOS, as app_config.sh requires monero_c dylib to be already built.

brew needs extra dependencies: automake ccache go libtool pkgconfig

we also need to call ./build_mwebd.sh after build_monero_all.sh on iOS

after generate_new_secrets.dart we also need to run

dart run tool/generate_localization.dart

In addition, build failed with xcode 15.3 on macOS 14.0 -> I have tested again on Xcode 16.2 and macOS 15.3.1, so we should use these values in the docs

I have followed iOS docs. but I am fairly certain that fixes should be made to both macos and iOS docs,

ios build failed, I'll make a patch to fix it in a bit - it is a known issue with mwebd

ios also needs softwareupdate --install-rosetta (well flutter, so macOS probably also needs it)

@sethforprivacy
Copy link
Contributor Author

For iOS and macOS there is a requirement for extra step after installing XCode.app

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch

and app_config.sh and build_monero_all.sh need to swap places on iOS/macOS, as app_config.sh requires monero_c dylib to be already built.

brew needs extra dependencies: automake ccache go libtool pkgconfig

we also need to call ./build_mwebd.sh after build_monero_all.sh on iOS

after generate_new_secrets.dart we also need to run

dart run tool/generate_localization.dart

In addition, build failed with xcode 15.3 on macOS 14.0 -> I have tested again on Xcode 16.2 and macOS 15.3.1, so we should use these values in the docs

I have followed iOS docs. but I am fairly certain that fixes should be made to both macos and iOS docs,

ios build failed, I'll make a patch to fix it in a bit - it is a known issue with mwebd

ios also needs softwareupdate --install-rosetta (well flutter, so macOS probably also needs it)

For iOS and macOS there is a requirement for extra step after installing XCode.app

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch

and app_config.sh and build_monero_all.sh need to swap places on iOS/macOS, as app_config.sh requires monero_c dylib to be already built.

brew needs extra dependencies: automake ccache go libtool pkgconfig

we also need to call ./build_mwebd.sh after build_monero_all.sh on iOS

after generate_new_secrets.dart we also need to run

dart run tool/generate_localization.dart

In addition, build failed with xcode 15.3 on macOS 14.0 -> I have tested again on Xcode 16.2 and macOS 15.3.1, so we should use these values in the docs

I have followed iOS docs. but I am fairly certain that fixes should be made to both macos and iOS docs,

ios build failed, I'll make a patch to fix it in a bit - it is a known issue with mwebd

ios also needs softwareupdate --install-rosetta (well flutter, so macOS probably also needs it)

Adding all now, please review the upcoming commit to be sure I understood it all properly.

@sethforprivacy
Copy link
Contributor Author

sethforprivacy commented Feb 11, 2025

For iOS and macOS there is a requirement for extra step after installing XCode.app

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch

and app_config.sh and build_monero_all.sh need to swap places on iOS/macOS, as app_config.sh requires monero_c dylib to be already built.

brew needs extra dependencies: automake ccache go libtool pkgconfig

we also need to call ./build_mwebd.sh after build_monero_all.sh on iOS

after generate_new_secrets.dart we also need to run

dart run tool/generate_localization.dart

In addition, build failed with xcode 15.3 on macOS 14.0 -> I have tested again on Xcode 16.2 and macOS 15.3.1, so we should use these values in the docs

I have followed iOS docs. but I am fairly certain that fixes should be made to both macos and iOS docs,

ios build failed, I'll make a patch to fix it in a bit - it is a known issue with mwebd

ios also needs softwareupdate --install-rosetta (well flutter, so macOS probably also needs it)

Changes made in 30ebcf6.

docs/builds/IOS.md Outdated Show resolved Hide resolved
docs/builds/MACOS.md Outdated Show resolved Hide resolved
docs/builds/IOS.md Outdated Show resolved Hide resolved
Comment on lines +22 to +30
Then install `Desktop development with C++` packages via Visual Studio 2022, or Visual Studio Build Tools 2022 including:

- `C++ Build Tools core features`
- `C++ 2022 Redistributable Update`
- `C++ core desktop features`
- `MVC v143 - VS 2022 C++ x64/x86 build tools`
- `C++ CMake tools for Windows`
- `Testing tools core features - Build Tools`
- `C++ AddressSanitizer`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then install `Desktop development with C++` packages via Visual Studio 2022, or Visual Studio Build Tools 2022 including:
- `C++ Build Tools core features`
- `C++ 2022 Redistributable Update`
- `C++ core desktop features`
- `MVC v143 - VS 2022 C++ x64/x86 build tools`
- `C++ CMake tools for Windows`
- `Testing tools core features - Build Tools`
- `C++ AddressSanitizer`
Then install `Desktop development with C++` packages via [Visual Studio 2022](https://visualstudio.microsoft.com/downloads).


```zsh
sudo apt update
sudo apt build-essential cmake gcc-mingw-w64 g++-mingw-w64 autoconf libtool pkg-config
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sudo apt build-essential cmake gcc-mingw-w64 g++-mingw-w64 autoconf libtool pkg-config
apt install -y build-essential pkg-config autoconf libtool ccache make cmake gcc g++ git curl lbzip2 gperf pigz gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test the build myself, these are copied over from monero_c mingw ci step

Download the latest release tag of Cake Wallet and enter the source code directory:

```zsh
git clone https://github.com/cake-tech/cake_wallet.git --branch v4.23.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git clone https://github.com/cake-tech/cake_wallet.git --branch v4.23.0
git clone https://github.com/cake-tech/cake_wallet.git --branch main

cd cake_wallet
```

NOTE: Replace `v4.23.0` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NOTE: Replace `v4.23.0` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>.
NOTE: Replace `main` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there is a need to add the following details

  • C:\Program Files\Git\bin\ needs to be in $env:PATH, so user needs to go to start menu, search 'environment', edit environment variables, double click PATH, click new and type the path there, then reboot the computer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-02-11 at 23 36 23

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, for flutter to function user needs to open 'Run', type ms-settings:developers and turn on developer mode
Screenshot 2025-02-11 at 23 39 20

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I have tested that on Windows 11, so we also may want to bump that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaaaaand we also need nugat.exe, so we can instruct people to download https://dist.nuget.org/win-x86-commandline/latest/nuget.exe into C:\Program Files\Nugat\nugat.exe (create the directory) and add it to PATH (same as with Git above)

To configure the application, run the following:

```zsh
./cakewallet.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
./cakewallet.sh
.\cakewallet.bat

@MrCyjaneK
Copy link
Collaborator

MrCyjaneK commented Feb 11, 2025

With my notes above I was able to build cake wallet, on Windows11 (arm - should also work in x64 CPU as well, especially because flutter does not support arm64 on 3.24.4)

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