Fork me on GitHub
#cljfx
<
2023-03-21
>
ts150315:03:59

hello guys. I’m trying to write a simple app with cljfx but faced with a blocker issue related to the JavaFX and Apple M1 Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17.0.2-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) I know it’s not related to cljfx directly but I’m struggling to find useful tutorials or guides on how to update JavaFX on my machine I downloaded JavaFX 17-ea+8 from repo. How to tell JDK to use that version instead of .openjfx/cache ? Would be really appreciate for some links. Thanks

vlaaad15:03:03

in your dependency management file (proejct.clj or deps.edn), you should specify explicit dependencies on javafx

ts150315:03:52

I’m using project.clj

vlaaad15:03:54

but depend on the version you need

vlaaad15:03:26

then it will be in a bit different syntax, e.g. [org.openjfx/javafx-controls "17-ea+8"]

ts150315:03:45

let me try

ts150315:03:30

so I updated libraries

ts150315:03:10

error is still the same but refers to the new path .openjfx/cache/17-ea/

ts150315:03:26

Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_es2.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
	at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
	at com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:62)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:51)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
	at java.base/java.lang.Thread.run(Thread.java:833)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
java.lang.UnsatisfiedLinkError: /Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib: dlopen(/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib, 0x0001): tried: '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (no such file), '/Users/ts1503/.openjfx/cache/17-ea/libprism_sw.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
	at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
	at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
	at com.sun.prism.sw.SWPipeline.lambda$static$0(SWPipeline.java:42)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
	at java.base/java.lang.Thread.run(Thread.java:833)
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found

vlaaad15:03:42

do you use arm jdk?

vlaaad15:03:12

is it possible that you launch this program using e.g. arm build of intellij idea that uses x64 jdk?

ts150315:03:06

openjdk version “17.0.6” 2023-01-17 OpenJDK Runtime Environment Homebrew (build 17.0.6+0) OpenJDK 64-Bit Server VM Homebrew (build 17.0.6+0, mixed mode, sharing)

ts150315:03:26

this is printed from java --version

ts150315:03:54

I installed it with brew install openjdk@17

ts150315:03:09

I choose this version in intellij

ts150315:03:25

you might be right here

ts150315:03:02

I tried lein repl and error seems to gone

ts150316:03:36

or maybe not. lein repl starts but when I’m trying to render something it fails

2023-03-21 17:01:22.166 java[38812:8133311] *** Assertion failure in -[_NSTrackingAreaAKViewHelper removeTrackingRect:], _NSTrackingAreaAKManager.m:1613
2023-03-21 17:01:22.168 java[38812:8133311] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'

ts150316:03:30

So I switched to JDK 19.0.2 and javafx 20-ea+19 and now it works from lein repl. but still doesn’t work if I run repl from intellij

ts150316:03:56

I think I can live with it for now. Thanks

vlaaad16:03:14

Glad you got it working for you

vlaaad16:03:29

We had this issue at work. It looks like a bug in cursive

ts150316:03:56

maybe it because it still using rosetta?

ts150316:03:27

but not sure

ts150316:03:37

anyway, thank you

vlaaad16:03:36

It seems cursive uses intellij's own arm JVM when calculating classpath, but in case of javafx the classpath depends on the JVM used to calculate classpath where it selects arm vs x64 dependencies to use

vlaaad16:03:14

So far we found 2 workarounds: start the JVM from the terminal so the classpath is calculated using the same JVM, or use x64 idea — you can download it on their site