Skip to content

cc-wrapper: warn about cross-compile only with non-default #379593

Merged
emilazy merged 2 commits intoNixOS:stagingfrom
th7nder:t/cross-compilation-warn
Mar 11, 2025
Merged

cc-wrapper: warn about cross-compile only with non-default #379593
emilazy merged 2 commits intoNixOS:stagingfrom
th7nder:t/cross-compilation-warn

Conversation

@th7nder
Copy link
Contributor

@th7nder th7nder commented Feb 5, 2025

It is a follow-up to #323869.
Basically, show the warning if we're really setting the target for the cross-compilation different than the default platform.

It started to break some stuff in downstream Rust crates which depended on the stderr to check whether something is supported or not. Example issue: andresilva/polkadot.nix#36.

Investigation details are in the comments: #323869.

@emilazy @risicle

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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Feb 5, 2025
@th7nder th7nder changed the title fix: warn about cross-compile only with non-default target cc-wrapper: warn about cross-compile only with non-default Feb 5, 2025
@nix-owners nix-owners bot requested a review from Ericson2314 February 5, 2025 22:19
Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

Thanks; a lot of build systems seem to do this so I think this is a good change in principle. This will need the base branch changing to staging, as it will cause a mass rebuild of packages.

@th7nder th7nder changed the base branch from master to staging February 25, 2025 10:24
@th7nder th7nder requested a review from emilazy February 25, 2025 10:55
@github-actions github-actions bot added 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels Feb 25, 2025

declare -i n=0
nParams=${#params[@]}
while (("$n" < "$nParams")); do
Copy link
Member

Choose a reason for hiding this comment

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

fwiw it might be nicer to write this as a function that uses shift for this, but w/e, I am more in favour of getting this shipped than bikeshedding the way it is written.

Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

Yeah let’s just get this in the next cycle since it’s happening imminently. Sorry for the slow review. Thanks for this!

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 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants