This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-04
Channels
- # aleph (1)
- # announcements (7)
- # beginners (22)
- # calva (31)
- # cider (2)
- # clj-commons (1)
- # clj-http (2)
- # clj-kondo (10)
- # cljsrn (33)
- # clojure (18)
- # clojure-europe (7)
- # clojure-nl (3)
- # clojure-uk (2)
- # clojurescript (93)
- # depstar (3)
- # events (1)
- # figwheel-main (3)
- # fulcro (13)
- # graalvm (95)
- # graphql (1)
- # introduce-yourself (1)
- # lsp (92)
- # off-topic (2)
- # pathom (11)
- # releases (1)
- # shadow-cljs (33)
- # specter (6)
- # tools-deps (4)
- # vim (3)
- # web-security (1)
- # xtdb (7)
I'm just getting started with making some graalvm images on my own rather than using cambada. I've been using the way to generate a package listing from https://github.com/lread/clj-graal-docs/issues/53 but whenever I use this my resulting images crash with an exception saying that they can't find the clojure/core/server__init.class files. When I pass an empty string, it works as intended, triggering my main function as normal. Is this something that someone else has run into?
This means that list just isn't complete. As of now, you don't yet need that list and you can just say --initialize-at-build-time
Oh, okay. So I guess that appending clojure
like this one does isn't sufficient anymore.
I guess then I'm puzzled why it filters out all the clojure packages.
this list worked for me: https://github.com/babashka/babashka/blob/f792c98784e78565222ed86824450b063425d605/script/compile#L51
thanks
perhaps you're just missing one package and that's why it complains about clojure.server
I just tried not filtering out any clojure packages and it still broke.
same error too, which is odd
but clojure generates code in which clojure.server is referred so this can happen from any clojure code really
Ah, okay.
Perhaps it's when it call this one: https://github.com/clojure/clojure/blob/a29f9b911b569b0a4890f320ec8f946329bbe0fd/src/jvm/clojure/lang/RT.java#L471
Oh it's just occurred to me what my problem is
The call to all-ns
is in the wrong jvm
Alright, well for now I won't bother with specifying a list.
:thumbsup:
wow slack
The other question I have is how to specify the name of the output image? I'm trying -H:Name=blah
and it still just uses the name of the jar it's sourced from.
Then I am very confused, because it is getting passed, but it's not changing the name.
(b/process {:command-args [native-image
"-H:Name=fermented-formatter-standalone"
"-jar" "fermented-formatter-standalone.jar"
"--initialize-at-build-time"
"--no-fallback"]
:dir target-dir})
I had previously just fermented-formatter
to pass the -H:Name=
and it did nothing
that is, it still had the -standalone suffix
I had it on there for a bit, but at least on my machine it just says that's an invalid flag since it's not a server.
nope, manjaro, installed graalvm and native-image through the aur for the jdk11-graalvm-bin packages
no I'm not, I didn't really check what the sources are for the aur packages. 😛
The help:
Usage: native-image [options] class [imagename] [options]
(to build an image for a class)
or native-image [options] -jar jarfile [imagename] [options]
(to build an image for a jar file)
ooh, so I could just put the imagename at the end
Well the jayfu one you pointed me to had the -H before the -jar, but maybe it didn't matter for them since they are using the same name.
Ah, I see, so it should probably go after
or at least it's after in clj-kondo
Is there something special I have to do to have resources included?
Or I guess I should step back a minute, is there any way for me to use the normal resources flow of using io/resource to get a file out from inside the resulting binary? It seems like there should be with the -H:IncludeResources flag
But after including that, it doesn't appear to work.
So order of arguments definitely fixed the problems with -H:Name worked. That said, same order as in babashka is giving me issues. I'm gonna try a couple more things then I'll push and post a link to see if you can spot anything if you're willing to look it over.
Do the resources work now? Glancing over the code it seems that you're using two ending //
s perhaps, but just printing the resources config out will probably help spot that
You're right, I am having a double slash now. I added those ending slashes for consistency just a minute ago. I'll try again without the double slash, but I don't think that's the issue.
-H:IncludeResources=resources/.* is what it is now, I'm doing a rebuild atm
It did have the double slash last build tho
Same error though.
Either way.
I have the full verbose output I can post in a file if that'd help
I thought it was an absolute file directory
and .* will include everything on the claspath probably so perhaps not the best thing to do :)
I guess maybe what I should actually do is a file-seq that makes an alternation-based regex that's got every resource quoted
Yes, it's about that file.
Although I'd prefer to not have to edit this if I add more resources later.
Or I could just do fermented_formatter/.*
and commit to only putting resources under that path.
fair enough.
Makes sense.
You can actually dump your native image args in a folder in resources as well: https://github.com/babashka/babashka/blob/master/resources/META-INF/native-image/babashka/babashka/native-image.properties
awesome, it works now!
This is documented at: https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#embedding-a-configuration-file
Thanks
I'll take a look
I really appreciate all the help!