Skip to content

Conversation

rblaine95
Copy link
Contributor

@rblaine95 rblaine95 commented May 8, 2025

Extend CI workflow to build for both x86_64 and aarch64 architectures:

  • Add ARM variants for Ubuntu and macOS in the build matrix
  • Skip tests on linux/aarch64 builds with -x test flag as JavaFX 21.x.x
    doesn't currently support the linux/aarch64 platform
  • Update artifact naming to include architecture identifiers
  • Configure architecture-specific build paths and release outputs

This change enables native builds for ARM-based systems like Apple Silicon
Macs and ARM servers, improving performance for users on these platforms
while maintaining full test coverage where supported.


There's a small catch with the packaged Monero binaries on MacOS.
As the custom Haveno Monero binaries aren't being cross-compiled for multiple
CPU architectures on MacOS, the monero-wallet-rpc is x86_64.
This isn't a big deal as this means only the monero-wallet-rpc will be run via
Rosetta 2 (emulation).

The big win is that, in my testing, everything else is running natively without
emulation, which is a massive UX improvement.

From a usability perspective, I've run and tested this on my M2 MacBook Pro and
the responsiveness of the UI is night and day.


Please feel free to turn the pedantic dial up to 11.
I am open to any/all suggestions.

@rblaine95 rblaine95 requested a review from woodser as a code owner May 8, 2025 18:51
@rblaine95 rblaine95 force-pushed the aarch64-builds branch 3 times, most recently from dcdce8a to a317990 Compare May 8, 2025 19:01
@woodser
Copy link
Contributor

woodser commented May 8, 2025

As the custom Haveno Monero binaries aren't being cross-compiled for multiple
CPU architectures on MacOS, the monero-wallet-rpc is x86_64.

From a usability perspective, I've run and tested this on my M2 MacBook Pro and
the responsiveness of the UI is night and day.

I could start to build the Monero binaries for macOS aarch64. That would help?

@rblaine95
Copy link
Contributor Author

rblaine95 commented May 8, 2025

Hey @woodser

That would be amazing if you could do that and publish the binaries, then I can make the necessary updates here and do some more testing.

@rblaine95 rblaine95 force-pushed the aarch64-builds branch 4 times, most recently from 69547f5 to 1a42336 Compare May 10, 2025 20:53
@rblaine95 rblaine95 changed the title Add aarch64 architecture support to CI Add aarch64 support to CI May 11, 2025
@NorrinRadd
Copy link
Contributor

you made it here

@woodser
Copy link
Contributor

woodser commented Jul 29, 2025

I'm not able to create the aarch64 binaries using depends from Ubuntu 20.04:

  • make depends target=aarch64-apple-darwin

If anyone can confirm or debug that build process, these binaries could be incorporated in the release.

@woodser
Copy link
Contributor

woodser commented Aug 4, 2025

JavaFX 21.x.x doesn't currently support the linux/aarch64 platform

I'm able to run Haveno on Ubuntu ARM64. Isn't this using JavaFX 21 on linux/aarch64 then?

@woodser
Copy link
Contributor

woodser commented Aug 4, 2025

The big win is that, in my testing, everything else is running natively without emulation, which is a massive UX improvement.

Just want to make sure I understand. You're saying that by running Haveno built natively for ARM64 on MacOS, it performs significantly better than Haveno built for x86_64 on ARM64?

I'm running Haveno on M4 chip (built for x86) and haven't noticed any slow performance, but maybe it's more noticeable on M2.

Extend CI workflow to build for both `x86_64` and `aarch64` architectures:
- Add ARM variants for Ubuntu and macOS in the build matrix
- Skip tests on `aarch64` builds with `-x test` flag as JavaFX 21.x.x
  doesn't currently support the ARM64 architecture
- Update artifact naming to include architecture identifiers
- Configure architecture-specific build paths and release outputs

This change enables native builds for ARM-based systems like Apple Silicon
Macs and ARM servers, improving performance for users on these platforms
while maintaining full test coverage on `x86_64` where supported.

Make localnet cache OS-specific

