In "(guix) Additional Build Options", documenting the --system option,
the Guix manual says:

Similarly, when transparent emulation with QEMU and ‘binfmt_misc’
   is enabled (*note ‘qemu-binfmt-service-type’: Virtualization
   Services.), you can build for any system for which a QEMU
   ‘binfmt_misc’ handler is installed.

So, I added this -- the exact configuration from "(guix) Virtualization Services" in the manual -- to my operating-system’s services:

         (service qemu-binfmt-service-type
                          (qemu-binfmt-configuration
(platforms (lookup-qemu-platforms "arm" "aarch64"))))

And `guix system reconfigure'd.  The service is running:

   # herd status qemu-binfmt
   Status of qemu-binfmt:
     It is running since Mon Dec 30 20:47:07 2024 (6 days ago).
     Running value is #t.
     It is enabled.
     Provides: qemu-binfmt
     Requires: file-system-/proc/sys/fs/binfmt_misc
     Will be respawned.

If I try to build a package with --system specified, it fails due to the wrong architecture:

   $ guix build --system=aarch64-linux guix
   The following derivation will be built:
     /gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv
building /gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv... @ unsupported-platform /gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv aarch64-linux while setting up the build environment: a `aarch64-linux' is required to build `/gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv', but I am a `x86_64-linux' builder for `/gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv' failed with exit code 1 build of /gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv failed View build log at '/var/log/guix/drvs/6w/wbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv.gz'. guix build: error: build of `/gnu/store/6wwbzsry0c3sm5s0aifgj4sfzahmkk30-guix-1.4.0-31.121e96d.drv' failed

The "(guix) Native Builds" part of the manual mentions that this error will occur "If the ‘binfmt_misc’ mechanism is not setup correctly..."

What is the correct way to set Guix up so I can build aarch64-linux packages on x86_64-linux?

Thanks,

 -- Ian

Reply via email to