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

Support building and running on Apple M1 Silicon #5835

Closed
wants to merge 2 commits into from

Conversation

cbeams
Copy link
Member

@cbeams cbeams commented Nov 16, 2021

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 Added Support for M1 Mac 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 Recent change in JavaFX (17-ea+2) breaks JFXProgressBar 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 Not able to add JFXTextField in Scene Builder 16.0.0 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 Upgrade to Gradle 7.3 #5824 and assumes it will be merged; only the latest commit in this PR (98dc483) 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)

Problem: Prior to this commit, it was not possible to build or run 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 publihed 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;

 - Running the desktop app only works on JDKs 11 through 15, however,
   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 removes our dependency on a locally-built javafx-gradle-plugin 0.11
snapshot for the newly-published official snapshot at documented at
openjfx/javafx-gradle-plugin#113 (comment).
@stale
Copy link

stale bot commented Apr 16, 2022

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 stale bot added the was:dropped label Apr 16, 2022
@cbeams
Copy link
Member Author

cbeams commented Apr 21, 2022

Not stale

@stale stale bot removed the was:dropped label Apr 21, 2022
@cbeams
Copy link
Member Author

cbeams commented Apr 21, 2022

@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

@ripcurlx
Copy link
Member

@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.

@ghubstan
Copy link
Member

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.

@alejandrogarcia83
Copy link
Contributor

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

@skibada
Copy link

skibada commented Feb 13, 2023

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

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.

None yet

5 participants