Prevent Error: Failed to CreateArtifact: Received non-retryable
error: Failed request: (409) Conflict: an artifact with this name
already exists on the workflow run

Add a warning about `linux/aarch64` tests being skipped

Simplify GitHub Actions workflow conditions

Replace verbose condition syntax with simpler `runner.os` expressions to
improve readability and maintainability. This change:

- Uses `runner.os` instead of specific `matrix.os` version strings
- Removes unnecessary `${{ }}` expression wrappers in if conditions
- Consolidates OS-specific conditions (e.g. `ubuntu-22.04` or
  `ubuntu-22.04-arm`) into simpler checks (`runner.os == 'Linux'`)

Fix JavaFX loading on Mac ARM64 architecture

JavaFX 21.0.2 supports Mac ARM64 (Apple Silicon) but was failing to
load with `UnsatisfiedLinkError` because the build system wasn't
detecting ARM architecture properly.

This change allows the build system to correctly identify Mac ARM64
systems and use the appropriate JavaFX libraries, resolving the
compatibility issues when running on Apple Silicon Macs.

Split Build and Package Installer steps

Cleaner CI output, split Build and Package installer step into two steps
@rblaine95
Copy link
Contributor Author

rblaine95 commented Aug 5, 2025

Just want to make sure I understand. You're saying that by running Haveno built natively for ARM64 on MacOS, it performs significantly better than Haveno built for x86_64 on ARM64?

I'm running Haveno on M4 chip (built for x86) and haven't noticed any slow performance, but maybe it's more noticeable on M2.

When testing on my local (M2 Pro) when I made this PR, yes, the UI was significantly more responsive and felt "snappier" when using the aarch64 built version vs running x86 with Rosetta emulation.

Edit: I've rebased this PR, will test again on my local, maybe even share a screen recording.

I'm able to run Haveno on Ubuntu ARM64. Isn't this using JavaFX 21 on linux/aarch64 then?

IIRC, it was specifically when running the tests on linux-aarch64 where JavaFX breaks.

@rblaine95
Copy link
Contributor Author

rblaine95 commented Aug 5, 2025

@woodser I've made a short (2 minute) screen recording to show the difference between aarch64 (native) and x86 (Rosetta 2 emulation) on my M2 Macbook Pro, but it's too big for a Github comment (60MB).

Is there a way I can share it with you?

Edit: I've uploaded it to catbox.moe - https://files.catbox.moe/974u4g.mov

Edit 2: The app starts up quite a bit faster, scrolling is way smoother, the UI is significantly more responsive.

@rblaine95
Copy link
Contributor Author

rblaine95 commented Aug 5, 2025

I'm able to run Haveno on Ubuntu ARM64. Isn't this using JavaFX 21 on linux/aarch64 then?

Are you able to run the tests on your Ubuntu ARM64 machine?
./gradlew build --stacktrace --scan

If I enable the tests in ubuntu-22.04-arm then the tests fail during Guice Setup:

> Task :desktop:test
GuiceSetupTest > testGuiceSetup() FAILED
    com.google.inject.ProvisionException at GuiceSetupTest.java:142
        Caused by: java.lang.ExceptionInInitializerError at GuiceSetupTest.java:142
            Caused by: java.lang.RuntimeException at GuiceSetupTest.java:142

