Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib.systems, test.cross.sanity: add test case for #264989 #264992

Merged
1 commit merged into from Nov 4, 2023
Merged

lib.systems, test.cross.sanity: add test case for #264989 #264992

1 commit merged into from Nov 4, 2023

Conversation

ghost
Copy link

@ghost ghost commented Nov 2, 2023

Description of changes

We have several cross-compilation bugs that show up if hostPlatform!=buildPlatform yet hostPlatform.config==buildPlatform.config.

These bugs have appeared and disappeared as we've fiddled with the definition of equality for platform objects. This commit adds a clear-cut case where they are not equal and never will be, so we can test it.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ghost
Copy link
Author

ghost commented Nov 2, 2023

@ofborg build pkgsCross.gnu64_simplekernel.bash

@ghost ghost marked this pull request as ready for review November 2, 2023 10:44
@ghost ghost requested review from alyssais and Ericson2314 as code owners November 2, 2023 10:44
@ghost
Copy link
Author

ghost commented Nov 2, 2023

Should fail with

bash-5.2-p15-x86_64-unknown-linux-gnu> checking for x86_64-unknown-linux-gnu-gcc... x86_64-unknown-linux-gnu-gcc
bash-5.2-p15-x86_64-unknown-linux-gnu> checking whether the C compiler works... no
bash-5.2-p15-x86_64-unknown-linux-gnu> configure: error: in `/build/bash-5.2':
bash-5.2-p15-x86_64-unknown-linux-gnu> configure: error: C compiler cannot create executables
bash-5.2-p15-x86_64-unknown-linux-gnu> See `config.log' for more details
error: build of '/nix/store/fxlhkfq8lax6f2jmsh59vl4q8m8ig7az-bash-5.2-p15-x86_64-unknown-linux-gnu.drv' on 'ssh://root@192.168.22.101' failed: builder for '/nix/store/fxlhkfq8lax6f2jmsh59vl4q8m8ig7az-bash-5.2-p15-x86_64-unknown-linux-gnu.drv' failed with exit code 77
error: builder for '/nix/store/fxlhkfq8lax6f2jmsh59vl4q8m8ig7az-bash-5.2-p15-x86_64-unknown-linux-gnu.drv' failed with exit code 1;
       last 10 log lines:
       > checking build system type... x86_64-unknown-linux-gnu
       > checking host system type... x86_64-unknown-linux-gnu
       >
       > Beginning configuration for bash-5.2-release for x86_64-unknown-linux-gnu
       >
       > checking for x86_64-unknown-linux-gnu-gcc... x86_64-unknown-linux-gnu-gcc
       > checking whether the C compiler works... no
       > configure: error: in `/build/bash-5.2':
       > configure: error: C compiler cannot create executables
       > See `config.log' for more details
       For full logs, run 'nix log /nix/store/fxlhkfq8lax6f2jmsh59vl4q8m8ig7az-bash-5.2-p15-x86_64-unknown-linux-gnu.drv'.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Nov 2, 2023
@ghost
Copy link
Author

ghost commented Nov 2, 2023

Should fail with

Yep

@ghost
Copy link
Author

ghost commented Nov 2, 2023

Once #263082 merges we will get warned about stuff like this.

We have several cross-compilation bugs that show up if
hostPlatform!=buildPlatform yet
hostPlatform.config==buildPlatform.config.

These bugs have appeared and disappeared as we've fiddled with the
definition of equality for platform objects.  This commit adds a
clear-cut case where they are *not* equal and never will be, so we
can test it.
@ghost
Copy link
Author

ghost commented Nov 3, 2023

@ofborg build pkgsCross.gnu64_simplekernel.bash

@@ -134,6 +134,7 @@ let
pkgs.pkgsMusl.stdenv
pkgs.pkgsLLVM.stdenv
pkgs.pkgsStatic.bash
#pkgs.pkgsCross.gnu64_simplekernel.bash # https://github.com/NixOS/nixpkgs/issues/264989
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use pkgsLLVM or something instead so we don't need to use a new example?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use pkgsLLVM or something instead so we don't need to use a new example?

Unfortunately pkgsLLVM doesn't demonstrate the problem:

This will succeed:

@ofborg build pkgsLLVM.bash

This will fail:

@ofborg build pkgsCross.gnu64_simplekernel.bash

@ghost ghost requested a review from alyssais November 4, 2023 04:24
@ghost ghost merged commit 72c279f into NixOS:master Nov 4, 2023
22 of 23 checks passed
@ghost ghost deleted the test-case-for-issue-264989 branch November 4, 2023 05:57
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: lib The Nixpkgs function library 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant