Skip to content

DRAFT: WSL-Ubuntu-Android Build Guide - #366

Closed
D33r-Gee wants to merge 1 commit into
bitcoin-core:mainfrom
D33r-Gee:wsl-install-guide
Closed

D33r-Gee wants to merge 1 commit into
bitcoin-core:mainfrom
D33r-Gee:wsl-install-guide

Conversation

@D33r-Gee

@D33r-Gee D33r-Gee commented Sep 12, 2023 •

Copy link
Copy Markdown
Contributor

This is an updated version of PR #351
It has been rebased and the WSL Ubuntu Android install guide has been added to build-android.md
Let me know if there are any issues

@D33r-Gee

Copy link
Copy Markdown
Contributor Author

Rebased main, deleted WSL_APK_INSTALL.md and modified build-android.md so the wsl guide can be found there. Let me know if there's anything that needs to be updated @jarolrod

@hebasto

hebasto commented Sep 13, 2023

Copy link
Copy Markdown
Member

Please add PR description, update PR title, fix linter issues and clean commit history.

@D33r-Gee D33r-Gee changed the title Rebase was successful. modified build-android.md WSL-Ubuntu-Android Build Guide Sep 13, 2023
@D33r-Gee

Copy link
Copy Markdown
Contributor Author

Please add PR description, update PR title, fix linter issues and clean commit history.

Took care of the above.
Re: clean commit history, please let me know if that's the way to do it or if you'd prefer a different approach?

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept ACK

I'll try to validate the instructions following them and checking the built is correct. Is this exclusive to WSL or can be done on Ubuntu 22.04.

Re: clean commit history, please let me know if that's the way to do it or if you'd prefer a different approach?

I think there's no need to have so many commits, you could squash them all into only one.

Also, perhaps you need to rebase?

@D33r-Gee

D33r-Gee commented Nov 23, 2023 via email

Copy link
Copy Markdown
Contributor Author

@D33r-Gee
D33r-Gee force-pushed the wsl-install-guide branch 3 times, most recently from 576bbc3 to a4bf253 Compare December 1, 2023 16:25
@D33r-Gee

D33r-Gee commented Dec 1, 2023

Copy link
Copy Markdown
Contributor Author

Is this exclusive to WSL or can be done on Ubuntu 22.04.

It should work with Ubuntu 22.04 proper.

Squashed the commits and rebased with main

Thanks again for reviewing @pablomartin4btc

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK a4bf253

Sorry, I think the 2nd commit ("Merge branch..." 9ca8bb2) is not necessary, only 1 commit.

I'll try to follow the guide at some point next week and give a deeper review. Thanks for working on this!

@D33r-Gee

D33r-Gee commented Dec 1, 2023

Copy link
Copy Markdown
Contributor Author

thanks @pablomartin4btc, for taking a look... squashed it down to 1 commit.

I'll try to follow the guide at some point next week and give a deeper review.

Sounds great!

Thanks for working on this!

with pleasure

@hebasto

hebasto commented Dec 2, 2023

Copy link
Copy Markdown
Member

@D33r-Gee

The diff looks too big (956 files) for a build guide, doesn't it?

@D33r-Gee D33r-Gee closed this Dec 4, 2023
@D33r-Gee D33r-Gee reopened this Dec 4, 2023
@D33r-Gee

D33r-Gee commented Dec 4, 2023

Copy link
Copy Markdown
Contributor Author

The diff looks too big (956 files) for a build guide, doesn't it?

@hebasto, yes thanks for pointing it out. I didn't do proper house cleaning when synching my fork. It should be resolved now.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tACK till Step 4 included

I'll continue and finish it before the end of the next week. Looking forward to have this working and play with it.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tACK till Step 6 included, only 1 step left to finish...

I have some minor nits that I'll write them out when I complete the guide entirely.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tACK 4523a0f

I've finished the entire guide, sorry it took me a while cos I've checked different devices and had to learn to use the tools.

