buildx: Value too large for defined data type
I’m trying to build a Rust project for amd64, armv7 and armv8 locally, but when I do, I get the following error:
> [linux/arm/v7 4/5] RUN cargo fetch:
#16 0.502 Updating crates.io index
#16 0.956 warning: spurious network error (2 tries remaining): could not read directory '/usr/local/cargo/registry/index/github.com-1285ae84e5963aae/.git//refs': Value too large for defined data type; class=Os (2)
#16 1.378 warning: spurious network error (1 tries remaining): could not read directory '/usr/local/cargo/registry/index/github.com-1285ae84e5963aae/.git//refs': Value too large for defined data type; class=Os (2)
#16 1.808 error: failed to get `actix-http` as a dependency of package `docker-bug-value-too-long v0.1.0 (/code)`
#16 1.808
#16 1.808 Caused by:
#16 1.809 failed to fetch `https://github.com/rust-lang/crates.io-index`
#16 1.809
#16 1.809 Caused by:
#16 1.809 could not read directory '/usr/local/cargo/registry/index/github.com-1285ae84e5963aae/.git//refs': Value too large for defined data type; class=Os (2)
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c cargo fetch]: buildkit-runc did not terminate successfully
make: *** [Makefile:5: build] Error 1
I put a repository here for you to reproduce it.
I don’t really know if it’s buildx related or buildkit related (most probably buildkit). The image builds well for armv7 on an raspberry pi, but not from my linux machine.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 22 (1 by maintainers)
Commits related to this issue
- ci(fix): remove armv7 due to docker/buildx#395 — committed to Joxit/kokai by Joxit 4 years ago
- added prebuilt libzkgroup.so for arm64, armv7 and x86_64 * building libzkgroup.so every time when building the docker image takes really long and is quite hacky (due to a bug in docker/buildx: se... — committed to bbernhard/signal-cli-rest-api by bbernhard 3 years ago
- use this workaround https://github.com/docker/buildx/issues/395#issuecomment-761572554 — committed to faldez/tanoshi by deleted user 3 years ago
- use separate jobs for frontend and backend on test separate build frontend and backend fo release remove build trunk in dockerfile use this workaround https://github.com/docker/buildx/issues/395#is... — committed to faldez/tanoshi by deleted user 3 years ago
- use separate jobs for frontend and backend on test separate build frontend and backend fo release remove build trunk in dockerfile use this workaround https://github.com/docker/buildx/issues/395#is... — committed to faldez/tanoshi by deleted user 3 years ago
- tanoshi-cli v0.3.2 split docker job for amd64 and arm64 build for arm and use trunk precompiled binary use separate jobs for frontend and backend on test separate build frontend and backend fo re... — committed to faldez/tanoshi by deleted user 3 years ago
- Removed linux/arm/v7 cause of bug https://github.com/docker/buildx/issues/395 — committed to MarcelCoding/luna by MarcelCoding 3 years ago
- Force platform https://github.com/docker/buildx/issues/395#issuecomment-758466888 — committed to keysym/paru by keysym 3 years ago
- Build does not work for linux/arm/v7 When doing `docker buildx bake -f docker-bake.hcl debian_jdk17` we get ```bash [linux/arm/v7 jre-build 2/2] RUN jlink --add-modules ALL-MODULE-PATH ... — committed to gounthar/docker-agent by gounthar 2 years ago
- Add `arm32` images to the build (#260) * Build does not work for linux/arm/v7 When doing `docker buildx bake -f docker-bake.hcl debian_jdk17` we get ```bash [linux/arm/v7 jre-build 2/2] RUN jl... — committed to jenkinsci/docker-agent by gounthar 2 years ago
- tanoshi-cli v0.3.2 split docker job for amd64 and arm64 build for arm and use trunk precompiled binary use separate jobs for frontend and backend on test separate build frontend and backend fo re... — committed to faldez/tanoshi by faldez 3 years ago
- Fix build on arm/v7 and amd64 Ref: https://github.com/docker/buildx/issues/395 Ref: https://github.com/rust-lang/cargo/issues/4133 — committed to sudo-bot/docker-openldap by williamdes 2 years ago
- tanoshi-cli v0.3.2 split docker job for amd64 and arm64 build for arm and use trunk precompiled binary use separate jobs for frontend and backend on test separate build frontend and backend fo re... — committed to faldez/tanoshi by faldez 3 years ago
- Try to workaround docker/buildx#395 — committed to bjeanes/modbus-mqtt by bjeanes 2 years ago
- Try again to workaround docker/buildx#395 — committed to bjeanes/modbus-mqtt by bjeanes 2 years ago
- Merge branch 'docker' * docker: Don't build docker images for branches unless PR Give up on ARMv7 builds for now Fix typo Try again to workaround docker/buildx#395 Fails with --ofline Fix... — committed to bjeanes/modbus-mqtt by bjeanes 2 years ago
- added prebuilt libzkgroup.so for arm64, armv7 and x86_64 * building libzkgroup.so every time when building the docker image takes really long and is quite hacky (due to a bug in docker/buildx: se... — committed to nomer/signal-cli-rest-api by bbernhard 3 years ago
- Fix: Multi-arch Breaking; Delete ARM32 builds due to the impossibility to build 32 bits binary on a 64 bits host with Cargo on QEMU. See: https://github.com/docker/buildx/issues/395#issuecomment-1069... — committed to clemlesne/azure-pipelines-agent by clemlesne a year ago
if you don’t use
--platform=$BUILDPLATFORM
it will use the target platform. By specifying--platform=$BUILDPLATFORM
you force it to build with your computer’s platform and you won’t have the bug from qemu.@MarcelCoding, you are right. If you follow ehuss’ comment you end up at the QEMU bugtracker which goes into more detail for those interested.
Unfortunately the fix seems very far away, if there even will be a fix. Over in the cargo repo we got around the issue by mounting a tmpfs on the
~/.cargo
folder, and this is appears to not trigger the bug while compilingcryptography
anymore. Perhaps this is something that would work here as well.@jdrouet Thanks for the example Dockerfile - worked like a charm!
Not really related to
buildx
, but does anyone know how to pass theBUILDPLATFORM
to the Dockerfile when building the Dockerfile withdocker-compose
? Up to now, I’ve always useddocker-compose build
when I wanted to quickly build a docker image on my machine and only usedbuildx
for building images for multiple architectures.But with the
--platform=$BUILDPLATFORM
workaround from above,docker-compose build
always fails with:failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
.I already tried:
docker-compose build --build-arg "BUILDPLATFORM=linux/amd64"
but unfortunately that doesn’t work either - same error.It’s not a big deal for me, as I can use
buildx
also for my local builds, but I was just wondering if anyone has an idea?edit: I figured it out.
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build
works for me (just make sure that yourdocker-compose
version is not too old)You can take a look here. I do a fetch using the build platform arch and then copy it in the target platform.
Hello.
I am now reaching another level since this error arises when building a Python program, which depends on cryptography, a library which in turn builds with Rust… See : pyca/cryptography#5771
Let me explain the Python way : on some architectures (here linux/arm/v7) there is no “Python Wheel” package for this dependency so the
pip install
command builds it from source… using Rust… triggering again a Value too large… error !The problem is that I don’t think I can alter the way this dependency builds when triggered by a pip install (the cargo build command is out of hand), and anyway I’m getting tired to implement patches making my Dockerfiles hard to maintain…
Any news ? Is there any link to an original issue on qemu or anything ?
I’ve disabled rust in the cryptography build for now but this trick will be removed from their next release…
I was able to use armv6 and aarch64 just fine, its just arm7 causing this weird issue. Looks like manually building is the way to go for now
I’ve tried using Java and JLink and it occurred the same error: log.txt
[linux/arm/v7]
qemu-v6.1.0-20
https://github.com/MarcelCoding/luna/blob/0b567aa6e1e7889bfe8ad3295dbf9dac1a855cf3/docker/Dockerfile.github-actions#L17-L23 https://github.com/MarcelCoding/luna/blob/0b567aa6e1e7889bfe8ad3295dbf9dac1a855cf3/.github/workflows/ci.yaml#L214-L227
@crazy-max it looks like the issue is still present, I’m building a docker image for multiple platforms, and it fails when I include linux/arm/v7 as can be seen here: https://github.com/texthtml/midi-synthetizer-autoconnect/runs/3399891145?check_suite_focus=true
I’m using the docker/setup-qemu-action@v1 which is using the Qemu binaries from https://github.com/tonistiigi/binfmt
Right, I managed to build it thanks to your example ! I’m not a Rust developer : I’m trying to compile someone else’s Rust project ; so I didn’t figured out that it was a Rust-specific solution.
As I understand it now (if useful to anyone) :
cargo fetch
, this step needs to be executed inside the working container (cargo vendor
will do it)vendor
,.cargo
) into the target imagecargo build ... --offline
), using the previously cached filesI have “vendor” files that look like architecture-specific (e.g.
winapi-i686-pc-windows-gnu
) so I will see if it works at runtime when I can test a container. I wonder then if Rust would simply allow us to fully cross-compile for all targets, then just copy the generated files into the final image?My process is a little bit different since I first clone the code of an existing project from github, so I don’t need to do
cargo init
. The final Dockerfile looks like this and it builds fine : https://gist.github.com/nicobo/06530acc4fd82497878d45a93348ae3cThanks @jdrouet !