Fork me on GitHub

Hi, I'm not sure if this is the right channel to ask this, but I'm having compilation issues with GraalVM native-image that seem to be specific to running the build in GitHub CI. The native image compiles fine as in it doesn't throw any errors, but the executable produced from it is throwing errors that don't occur when building locally. Here's the full output from the CI build: Here's the error that it's throwing when trying to run the executable produced:

> ./shan-0.1.0-snapshot-linux
Error: Exception in thread "main" No such file or directory
	at shan.config$create_file.invokeStatic(config.clj:13)
	at shan.config$create_file.invoke(config.clj:10)
	at shan.config$setup_first_time_use.invokeStatic(config.clj:56)
	at shan.config$setup_first_time_use.invoke(config.clj:46)
	at shan.core$_main.invokeStatic(core.clj:53)
	at shan.core$_main.doInvoke(core.clj:52)
	at clojure.lang.RestFn.invoke(
	at clojure.lang.AFn.applyToHelper(
	at clojure.lang.RestFn.applyTo(
	at shan.core.main(Unknown Source)
Error: Process completed with exit code 1.
The error is coming from this file when trying to create a file. I thought at first this might be an issue with trying to create the file in a docker environment for some reason? But I downloaded the build artifact and ran it locally and it produces the same error. Anyone know what might be the issue with this?


When compiling Clojure programs, top level defs must be delayed, or they will be executed at compile time.


Hmm... I understand how that could make something compiled in a CI environment not work when downloading the native image to local, but I don't see why that would break it running the image in the CI environment? I will remove the top-level defs though. What's the best way of handling this sort of thing instead of assigning them at top level?


wrapping them in a delay or function


Ahah! Thanks @U04V15CAJ! That solved one part of my problem! Was able to get everything else working from there. 47 tries and 3 evenings later and my CI pipeline finally produces working builds!

🎉 1