Lix functional tests fails on aarch64 crosscompilation #467

Closed
opened 2024-08-14 21:21:19 +00:00 by erdnaxe · 2 comments

Describe the bug

I am trying to build and deploy a NixOS aarch64 system from a NixOS x64 system.
This works fine with nix, but is broken if I set nix.package = pkgs.lix; in the target configuration.

Lix aarch64 cross-compilation fails with:

[...]
Installing symlink pointing to nix to /nix/store/k6is6mm4icbsiz3wwmi2dxk9abkkc4sy-lix-aarch64-unknown-linux-gnu-2.90.0/bin/nix-store
Installing symlink pointing to /nix/store/k6is6mm4icbsiz3wwmi2dxk9abkkc4sy-lix-aarch64-unknown-linux-gnu-2.90.0/bin/nix to /nix/store/k6is6mm4icbsiz3wwmi2dxk9abkkc4sy-lix-aarch>
Running custom install script '/nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash /build/source/meson/cleanup-install.bash /nix/store/qs9apg9592fcwsmkpr7ydsnsazgb>
cleanup-install: removing Meson-placed C++ sources from dest includedir
removed '/nix/store/qs9apg9592fcwsmkpr7ydsnsazgbl0s5-lix-aarch64-unknown-linux-gnu-2.90.0-dev/include/lix/libexpr/parser-tab.cc'
removed '/nix/store/qs9apg9592fcwsmkpr7ydsnsazgbl0s5-lix-aarch64-unknown-linux-gnu-2.90.0-dev/include/lix/libexpr/lexer-tab.cc'
Running custom install script '/nix/store/5w07wfs288qpmnvjywk24f3ak5k1np7r-python3-3.11.9/bin/python3 /build/source/meson/setup-functional-tests.py'
setup-functional-tests.py: mirroring tests/functional to build directory
mkdir: cannot create directory '/nix-support': Permission denied
/nix/store/pinsw12s8mhv2jgz17my9ah3lh8mhq32-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context

Steps To Reproduce

  1. Use a x86 NixOS machine with boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
  2. Run nix run nixpkgs/24.05#pkgsCross.aarch64-multiplatform.lix

nix run nixpkgs#pkgsCross.aarch64-multiplatform.lix (master as of 2024/08/15) also fails.

Expected behavior

Lix should build.

nix --version output

nix (Lix, like Nix) 2.90.0

## Describe the bug I am trying to build and deploy a NixOS aarch64 system from a NixOS x64 system. This works fine with `nix`, but is broken if I set `nix.package = pkgs.lix;` in the target configuration. Lix aarch64 cross-compilation fails with: ``` [...] Installing symlink pointing to nix to /nix/store/k6is6mm4icbsiz3wwmi2dxk9abkkc4sy-lix-aarch64-unknown-linux-gnu-2.90.0/bin/nix-store Installing symlink pointing to /nix/store/k6is6mm4icbsiz3wwmi2dxk9abkkc4sy-lix-aarch64-unknown-linux-gnu-2.90.0/bin/nix to /nix/store/k6is6mm4icbsiz3wwmi2dxk9abkkc4sy-lix-aarch> Running custom install script '/nix/store/wckka8fxv4h5hp74cbkhaw3fw7kbvcs1-bash-5.2p26/bin/bash /build/source/meson/cleanup-install.bash /nix/store/qs9apg9592fcwsmkpr7ydsnsazgb> cleanup-install: removing Meson-placed C++ sources from dest includedir removed '/nix/store/qs9apg9592fcwsmkpr7ydsnsazgbl0s5-lix-aarch64-unknown-linux-gnu-2.90.0-dev/include/lix/libexpr/parser-tab.cc' removed '/nix/store/qs9apg9592fcwsmkpr7ydsnsazgbl0s5-lix-aarch64-unknown-linux-gnu-2.90.0-dev/include/lix/libexpr/lexer-tab.cc' Running custom install script '/nix/store/5w07wfs288qpmnvjywk24f3ak5k1np7r-python3-3.11.9/bin/python3 /build/source/meson/setup-functional-tests.py' setup-functional-tests.py: mirroring tests/functional to build directory mkdir: cannot create directory '/nix-support': Permission denied /nix/store/pinsw12s8mhv2jgz17my9ah3lh8mhq32-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context ``` ## Steps To Reproduce 1. Use a x86 NixOS machine with `boot.binfmt.emulatedSystems = [ "aarch64-linux" ];` 2. Run `nix run nixpkgs/24.05#pkgsCross.aarch64-multiplatform.lix` `nix run nixpkgs#pkgsCross.aarch64-multiplatform.lix` (master as of 2024/08/15) also fails. ## Expected behavior Lix should build. ## `nix --version` output nix (Lix, like Nix) 2.90.0
erdnaxe added the
bug
label 2024-08-14 21:21:19 +00:00
jade added the
Status
invalid
label 2024-08-15 19:03:40 +00:00
Owner

That's not cross compilation, that's qemu-user. Cross compilation (as in, using a compiler targeting aarch64, built for x86_64) does not run the tests and so will in fact work. Unfortunately qemu-user is full of bugs and is known to not successfully build lix.

I would suggest instead, if you do not want cross compilation, building on physical hardware or qemu-system-aarch64 or, easiest, using lix from nixpkgs. Otherwise you can cross compile just lix by, i think, something to the effect of importing pkgs.path with hostPlatform = "aarch64-linux", buildPlatform = "x86_64-linux", then from that nixpkgs instance, pulling out the lix.

There may be other issues on the bug tracker about the problem you're running into, search for qemu. However I don't think we consider qemu-user to be a supported configuration, at least not sufficiently to work around its specific bugs, so I'm going to close this.

That's not cross compilation, that's qemu-user. Cross compilation (as in, using a compiler *targeting* aarch64, built for x86_64) does not run the tests and so will in fact work. Unfortunately qemu-user is full of bugs and is known to not successfully build lix. I would suggest instead, if you do not want cross compilation, building on physical hardware or qemu-system-aarch64 or, easiest, using lix from nixpkgs. Otherwise you can cross compile just lix by, i think, something to the effect of importing pkgs.path with hostPlatform = "aarch64-linux", buildPlatform = "x86_64-linux", then from that nixpkgs instance, pulling out the lix. There may be other issues on the bug tracker about the problem you're running into, search for qemu. However I don't think we consider qemu-user to be a supported configuration, at least not sufficiently to work around its specific bugs, so I'm going to close this.
jade closed this issue 2024-08-15 19:03:46 +00:00
Owner

The invocation we typically use to cross compile Lix is:

nix build --impure -E 'let f = builtins.getFlake "git+file:$PWD"; pkgs = import f.inputs.nixpkgs { crossSystem.system = "aarch64-linux"; }; in pkgs.callPackage ./package.nix { }

And this worked the last we checked, but having checked just now, it appears Nixpkgs may have broken Meson cross compilation:

meson.build:422:18: ERROR: Kernel not defined or could not be autodetected.
The invocation we typically use to cross compile Lix is: ```bash nix build --impure -E 'let f = builtins.getFlake "git+file:$PWD"; pkgs = import f.inputs.nixpkgs { crossSystem.system = "aarch64-linux"; }; in pkgs.callPackage ./package.nix { } ``` And this worked the last we checked, but having checked just now, it appears Nixpkgs may have broken Meson cross compilation: ``` meson.build:422:18: ERROR: Kernel not defined or could not be autodetected. ```
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#467
No description provided.