The test report logs:

Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /home/runner/.openjfx/cache/21.0.2+5/aarch64/libprism_es2.so: /home/runner/.openjfx/cache/21.0.2+5/aarch64/libprism_es2.so: cannot open shared object file: No such file or directory (Possible cause: can't load AMD 64 .so on a AARCH64 platform)
java.lang.UnsatisfiedLinkError: /home/runner/.openjfx/cache/21.0.2+5/aarch64/libprism_es2.so: /home/runner/.openjfx/cache/21.0.2+5/aarch64/libprism_es2.so: cannot open shared object file: No such file or directory (Possible cause: can't load AMD 64 .so on a AARCH64 platform)

Taking a look at the published artifacts for JavaFX Base 21.0.2 there's no 21.0.2-linux-aarch64.jar published.
However, with 22.0.1 linux-aarch64 jars are being published.

Here's the zip containing the error reports from running the tests on ubuntu-22.04-arm
error-reports-ubuntu-22.04-arm.zip


Edit:
I've replicated the error in a ubuntu:22.04 docker on my M2 Macbook.
Inspecting the libprism_es2.so file, I can see the following:

$ file ~/.openjfx/cache/21.0.2+5/aarch64/libprism_*
/root/.openjfx/cache/21.0.2+5/aarch64/libprism_es2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/root/.openjfx/cache/21.0.2+5/aarch64/libprism_sw.so:  ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
$ readelf -h ~/.openjfx/cache/21.0.2+5/aarch64/libprism_es2.so
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          60560 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         7
  Size of section headers:           64 (bytes)
  Number of section headers:         30
  Section header string table index: 29

I suspect the reason you can run the Haveno application on Ubuntu ARM64, but not the tests, is because the tests try to load the libprism_*.so shared objects which are x86_64 only.

@woodser
Copy link
Contributor

woodser commented Aug 5, 2025

@rblain95 I found that the tests can be run on Linux ARM64 with -x checkstyleMain -x checkstyleTest instead of skipping all tests. Can you update your PR for this?

@rblaine95
Copy link
Contributor Author

Hey @woodser, if I update the build command with those skips (./gradlew build --stacktrace --scan -x checkstyleMain -x checkstyleTest) I still get the same error on my ubuntu:22.04 docker and github run
https://github.com/rblaine95/haveno/actions/runs/16750508090/job/47419264594

JavaFX `21.x.x` ships with `x86_64` versions of `libprism_es2.so` and
`libprism_s2.so` shared objects.
This causes desktop tests to fail on `linux/aarch64`.

Instead of skipping all tests (`-x test`), just skip the Desktop tests.
@rblaine95
Copy link
Contributor Author

rblaine95 commented Aug 5, 2025

@woodser, I've updated to only skip the Desktop tests (-x desktop:test) on linux/aarch64
All the other tests will run.

Edit: I think it might be valuable for me to leave a comment somewhere explaining that:

JavaFX 21.x.x ships with x86_64 versions of libprism_es2.so and libprism_s2.so shared objects.
This causes desktop tests to fail on linux/aarch64

@woodser
Copy link
Contributor

woodser commented Aug 5, 2025

I think it might be valuable for me to leave a comment somewhere explaining that

Sounds good, it can be added within build.yml where the skip flag is added. Where your existing comment is works: https://github.com/haveno-dex/haveno/pull/1743/files#diff-5c3fa597431eda03ac3339ae6bf7f05e1a50d6fc7333679ec38e21b337cb6721R45

@woodser
Copy link
Contributor

woodser commented Aug 5, 2025

Strange that I'm not able to recreate the error by skipping check style checks on Ubuntu 20.04 and 24.04. I haven't tested 22.04 though.

@woodser
Copy link
Contributor

woodser commented Aug 5, 2025

I'm not able to get the aarch64 deb file to run on Ubuntu 20.04, 22.04, or 24.04.

Is it working for you?

@rblaine95
Copy link
Contributor Author

rblaine95 commented Aug 6, 2025

Hey @woodser

I set up an Ubuntu 24.04 ARM64 VM on my Mac and tested the linux-aarch64 deb file.
When I tried to install it, it complained that libpcre3 wasn't installed.
After installing the missing dependency I re-installed the deb file and ran /opt/haveno/bin/Haveno successfully.

image image image image

Edit: Also tested Ubuntu 22.04, no complaints about libpcre3 this time, it also installed to /opt/haveno
Running /opt/haveno/bin/Haveno starts up the UI without issue.
Also tested the AppImage in Ubuntu 22.04 and 24.04

@woodser
Copy link
Contributor

woodser commented Aug 6, 2025

Ok I'm able to make it work using dkpg instead of apt. Thanks.

@woodser
Copy link
Contributor

woodser commented Aug 6, 2025

I think this is ready to merge AFIACT.

@woodser woodser merged commit 5226574 into haveno-dex:master Aug 6, 2025
7 checks passed
@rblaine95 rblaine95 deleted the aarch64-builds branch August 7, 2025 08:13
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