bisq icon indicating copy to clipboard operation
bisq copied to clipboard

Support building and running on Apple M1 Silicon

Open cbeams opened this issue 3 years ago • 5 comments

Summary

Problem: Prior to this commit, it was not possible to build or run (from source) the desktop app on Apple's M1 (macos aarch64) architecture.

Solution: This commit makes all the changes necessary to successfully build and run on M1, but some of these changes require depending on snapshots and forks of certain dependencies, so this commit shouldn't be merged to master until those fixes are officially released. The changes made here include:

  1. Upgrading from JavaFX 16 to JavaFX 17. JavaFX 17 was the first release to support aarch64 binaries, and so it's required.

  2. Upgrading to a version of the openjfx-gradle-plugin that contains the fix at openjfx/javafx-gradle-plugin#113 to download the correct aarch64-classified JavaFX 17 jars. NOTE: at the time of this commit, the fix has not been released, so we are now depending on a locally-built SNAPSHOT resolved from mavenLocal().

  3. Upgrading to a version of the JFoenix library that includes a fix for the bug documented at sshahine/JFoenix#1187. At the time of this commit, this fix has only been published in the 'rationalityfrontline' fork of JFoenix, and so we've temporarily updated our dependency to point to that artifact. It appears that a new version of JFoenix is being developed that will contain this fix, but it hasn't shipped yet.

Notes

  • Gradle dependency verification metadata has been updated to reflect the changes mentioned above, but will need further updates to capture the Linux, Windows and MacOS Intel variants of the JavaFX 17 binaries.

  • Building and testing has been verified to work on JDKs 11 through 17, however:

  • Running the desktop app only works on JDKs 11 through 15 until sshahine/JFoenix#1205 is fixed. Right now, attempting to run on JDK 16+ will result in a Cannot invoke "javafx.scene.Node.getLayoutBounds()" because "this.textNode" is null error. See the above mentioned issue for details.

  • It was necessary to bump the minimum supported source compatibility in the Gradle build from Java 10 to Java 11 in order to be able to consume the upgraded JFoenix artifact.

  • ~~This PR builds on top of the #5824 and assumes it will be merged; only the latest commit in this PR (98dc483c10) should be considered by reviewers.~~ (no longer relevant after rebase and force-push)

TODO

(what remains in order to take this PR out of draft, review and merge it)

  • [ ] sshahine/JFoenix#1205 to be fixed, released and upgraded to
  • [x] openjfx/javafx-gradle-plugin#113 to be released and upgraded to
  • [ ] JavaFX 17 verification metadata to be updated for Linux, Windows and MacOS Intel architectures

cbeams avatar Nov 16 '21 12:11 cbeams

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 06:04 stale[bot]

Not stale

cbeams avatar Apr 21 '22 00:04 cbeams

@chimp1984 asked me about the status of getting the Bisq build working on M1 Macs for some work he was doing with @pedromvpg. I just looked back into it. It appears that everything we need from the Gradle JavaFX plugin side is now place, see https://github.com/openjfx/javafx-gradle-plugin/pull/113#issuecomment-1104717714 for details, but still not and maybe never from the JFoenix side, see https://github.com/sshahine/JFoenix/issues/1205 for details. It may be that in order to get building on M1, we need to drop our dependency on JFoenix altogether. I'm not sure the level of effort there, but if I recall correctly, the component causing the issue was just a progress meter in the splash screen. Perhaps other issues with the library would surface once that component were replaced, though, not sure.

See also this commit for more context: https://github.com/cbeams/bisq/commit/8546f59b12a58775e6bf7fa1852204cfcfdb9f8e

cbeams avatar Apr 21 '22 05:04 cbeams

@chimp1984 asked me about the status of getting the Bisq build working on M1 Macs for some work he was doing with @pedromvpg. I just looked back into it. It appears that everything we need from the Gradle JavaFX plugin side is now place, see openjfx/javafx-gradle-plugin#113 (comment) for details, but still not and maybe never from the JFoenix side, see sshahine/JFoenix#1205 for details. It may be that in order to get building on M1, we need to drop our dependency on JFoenix altogether. I'm not sure the level of effort there, but if I recall correctly, the component causing the issue was just a progress meter in the splash screen. Perhaps other issues with the library would surface once that component were replaced, though, not sure.

See also this commit for more context: cbeams@8546f59

Replacing the progress bar shouldn't be too big of a problem, but with Bisq2 in development I'm not sure if it is worth the effort to make lots of changes to the codebase or getting rid of JFoenix completely. Bisq2 should work for M1 as there is no JFoenix dependency anymore.

ripcurlx avatar Apr 21 '22 07:04 ripcurlx

I have seen a jfoenix / reflection related exception with various versions of bisq and jdks for some time, most recently: v1.9.1 w/ jdk 15. It happens when I start a desktop in regest/dev mode on ubuntu-linux. I resolve it by adding these jvm-options:

--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED

I do not have an Apple M1, so I cannot know if these jvm-opts at least resolves this issue. If M1 users have not used these options, and do see the jfoenix/reflection error, it's worth a try.

ghubstan avatar May 21 '22 22:05 ghubstan

Hi! I'm closing this PR for now. Feel free to reopen it when it's ready.

alejandrogarcia83 avatar Dec 01 '22 23:12 alejandrogarcia83

hi, i failed to install bisq on macmook air m1 give detailed installation instructions on m1 thank u

skibada avatar Feb 13 '23 13:02 skibada