I'm trying to cross-build an arm64 image using podman with podman build -t sample:latest -f deploy/Containerfile . --arch=arm64.
My cross building environment works in general but now at the uberjar step I get:
[1/4] STEP 4/4: RUN clojure -T:build uber :uber-file '"target/app.jar"' :resource-dirs '["config" "resources"]'
Cloning:
Error building classpath. Cannot run program "git": error=0, Failed to exec spawn helper: pid: 66, exit value: 1
java.io.IOException: Cannot run program "git": error=0, Failed to exec spawn helper: pid: 66, exit value: 1
...
Any ideas?your base image doesn't have git installed?
(never used podman btw)
base image is clojure:tools-deps and the whole Dockerfile works as expected when building for amd64
Not sure if it will work then - you need to use an arm64 image on your arm machine to build - that's why git executable doesn't work
I think I might be onto something about the arm64 images issue. Minimal POC:
Using podman (or docker), run a vanilla tools:deps (amd64) image:
podman run --rm -it clojure:tools-deps
In the spawned clojure repl, enter:
(require '[clojure.java.shell :as sh])(sh/sh "ls" "-la")
On the amd64 variant it returns:
user=> (require '[clojure.java.shell :as sh])(sh/sh "ls" "-la")
nil
{:exit 0, :out "total 0\ndrwxrwxrwt 1 root root 30 Nov 7 20:52 .\ndr-xr-xr-x 1 root root 18 Nov 10 20:36 ..\ndrwxr-xr-x 1 root root 2 Nov 10 20:36 hsperfdata_root\n", :err ""}
Running an arm64 image using:
podman run --arch=arm64 --rm -it clojure:tools-deps
Entering the same expression, it returns:
(require '[clojure.java.shell :as sh])(sh/sh "ls" "-la")
nil
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application
Execution error (IOException) at java.lang.ProcessImpl/forkAndExec (ProcessImpl.java:-2).
error=0, Failed to exec spawn helper: pid: 75, exit value: 1I think @cap10morgan would know something about this.
hmm... not sure. my first thought is to make sure you run both of these commands since you're using a moving-target tag:
docker pull clojure:tools-deps
docker pull --platform=linux/amd64 clojure:tools-deps(or --platform=linux/arm64 if your host is amd64)
I found it
Apparently it has to do something with this:
Changing image to clojure:temurin-11-tools-deps fixes the problem