Fork me on GitHub
#tools-deps
<
2021-08-24
>
Jeff Evans18:08:44

anyone know what might be causing this kind of error, when invoking clojure -X:deps prep

Cloning: 
Checking out:  at 1e7c019730dc6f9e38793170c8801c5950516b60
Downloading: org/clojure/tools.namespace/1.0.0/tools.namespace-1.0.0.pom from central
Downloading: org/clojure/tools.namespace/1.0.0/tools.namespace-1.0.0.jar from central
Execution error (IOException) at java.lang.ProcessImpl/forkAndExec (ProcessImpl.java:-2).
error=2, No such file or directory
more context in thread

Jeff Evans18:08:32

this is running inside a Docker image which itself is running via a GitHub action, so there is some degree of virtualized craziness going on. Clojure itself is being installed, via:

# install clojure version needed for Metabase
curl -O 
chmod +x linux-install-1.10.3.933.sh
./linux-install-1.10.3.933.sh

Jeff Evans18:08:15

I also couldn’t quite figure out how to tell it to spit out the command it’s trying to fork and exec

Alex Miller (Clojure team)19:08:24

are you using compile-clj?

Alex Miller (Clojure team)19:08:12

if so, that's the most likely culprit as it forks a jvm to run the compile, and my best guess is that the directory it's trying to do that in doesn't exist

Jeff Evans19:08:25

I’m not sure… I never explicitly call such a command from this script

seancorfield19:08:53

@U0183EZCD0D Do you know what "prep" your dependencies have declared? That would at least tell you what it is trying to run.

seancorfield19:08:59

@U064X3EF3 Is there some hidden "verbose" or debug flag that could be turned on here to help?

Jeff Evans19:08:47

I’m afraid I still haven’t grokked deps enough to be able to understand that question 😞

Jeff Evans19:08:00

actually, I figured it out, that java is not on $PATH apparently

{:type java.io.IOException,
    :message
    "Cannot run program \"java\" (in directory \"/app/source/java\"): error=2, No such file or directory",
    :at [java.lang.ProcessBuilder start "ProcessBuilder.java" 1128]}

3
seancorfield19:08:35

For the future, you'd be looking for :deps/prep-lib in deps.edn in one or more of the dependencies, which tells -X:deps prep what code needs to be run.

Alex Miller (Clojure team)19:08:33

sorry I was in a meeting

Alex Miller (Clojure team)19:08:35

I have not (yet) added any debugging here, but there is a lot of stuff that gets spit into the temp directory where this is happening and on error, it is left so you can examine the entrails

Jeff Evans19:08:53

this one?

Full report at:
/tmp/clojure-5839141627426774183.edn

Alex Miller (Clojure team)19:08:24

that's a separate thing, but also useful

Alex Miller (Clojure team)19:08:37

that's the error reporting output from clojure.main

Alex Miller (Clojure team)19:08:53

user=> (import [java.nio.file Files] [java.nio.file.attribute FileAttribute])
user=> (.toString (.toFile (Files/createTempDirectory "compile-clj" (into-array FileAttribute []))))
"/var/folders/_4/rhwlxzf92fj4727zsjk8xjtw0000gp/T/compile-clj17809906038309626783"

Alex Miller (Clojure team)19:08:32

should show you approximately the directory where it's happening (the number at the end will be different, but just look for the newest directory and that will have some stuff in it

Alex Miller (Clojure team)19:08:43

there should be a compile.clj script there, and a compile.cp classpath file

Alex Miller (Clojure team)19:08:54

although I don't think either would help you with the problem above

Jeff Evans19:08:24

right, yeah, this ended up just being something silly. I appreciate the pointers, though, which I will consult next time. thanks to both of you!