Mark H Weaver <[email protected]> skribis: > It would be great if we had a build hook to enable guix-daemon to > natively build packages for any system supported by qemu, by running the > build processes within qemu.
QEMU has a ‘qemu-binfmt-conf.sh’ script that installs binfmt_misc handlers for all the architecture-specific ELF variants. Once you’ve run this script, you can transparently run, say, ARM executables (the kernel takes care of invoking ‘qemu-arm’ for you). Without this, ‘qemu-arm’ & co. do not follow ‘execve’ syscalls, so binfmt_misc is probably the only way to achieve what we want. It actually works. For instance, here I’m mimicking on my x86_64 machine what a .drv file for ARM describes: env -i TMPDIR=/tmp out=$PWD debug=$PWD "/gnu/store/mrq1big4g3icywwg8f6jd2cahq79wc6h-guile-2.0.14/bin/guile" --no-auto-compile -L "/gnu/store/kk5w5almhpx7g696vb9si8ham2r0z88l-module-import" -C "/gnu/store/80cdsxvx97c89slkajrkrdd9hw9p3smb-module-import-compiled" "/gnu/store/9667pad1s8ympbr8z0yr65qj061gzr19-coreutils-8.26-guile-builder" (Here I’m using the ARM Guile, but for a slight speedup I could actually use the native Guile.) Then we just need to tell the daemon to not complain (“but I’m an 'x86_64-linux'”). Ludo’.
