Re:Show HN: Cross-Platform GitHub Action
by saurik on Monday January 16, 2023 @06:45PM
(#34407139)
I am sorry but I am having a difficult time understanding your comment. If you are coding in Python, why does the underlying architecture matter at all?
[ Parent
| on HN ]
Re:Show HN: Cross-Platform GitHub Action
by dbingham on Monday January 16, 2023 @06:56PM
(#34407238)
The architecture of the docker image matters. If you build a docker image on an ARM machine (like a m1 or m2 Mac) you can't run it in x86 architecture (like a T3 or M5 AWS instance). If you build on x86 architecture, you can't run it on ARM architecture.
That is, unless you use Docker's cross platform build capability (buildx). Which was still considered experimental the last time I looked at it (about a year ago).
Re:Show HN: Cross-Platform GitHub Action
by Arnavion on Monday January 16, 2023 @07:15PM
(#34407419)
You can build other-arch images with regular `build`. You'll of course need QEMU hooked up through binfmt to be able to execute `RUN` steps while building the image, but you can do that yourself without involving `buildx`.
Re:Show HN: Cross-Platform GitHub Action
by dbingham on Tuesday January 17, 2023 @08:43AM
(#34412241)
Neat! I need to read up on QEMU. I haven't looked into cross arch images in a while.
Re:Show HN: Cross-Platform GitHub Action
by Arnavion on Tuesday January 17, 2023 @02:44PM
(#34417660)
For systemd distros, you might already have systemd-binfmt.service in the systemd package, which when started will automatically register all architectures specified in config files under /usr/lib/binfmt.d with the kernel. Then your qemu package will probably contain one config file in that directory for every arch. So if you enable and start the systemd-binfmt service, you'll automatically have a bajillion architectures registered with the kernel to run under qemu and you don't have to do anything else.
Or you can register manually by writing to /proc/sys/fs/binfmt_misc/register . Note that you'll want to register the statically linked version of qemu (qemu-user-static or whatever your distro calls it), and that you'll want to use at least the O and F flags so that the binary works inside containers automatically insead of needing to be mounted from the host.
Re:Show HN: Cross-Platform GitHub Action
by mananaysiempre on Thursday January 19, 2023 @02:29PM
(#34444494)
> For systemd distros, you might already have systemd-binfmt.service in the systemd package, which when started will automatically register all architectures specified in config files under /usr/lib/binfmt.d with the kernel. Then your qemu package will probably contain one config file in that directory for every arch. So if you enable and start the systemd-binfmt service, you'll automatically have a bajillion architectures registered with the kernel to run under qemu and you don't have to do anything else.
Note that this can screw up other kinds of builds, as the autoconf check for cross-compilation relies on a cross-compiled executable being unrunnable. (Seen with a wine binfmt handler and a MinGW cross compiler.)