News for hackers. Stuff that matters.
Re:Today I Learned: Binfmt_misc by cefboud on Monday November 10, 2025 @11:15AM (#45877396)
One cool usage of Binfmt_misc is multi-platform builds in Docker (through QEMU), although it can be painfully slow.
Re:Today I Learned: Binfmt_misc by hackernudes on Monday November 10, 2025 @11:49AM (#45877827)
I wonder if the compiler could still be a native binary (but still producing code for the target architecture). The motivation is to have the performance of a cross compile with the simplicity of a native build. I had that idea a long time ago but never tried it.
Re:Today I Learned: Binfmt_misc by cefboud on Monday November 10, 2025 @07:31PM (#45882733)
For languages that support cross-compiling e.g Golang, the Docker docs recommend cross-compiling natively and copying the resulting binary to the various platform images. binfmt_misc with QEMU is needed for languages that don't support that, or when you want to run a binary from the base image. For example, if you're building a x86 Docker image on ARM and you run `RUN apt install` in the Dockerfile, you're essentially running an x86 ELF on ARM, and that's where QEMU/binfmt_misc step in.