bbb icon indicating copy to clipboard operation
bbb copied to clipboard

Error for babashka/tasks

Open robbieh opened this issue 8 months ago • 4 comments

I have a tool - https://github.com/robbieh/way - that I thought this would be great for. Stumbled around a bit. Thought I had it figured out. And then this error happens:

> bb native-image
[babashka] WARNING: task(s) 'run', 'uberjar' override built-in command(s). Use :override-builtin true to disable warning.
DEPRECATED: Libs must be qualified, change expound => expound/expound (/home/robbie/.gitlibs/libs/cli-matic/cli-matic/1aa64070fec1556998b5bbb95d72f3513667ff6a/deps.edn)
DEPRECATED: Libs must be qualified, change expound => expound/expound (/home/robbie/.gitlibs/libs/cli-matic/cli-matic/1aa64070fec1556998b5bbb95d72f3513667ff6a/deps.edn)
DEPRECATED: Libs must be qualified, change expound => expound/expound (/home/robbie/.gitlibs/libs/cli-matic/cli-matic/1aa64070fec1556998b5bbb95d72f3513667ff6a/deps.edn)
DEPRECATED: Libs must be qualified, change expound => expound/expound (/home/robbie/.gitlibs/libs/cli-matic/cli-matic/1aa64070fec1556998b5bbb95d72f3513667ff6a/deps.edn)
Compiling way.main
Execution error (FileNotFoundException) at way.notecheck/loading (notecheck.clj:1).
Could not locate babashka/tasks__init.class, babashka/tasks.clj or babashka/tasks.cljc on classpath.

Which is odd, because my project isn't using babashka/tasks. And it seems tasks isn't available as a jar. Thought you might have some ideas of what to try next?

robbieh avatar Jun 26 '25 01:06 robbieh

Hey robbieh, Thanks for checking out bbb! The main issue is that to build a cli that works with bbb it needs to be written in a way that can run on the JVM version of Clojure too (otherwise native-image won't be able to compile).

I forked your repo and unleashed claude code on it to see if it could tweak things into submission, and it was able to get a working version that runs with bbb and was able to build a native-image out of it. I've opened a PR with claude's changes here. While it compiles in this form, you'll probably want to look over it's changes carefully and decide if you actually want to merge them or not, I can't vouch for their quality 😅.

The main thing was that bbb expects to be using cli-matic for the cli and Claude wasn't able to get the rewrite-edn dep you were using to work well on the JVM. Claude "solved" that last one by just not bothering with the rewrite-edn lib and modifying the edn the old fashion way, but that doesn't preserve any formatting. I also had claude write up a guide going over the steps it used to get a working native-image built using bbb, though I've not double checked it all so take it it with a truckfull of ai flavored salt.

That said, it does build now, and should serve as a good starting point to get things integrated with bbb.

nikvdp avatar Jun 26 '25 09:06 nikvdp

Wow what a response :D

Sorry about the false lead - I thought I had removed the dep on babashka.tasks. Glad that Claude caught that one!

I also found out that updating the rewrite-edn version in bbb's deps fixed that problem.

It compiled after just those two fixes, but now I get:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315)
Caused by: java.io.FileNotFoundException: Could not locate way/main__init.class, way/main.clj or way/main.cljc on classpath.

It runs with bb run-clj just fine. Any tips on where to look to figure that out?

robbieh avatar Jun 27 '25 18:06 robbieh

Hm, that one's new to me, looks like graal did something odd. Are you able to get the version in the PR to build a native image? If so I'd start from there, that built a working native image for me (on Linux, ymmv if you're on something else) so you ought to be able to compare the diffs to see what's different between the PR version and your version. Let me know if you figure it out!

nikvdp avatar Jun 28 '25 08:06 nikvdp

Would you share your bb.edn? I get the same error with the PR version.

robbieh avatar Jun 28 '25 14:06 robbieh