Comments (11)
By running through Emacs/CIDER I managed to get the full error:
The full error is
Show: Project-Only All
Hide: Clojure Java REPL Tooling Duplicates (36 frames hidden)
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling cljfx/api.clj at (70:1)
#:clojure.error{:phase :compile-syntax-check,
:line 70,
:column 1,
:source "cljfx/api.clj"}
Compiler.java: 7647 clojure.lang.Compiler/load
RT.java: 381 clojure.lang.RT/loadResourceScript
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 463 clojure.lang.RT/load
RT.java: 428 clojure.lang.RT/load
core.clj: 6126 clojure.core/load/fn
core.clj: 6125 clojure.core/load
core.clj: 6109 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5908 clojure.core/load-one
core.clj: 5903 clojure.core/load-one
core.clj: 5948 clojure.core/load-lib/fn
core.clj: 5947 clojure.core/load-lib
core.clj: 5928 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 5985 clojure.core/load-libs
core.clj: 5969 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6007 clojure.core/require
core.clj: 6007 clojure.core/require
RestFn.java: 421 clojure.lang.RestFn/invoke
state.clj: 1 sausage.state/eval22019/loading--auto--
state.clj: 1 sausage.state/eval22019
state.clj: 1 sausage.state/eval22019
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7165 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
RT.java: 381 clojure.lang.RT/loadResourceScript
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 463 clojure.lang.RT/load
RT.java: 428 clojure.lang.RT/load
core.clj: 6126 clojure.core/load/fn
core.clj: 6125 clojure.core/load
core.clj: 6109 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5908 clojure.core/load-one
core.clj: 5903 clojure.core/load-one
core.clj: 5948 clojure.core/load-lib/fn
core.clj: 5947 clojure.core/load-lib
core.clj: 5928 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 5985 clojure.core/load-libs
core.clj: 5969 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6007 clojure.core/require
core.clj: 6007 clojure.core/require
RestFn.java: 421 clojure.lang.RestFn/invoke
optical.clj: 1 sausage.optical/eval22013/loading--auto--
optical.clj: 1 sausage.optical/eval22013
optical.clj: 1 sausage.optical/eval22013
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7165 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
RT.java: 381 clojure.lang.RT/loadResourceScript
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 463 clojure.lang.RT/load
RT.java: 428 clojure.lang.RT/load
core.clj: 6126 clojure.core/load/fn
core.clj: 6125 clojure.core/load
core.clj: 6109 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5908 clojure.core/load-one
core.clj: 5903 clojure.core/load-one
core.clj: 5948 clojure.core/load-lib/fn
core.clj: 5947 clojure.core/load-lib
core.clj: 5928 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 5985 clojure.core/load-libs
core.clj: 5969 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6007 clojure.core/require
core.clj: 6007 clojure.core/require
RestFn.java: 703 clojure.lang.RestFn/invoke
core.clj: 1 sausage.core/eval7533/loading--auto--
core.clj: 1 sausage.core/eval7533
core.clj: 1 sausage.core/eval7533
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7165 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
REPL: 1 user/eval7529
REPL: 1 user/eval7529
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7131 clojure.lang.Compiler/eval
core.clj: 3214 clojure.core/eval
core.clj: 3210 clojure.core/eval
main.clj: 414 clojure.main/repl/read-eval-print/fn
main.clj: 414 clojure.main/repl/read-eval-print
main.clj: 435 clojure.main/repl/fn
main.clj: 435 clojure.main/repl
main.clj: 345 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 79 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 142 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 171 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 170 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 832 java.lang.Thread/run
1. Caused by java.lang.UnsupportedOperationException
Unable to open DISPLAY
GtkApplication.java: 173 com.sun.glass.ui.gtk.GtkApplication/lambda$new$6
AccessController.java: 312 java.security.AccessController/doPrivileged
GtkApplication.java: 171 com.sun.glass.ui.gtk.GtkApplication/<init>
GtkPlatformFactory.java: 41 com.sun.glass.ui.gtk.GtkPlatformFactory/createApplication
Application.java: 144 com.sun.glass.ui.Application/run
QuantumToolkit.java: 280 com.sun.javafx.tk.quantum.QuantumToolkit/startup
PlatformImpl.java: 269 com.sun.javafx.application.PlatformImpl/startup
Platform.java: 103 javafx.application.Platform/startup
platform.clj: 6 cljfx.jdk.platform/initialize
platform.clj: 4 cljfx.jdk.platform/initialize
platform.clj: 30 cljfx.platform/initialize
platform.clj: 29 cljfx.platform/initialize
api.clj: 75 cljfx.api/eval24166
api.clj: 70 cljfx.api/eval24166
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
RT.java: 381 clojure.lang.RT/loadResourceScript
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 463 clojure.lang.RT/load
RT.java: 428 clojure.lang.RT/load
core.clj: 6126 clojure.core/load/fn
core.clj: 6125 clojure.core/load
core.clj: 6109 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5908 clojure.core/load-one
core.clj: 5903 clojure.core/load-one
core.clj: 5948 clojure.core/load-lib/fn
core.clj: 5947 clojure.core/load-lib
core.clj: 5928 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 5985 clojure.core/load-libs
core.clj: 5969 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6007 clojure.core/require
core.clj: 6007 clojure.core/require
RestFn.java: 421 clojure.lang.RestFn/invoke
state.clj: 1 sausage.state/eval22019/loading--auto--
state.clj: 1 sausage.state/eval22019
state.clj: 1 sausage.state/eval22019
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7165 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
RT.java: 381 clojure.lang.RT/loadResourceScript
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 463 clojure.lang.RT/load
RT.java: 428 clojure.lang.RT/load
core.clj: 6126 clojure.core/load/fn
core.clj: 6125 clojure.core/load
core.clj: 6109 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5908 clojure.core/load-one
core.clj: 5903 clojure.core/load-one
core.clj: 5948 clojure.core/load-lib/fn
core.clj: 5947 clojure.core/load-lib
core.clj: 5928 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 5985 clojure.core/load-libs
core.clj: 5969 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6007 clojure.core/require
core.clj: 6007 clojure.core/require
RestFn.java: 421 clojure.lang.RestFn/invoke
optical.clj: 1 sausage.optical/eval22013/loading--auto--
optical.clj: 1 sausage.optical/eval22013
optical.clj: 1 sausage.optical/eval22013
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7165 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
RT.java: 381 clojure.lang.RT/loadResourceScript
RT.java: 372 clojure.lang.RT/loadResourceScript
RT.java: 463 clojure.lang.RT/load
RT.java: 428 clojure.lang.RT/load
core.clj: 6126 clojure.core/load/fn
core.clj: 6125 clojure.core/load
core.clj: 6109 clojure.core/load
RestFn.java: 408 clojure.lang.RestFn/invoke
core.clj: 5908 clojure.core/load-one
core.clj: 5903 clojure.core/load-one
core.clj: 5948 clojure.core/load-lib/fn
core.clj: 5947 clojure.core/load-lib
core.clj: 5928 clojure.core/load-lib
RestFn.java: 142 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 5985 clojure.core/load-libs
core.clj: 5969 clojure.core/load-libs
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6007 clojure.core/require
core.clj: 6007 clojure.core/require
RestFn.java: 703 clojure.lang.RestFn/invoke
core.clj: 1 sausage.core/eval7533/loading--auto--
core.clj: 1 sausage.core/eval7533
core.clj: 1 sausage.core/eval7533
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7165 clojure.lang.Compiler/eval
Compiler.java: 7635 clojure.lang.Compiler/load
REPL: 1 user/eval7529
REPL: 1 user/eval7529
Compiler.java: 7176 clojure.lang.Compiler/eval
Compiler.java: 7131 clojure.lang.Compiler/eval
core.clj: 3214 clojure.core/eval
core.clj: 3210 clojure.core/eval
main.clj: 414 clojure.main/repl/read-eval-print/fn
main.clj: 414 clojure.main/repl/read-eval-print
main.clj: 435 clojure.main/repl/fn
main.clj: 435 clojure.main/repl
main.clj: 345 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 79 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 142 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 171 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 170 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 832 java.lang.Thread/run
It's basically crashing while loading libraries
The relevant part of the stack is
platform.clj: 6 cljfx.jdk.platform/initialize
platform.clj: 4 cljfx.jdk.platform/initialize
platform.clj: 30 cljfx.platform/initialize
platform.clj: 29 cljfx.platform/initialize
api.clj: 75 cljfx.api/eval24166
api.clj: 70 cljfx.api/eval24166
Which looks like here: https://github.com/cljfx/cljfx/blob/master/src/cljfx/api.clj#L70
(defonce
^{:doc "Starts JavaFX runtime and sets implicit exit to false if JavaFX wasn't started
Either `:cljfx.platform/initialized` or `:cljfx.platform/already-initialized`"}
initialized
(platform/initialize))
I'm not quire sure what the issue is here (I still don't have a good mental picture for Clojure's compilation model)
I then double checked the differences between our projects.. and if I disable AOT compilation, remove (:gen-class :main true)
and switch to depstar
then it seems I can generate a jar without crashing (though the jar doesn't run GUI but just drops me into a REPL when I run java -jar myapp.jar
)
Maybe I'm doing something wrong - but I feel there is some larger issue
from cljfx.
It seems (according to a conversation I had on IRC) that the issue is that you have a side-effect in a def
. So this will get evaluated during compilation. Maybe this initialization can happen when the renderer is first launched so that it only happens at runtime?
from cljfx.
Hi!
I guess I'll eventually need to create a FAQ since this issue seems to be brought up from time to time, and the problem is — you can't AOT-compile cljfx without starting JavaFX runtime. I described why it is like that here. There, the reported problem is that lein uberjar
never finishes because cljfx starts javafx application thread that needs to be explicitly terminated. It prevents normal compilation to hang, and it will fail if we compile it on a machine without display.
One workaround that might require changing cljfx was suggested to not start javafx application thread when *compile-files*
is true (which indicates that compilation is in progress). It still is not a reliable way to AOT-compile cljfx since compilation will fail if you have any class from javafx.scene.control
package imported in your code. It will help in some cases though, so I might implement it.
I think I'll use a system property like cljfx.initialize-javafx
so it will not be a breaking change for existing workflows that compile cljfx apps on a machine with a display.
Another possibility that you might want to explore is to compile cljfx with javafx in headless mode, and then use compiled classes with normal javafx dependencies to build an uberjar. It won't be as easy as lein uberjar
, but if you want to give it a try, I can start with how I setup headless javafx for tests in github actions.
from cljfx.
I don't really understand how to integrate the headless javafx into my compilation, sorry. Could you indicate where you are doing that in your hn project? Because you setup CI there and it seems to work smoothly without any funny stuff.
If it's too involved then I guess I will just skip CI entirely. It'd simplify my workflow but it's not essential. Not something to complicate my life over :)
from cljfx.
I don't do AOT compilation in hn project :)
from cljfx.
Ah! Right! ...
And I can't get things working without AOT b/c no matter what I try it doesn't seem to be able to find my -main
(either Error: Could not find or load main class sausage.core
or I get dropped into a REPL). Clojure build tools are a pain in the ass haha :)
I guess I'll stick to just uploading binaries manually for uberjar builds for now and plug away at this (b/c it's the only practical way for me to ultimately make Windows/MacOS binaries). Thanks for the help as always!
from cljfx.
You can use clojure.main
as a main class that is then calls your main, that's what hn does — effectively calls clojure.main -m hn.core
.
from cljfx.
Ohhhhh, you specify that in the jpackage step. So the intermediary uberjar
isn't supposed to launch. I should have actually clones the repo and tried it locally :)
from cljfx.
okay, I got it working.
I get what you meant now. I can run the non-AOT compiled jar with java -sausage.jar -m sausage.core
- though I'm not sure how I'd begin to bundle that resulting uberjar into something double clickable by a user (though in fairness the AOT uberjars also don't launch on double click)
There were a few gotchas that I'll just mention in case someone else stumbles on this
cambada
can't make an uberjar with no AOT compiled maindepstars
spits thousands of warnings about duplicate classes b/c of the crossplatform fix you gave me on reddit- so to make the warnings go away I have to make it non-cross-platform again
- because I need to remove the
(:gen-class :main true)
from mycore.clj
file, I can't just have another alias to continue to build AOT locally (other than by uncommenting and then recommenting it before I commit each time) - the non-AOT app take an eyewatering 17 seconds to launch vs. 8 seconds with AOT .. which was still bad, but it's not to the point where you're wondering if it crashed or not haha :)
Now that I have a super slow non crossplatform version I guess I need to look into getting jpackage
working now :)
Sorry about the link-spam. I kept force-pushing the same commit as i tweaked it
from cljfx.
By the way, I don't receive notifications for pushed commits that reference this issue :)
I released 1.7.0 that makes it easier to AOT-compile apps that use cljfx, please give it a try — see relevant readme section.
from cljfx.
This is fantastic! It works great! I spent all day fighting Github Actions and now I have Releases :)
Well I'm still trying to figure out how to get a prerelease to track master
.. but at least I know that the uberjar is getting built and it works :) This will make my life much easier. Thank you so much again!
from cljfx.
Related Issues (20)
- controlsfx, CheckComboBox HOT 7
- depstar is deprecated and archived; switch to tools.build HOT 2
- The example project fails with (UnsupportedOperationException) HOT 6
- Mouseclick and textfield ?
- Support for CheckBoxTreeItem/CheckBoxTreeCell
- Method for adding another context-like property HOT 1
- Runnning examples/e20_markdown_editor results in NullPointerException: HOT 1
- How do I use StyledTextArea or any new class? HOT 2
- Broken encoding for Sanskrit text in WebView HOT 2
- How do I exit the packaged app on window close or menu quit command HOT 2
- Unable to open DISPLAY HOT 4
- Trying to understand the lifecycle again
- Using cljfx with Gradle HOT 2
- Problem using leiningen HOT 2
- how to pass args to constructors HOT 3
- how to set the background of a region HOT 5
- Children: duplicate children added: when using pie-chart and dynamic rendering HOT 3
- Memory reuse with `fx/ext-instance-factory` HOT 5
- behavior of tree cell factory
- Obscure classloader problem in cider HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cljfx.