I tried first with an old tablet (HUAWEI m3 lite 10") with Android 7.0 (API level #24) but the Bitcoin core app crashes due to some missing qt library (checked with adb logcat I needed to install "Ministro II" but it didn't fix it... I'll try later to build a qt bundle from Android Studio and send it to the device).

Secondly I've tried on these (friends and family - 😄 🙏) phones:

Google Pixel 6 (Android 14 - API Level 34)

WhatsApp Image 2023-12-22 at 19 02 28

WhatsApp Image 2023-12-22 at 19 02 29

WhatsApp Image 2023-12-22 at 19 02 29 (1)

WhatsApp Image 2023-12-22 at 19 02 30 (1)

WhatsApp Image 2023-12-22 at 19 02 30 (2)

WhatsApp Image 2023-12-22 at 19 02 29 (2)

Samsung A20 (Android 9 - API Level 28)

WhatsApp Image 2023-12-28 at 12 21 30

HUAWEI Y9 (Android 9 - API Level 28) image

WhatsApp Image 2023-12-23 at 00 34 19

WhatsApp Image 2023-12-23 at 00 36 10

WhatsApp Image 2023-12-23 at 00 48 06

WhatsApp Image 2023-12-23 at 01 13 30

WhatsApp Image 2023-12-23 at 01 52 40

Finally, I've re-built it for my old smart watch...

HUAWEI watch 2 (32 bits, Android 8.0.0, API Level 26)

Screenshot_20231227_223056

screenshot-modified

screenshot2-modified

screenshot4-modified

screenshot5-modified

screenshot6-modified

Screenshot_20231227_223641

Screenshot_20231227_223546

Screenshot_20231227_223355

I've noticed some issues regarding the user experience, layout, etc., on the different platforms/ devices related to QML itself so I'll leave that out of this PR which approach is only the WSL - Ubuntu Android Build Guide.

I think I'd leave this guide open to use both WSL and Ubuntu itself so I'm not sure you need to but in case you do, you can also install usbipd there on Ubuntu.

Comment thread doc/build-android.md Resolved
Comment thread doc/build-android.md Resolved
Comment thread doc/build-android.md
```

More details on this step can be found [here](https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md#compiling-with-windows-subsystem-for-linux).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

e.g.:

ANDROID_SDK=/home/ubunpolk/Android/Sdk ANDROID_NDK=/home/ubunpolk/Android/Sdk/ndk/26.1.10909125 make -C depends HOST=armv7a-linux-android ANDROID_API_LEVEL=26 ANDROID_TOOLCHAIN_BIN=/home/ubunpolk/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin CC=/home/ubunpolk/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang CXX=/home/ubunpolk/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang++

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At the top of this document the example given is:
ANDROID_SDK=/home/user/Android/Sdk ANDROID_NDK=/home/user/Android/Sdk/ndk-bundle make HOST=aarch64-linux-android ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/home/user/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin

in your example, what do the `CC=...` and `CXX=...` add in terms building the proper depends?

@pablomartin4btc pablomartin4btc Jan 10, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it forces to build depends with the proper clang version for the required Android API Level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah got it... ok so will leave the the extra CC= and CXX= from example to minimize confusion, however if you feel strongly about having them let me know?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I prefer to use them in all make calls to ensure the Android API Level for the particular architecture (arm64-v8a, armeabi-v7a, etc), but perhaps it's not required or I'm over-using them, maybe @hebasto can shed some light here.

Comment thread doc/build-android.md Resolved
Comment thread doc/build-android.md Resolved
@D33r-Gee

Copy link
Copy Markdown
Contributor Author

Hi @pablomartin4btc ,

Thanks so much for going through the whole guide and testing it on different devices,,, amazing!

I've finished the entire guide, sorry it took me a while cos I've checked different devices and had to learn to use the tools.

No worries, happy you got through and thanks for suggesting improvements!

I will look them over, test them then update the commit in the coming days...

@D33r-Gee

D33r-Gee commented Jan 8, 2024

Copy link
Copy Markdown
Contributor Author

@pablomartin4btc , thanks for your reviews and suggestions I've implemented them here 8e20109
Let me know your thoughts and/or if there's anything I missed?

Comment thread doc/build-android.md Outdated

More details on this step can be found [here](https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md#compiling-with-windows-subsystem-for-linux).

Now, you can build the APKs using the guide found [here](https://github.com/bitcoin-core/gui-qml/blob/main/doc/build-android.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
Now, you can build the APKs using the guide found [here](https://github.com/bitcoin-core/gui-qml/blob/main/doc/build-android.md).
Now, you need to build the dependencies for the specific Android API Level, for which you can follow the guide found [here](https://github.com/bitcoin-core/gui-qml/blob/main/doc/build-android.md).

Maybe that guide above needs to be updated as it shows an example for "a default build with no disabled dependencies", and could display the make -C depends suggested previously. And later below you also specify run make && make apk from src/qt as on the build-android guide.

In my opinion, I'd be more clear on the sub-steps here in Step 7 in order to build the APK and transfer/ install it to the device (including for each the other commands to make it work as the qlogging.cpp update, paths, etc):

  1. build dependencies
  2. configure with proper host
  3. make
  4. make apk
  5. adb install

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great idea on the having sub-steps

@D33r-Gee

Copy link
Copy Markdown
Contributor Author

new commit 7687e2c

Added your suggestions @pablomartin4btc

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tACK 7687e2c

Tested on Ubuntu 22.04 (non-WSL), so I think we can use this guide for both, perhaps you need to identify and separate the steps specifically for WSL (including usage of usbip, which is not required for non-WSL) and that's all I can say, it worked fine for me.

Comment thread doc/build-android.md Resolved
@pablomartin4btc

Copy link
Copy Markdown
Contributor

I think we can use this guide for both, perhaps you need to identify and separate the steps specifically for WSL (including usage of usbip, which is not required for non-WSL) and that's all I can say, it worked fine for me.

Sorry, what I mentioned above perhaps can be done on a follow-up, apologies if you started doing that already 🙏.

@D33r-Gee

Copy link
Copy Markdown
Contributor Author

Sorry, what I mentioned above perhaps can be done on a follow-up, apologies if you started doing that already 🙏.

No worries... Apologies for the late response was focused on the AssumeUTXO integration

I think we can use this guide for both...

That's a great idea, once I implement your latest suggestions perhaps it can be merged and we can open a new PR detailing both OSes or we can keep collaborating on this one till we feel it's ready to be merged...

@pablomartin4btc thoughts?

@D33r-Gee

Copy link
Copy Markdown
Contributor Author

updated and rebased 5b7da4a

Thanks @pablomartin4btc for testing and the suggestions

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

re ACK 5b7da4a

perhaps it can be merged and we can open a new PR detailing both OSes or we can keep collaborating on this one till we feel it's ready to be merged...

IMO this PR can be merge as it is, and we can open a new one to incorporate Ubuntu
with some tweaks.

@hebasto

hebasto commented Apr 23, 2024

Copy link
Copy Markdown
Member

Building for Android is currently broken in the Bitcoin Core master branch. This is the main reason why there have not been syncing to the master branch recently.

I suggest to draft / postpone this PR until CMake + Qt6 are landed to the master branch.

@D33r-Gee

D33r-Gee commented May 1, 2024

Copy link
Copy Markdown
Contributor Author

I suggest to draft / postpone this PR until CMake + Qt6 are landed to the master branch.

Ah great to know... yes setting this PR to draft then

@D33r-Gee
D33r-Gee marked this pull request as draft May 1, 2024 13:55
@D33r-Gee D33r-Gee changed the title WSL-Ubuntu-Android Build Guide DRAFT: WSL-Ubuntu-Android Build Guide May 1, 2024
@hebasto

hebasto commented Jul 25, 2025

Copy link
Copy Markdown
Member

Closing for now.

Feel free to reopen this based on the new default branch.

@hebasto hebasto closed this Jul 25, 2025
hebasto pushed a commit to hebasto/gui-qml that referenced this pull request Nov 22, 2026
…nunix platform support and fix race conditions

d5f7524 doc: Bump minimum required Cap'n Proto version to 0.9.2 (Ryan Ofsky)
4898199 build: suppress -Wc++23-lambda-attributes in warn_interface (Ryan Ofsky)
270f5db Squashed 'src/ipc/libmultiprocess/' changes from e8de5c7b68e..acded1aafae (Ryan Ofsky)

Pull request description:

  The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh).

  Changes since last subtree update (#35720):

  - Adds support for nonunix platforms, making API changes that are not backwards compatible ([bitcoin-core#274](bitcoin-core/libmultiprocess#274)). Follow-ups add a `CurrentThread()` accessor matching compatibility code in [bitcoin/bitcoin#35084](bitcoin/bitcoin#35084) ([bitcoin-core#323](bitcoin-core/libmultiprocess#323)) and remove code for Cap'n Proto versions before 0.9 ([bitcoin-core#331](bitcoin-core/libmultiprocess#331)).
  - Fixes a data race between IPC calls running on worker threads and disconnects, found by Antithesis ([bitcoin-core#349](bitcoin-core/libmultiprocess#349)).
  - Fixes a use-after-free when a socket disconnects before `ConnectStream` connects, and leaks and hangs when a client `construct()` call throws ([bitcoin-core#298](bitcoin-core/libmultiprocess#298)).
  - Fixes a race where file descriptors from `SpawnProcess` could leak into processes forked at the same time by other threads, by clearing `FD_CLOEXEC` in the child after forking ([bitcoin-core#311](bitcoin-core/libmultiprocess#311)).
  - Makes `SpawnProcess` report `exec` failures back to the parent and throw, reaping the child ([bitcoin-core#312](bitcoin-core/libmultiprocess#312)).
  - Adds support for `std::chrono::time_point` fields ([bitcoin-core#303](bitcoin-core/libmultiprocess#303)) and for serializing lists of interface objects that need to be moved from ([bitcoin-core#304](bitcoin-core/libmultiprocess#304)), both needed by [bitcoin/bitcoin#10102](bitcoin/bitcoin#10102).
  - Accepts container fields and parameters with any comparator, hash, and allocator types, like Bitcoin Core's `GCSFilter::ElementSet`, needed by [bitcoin/bitcoin#29409](bitcoin/bitcoin#29409) ([bitcoin-core#379](bitcoin-core/libmultiprocess#379)).
  - Finds the `capnp` tool in vcpkg and Windows builds, needed by [bitcoin/bitcoin#32387](bitcoin/bitcoin#32387) ([bitcoin-core#317](bitcoin-core/libmultiprocess#317)).
  - Adds a `destroy_connection` option to `ServeStream` and `ConnectStream`, lets `ServeStream` take ownership of the init object and return the new server and its connection, and adds an `EventLoop::incomingConnections()` accessor, simplifying test setup in both repositories and needed by [bitcoin/bitcoin#35932](bitcoin/bitcoin#35932) ([bitcoin-core#365](bitcoin-core/libmultiprocess#365)).
  - Replaces `EventLoop::post()` with `sync()` taking a `kj::FunctionParam`, avoiding a heap allocation per call ([bitcoin-core#347](bitcoin-core/libmultiprocess#347)).
  - Names threads spawned by the event loop so they can be told apart in tools and logs ([bitcoin-core#324](bitcoin-core/libmultiprocess#324)).
  - Fixes warnings that Bitcoin Core enables or plans to enable: adds `[[noreturn]]` attributes for `-Wmissing-noreturn` ([bitcoin-core#339](bitcoin-core/libmultiprocess#339), for [bitcoin/bitcoin#35911](bitcoin/bitcoin#35911)), and fixes `-Wunused` ([bitcoin-core#362](bitcoin-core/libmultiprocess#362), for [bitcoin/bitcoin#36167](bitcoin/bitcoin#36167)), `-Wunused-const-variable` and `-Wundef` ([bitcoin-core#370](bitcoin-core/libmultiprocess#370)), and `-Wmissing-prototypes` ([bitcoin-core#386](bitcoin-core/libmultiprocess#386), for [bitcoin/bitcoin#36743](bitcoin/bitcoin#36743)) warnings.
  - Fails at compile time with a suggested workaround when Cap'n Proto misdetects exception support (`KJ_NO_EXCEPTIONS`), as happens on NetBSD ([bitcoin-core#364](bitcoin-core/libmultiprocess#364)).
  - Build improvements: fixes stale generated code when the `mpgen` binary changes ([bitcoin-core#316](bitcoin-core/libmultiprocess#316)), fixes `mpgen` link order for static Cap'n Proto builds ([bitcoin-core#367](bitcoin-core/libmultiprocess#367)), links `mpgen` against `kj-async` instead of `capnp-rpc` ([bitcoin-core#327](bitcoin-core/libmultiprocess#327)), shows Cap'n Proto `find_package` diagnostics ([bitcoin-core#325](bitcoin-core/libmultiprocess#325)), installs `type-unordered-set.h` and `version.h` ([bitcoin-core#350](bitcoin-core/libmultiprocess#350)), and shows include-what-you-use errors instead of failing silently ([bitcoin-core#371](bitcoin-core/libmultiprocess#371)).
  - Test, CI, documentation, and minor code improvements: fix for a startup race in the example program ([bitcoin-core#315](bitcoin-core/libmultiprocess#315)), new test for immediate client disconnects in `ListenConnections` ([bitcoin-core#310](bitcoin-core/libmultiprocess#310)), `ReadList` return value check ([bitcoin-core#338](bitcoin-core/libmultiprocess#338)), connect test race fix ([bitcoin-core#343](bitcoin-core/libmultiprocess#343)) and cleanups ([bitcoin-core#344](bitcoin-core/libmultiprocess#344)), `std::ranges::copy` follow-ups ([bitcoin-core#307](bitcoin-core/libmultiprocess#307)), trailing whitespace removal ([bitcoin-core#345](bitcoin-core/libmultiprocess#345)), Cap'n Proto version documentation fix ([bitcoin-core#357](bitcoin-core/libmultiprocess#357)), clang-tidy updates ([bitcoin-core#358](bitcoin-core/libmultiprocess#358), [bitcoin-core#360](bitcoin-core/libmultiprocess#360), [bitcoin-core#380](bitcoin-core/libmultiprocess#380), [bitcoin-core#389](bitcoin-core/libmultiprocess#389)), new CI job testing newer cmake and Cap'n Proto versions ([bitcoin-core#212](bitcoin-core/libmultiprocess#212), [bitcoin-core#359](bitcoin-core/libmultiprocess#359)), CI coverage for the minimum supported g++ ([bitcoin-core#330](bitcoin-core/libmultiprocess#330), [bitcoin-core#366](bitcoin-core/libmultiprocess#366)), new CI warnings ([bitcoin-core#332](bitcoin-core/libmultiprocess#332), [bitcoin-core#341](bitcoin-core/libmultiprocess#341)), CI parallelism ([bitcoin-core#334](bitcoin-core/libmultiprocess#334), [bitcoin-core#356](bitcoin-core/libmultiprocess#356)), CI diagnostics ([bitcoin-core#351](bitcoin-core/libmultiprocess#351), [bitcoin-core#352](bitcoin-core/libmultiprocess#352)), Nix and LLVM updates ([bitcoin-core#296](bitcoin-core/libmultiprocess#296), [bitcoin-core#363](bitcoin-core/libmultiprocess#363)), NetBSD and OpenBSD CI fixes ([bitcoin-core#321](bitcoin-core/libmultiprocess#321), [bitcoin-core#340](bitcoin-core/libmultiprocess#340), [bitcoin-core#381](bitcoin-core/libmultiprocess#381)), building Cap'n Proto with GCC in the 32-bit CI job to avoid an ABI mismatch ([bitcoin-core#383](bitcoin-core/libmultiprocess#383)), and GitHub Actions updates ([bitcoin-core#387](bitcoin-core/libmultiprocess#387)).

  The second commit suppresses the clang `-Wc++23-lambda-attributes` warning, which the new `[[noreturn]]` lambda attribute in `mp/proxy-types.h` triggers in C++20 builds. Since #31507 the Windows build uses clang-cl, so the same flag covers it.

  The third commit updates the minimum Cap'n Proto version in `doc/dependencies.md` to 0.9.2 (1.0 with Clang). This update raises libmultiprocess's own minimum from 0.7 to 0.9 (bitcoin-core/libmultiprocess#331), and libmultiprocess rejects 0.9.0 and 0.9.1 for CVE-2022-46149 and, with Clang 16 or newer, every version before 1.0.

ACKs for top commit:
  fanquake:
    ACK d5f7524
  willcl-ark:
    ACK d5f7524

Tree-SHA512: 4064944f4d8bb6c1665ddc7d5fae838492235d7dfdafab88b19b687ff6892460a3f450b90a145b287866330c569b862d748c941a70c65abc7f273ef13e490fd7
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

Successfully merging this pull request may close these issues.

3 participants