Search code examples
dockerraspberry-pi

docker error "exec /usr/bin/make: exec format error" when building for host linux/amd64 on different platform when specifying host platform


I am struggling to get a repo compiling with Docker. I have not made any changes to the source code yet and am just trying to build the master. But I am struggling to build it according to instructions in the repository: NickelMenu

According to instructions the source code is to be compiled with docker with:

docker run --volume="$PWD:$PWD" --user="$(id --user):$(id --group)" --workdir="$PWD" --env=HOME --entrypoint=make --rm -it ghcr.io/pgaskin/nickeltc:1.0 all koboroot

First I am getting a warning (and error) saying: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested exec /usr/bin/make: exec format error

So I have searched around and found that I need to specify the platform if having different platform architecture on the host. I am trying to run this on a raspi (linux/arm64/v8 ?) but the host is linux/amd64 for image ghcr.io/pgaskin/nickeltc:1.0. So I have tried:

sudo DOCKER_DEFAULT_PLATFORM="linux/amd64" docker run --volume="$PWD:$PWD" --user="$(id --user):$(id --group)" --workdir="$PWD" --env=HOME --entrypoint=make --rm -it ghcr.io/pgaskin/nickeltc:1.0 all koboroot

The warning is now removed but I still get the error: exec /usr/bin/make: exec format error

I would appreciate if anyone could give me some directions since I am out of ideas. I am using Docker version 27.5.1, build 9f9e405

Thank you!


Solution

  • The issue is that your hardware (where you run Docker) is based on ARM, while the Docker image that you're using is based on AMD64 (aka "Intel", aka "x86_64").

    You will have to build your own image, which is explained here, but also note that "this cross-toolchain has only been tested on x86_64".