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

gcc: Darwin cross-compiler build fixes #271787

Merged
merged 4 commits into from
Dec 3, 2023
Merged

Conversation

reckenrode
Copy link
Contributor

Description of changes

Building cross-compilers on Darwin is currently broken. This PR was prompted by #270986, but it does not fix that issue because GCC 8 does not build on aarch64-darwin. qmk will need to be updated to use a newer version of GCC.

All supported GCC versions on Darwin except for GCC 11 on aarch64-darwin should be buildable as cross-compilers.

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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 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.

Priorities

Add a 👍 reaction to pull requests you find important.

Using the host bintools results in evaluation errors when building an
AVR cross-compiler due to trying to build cctools for AVR.
Building a cross-compiler fails due to register storage class specifier
errors when building with clang 16 due to its defaulting to C++17.
Downgrading the error allows the older cross-compilers to build.
@reckenrode
Copy link
Contributor Author

Result of nixpkgs-review pr 271787 run on aarch64-darwin 1

@reckenrode
Copy link
Contributor Author

Result of nixpkgs-review pr 271787 run on x86_64-darwin 1

2 packages built:
  • qmk
  • qmk.dist

@reckenrode
Copy link
Contributor Author

Result of nixpkgs-review pr 271787 run on x86_64-linux 1

@reckenrode
Copy link
Contributor Author

reckenrode commented Dec 3, 2023

I also confirmed the following pkgsCross.{avr,gnu64}.buildPackages.gcc versions built:

  • aarch64-darwin: 12, 13; and
  • x86_64-darwin: 6, 7, 8, 9, 10, 11, 12, 13.

@ofborg ofborg bot added 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 3, 2023
@emilytrau
Copy link
Member

Out of curiosity, why is aarch64-darwin cross compiling broken on gcc11 only?

Copy link
Member

@emilytrau emilytrau left a comment

Choose a reason for hiding this comment

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

thanks so much for this! lgtm. this will get qmk building on x86_64-darwin again which is good enough for me. qmk on aarch64-darwin has pretty much never worked and i can look into that later.

@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 3, 2023
@reckenrode
Copy link
Contributor Author

I think this will have to be manually backported due to #266193.

@reckenrode
Copy link
Contributor Author

Out of curiosity, why is aarch64-darwin cross compiling broken on gcc11 only?

It’s broken on that and older. The reason for calling out GCC 11 is the native compiler builds and works on aarch64-darwin.

@emilytrau
Copy link
Member

Tested QMK builds on x86_64-darwin and ofborg is good. Lets go! 🚀

@emilytrau emilytrau merged commit 3ff9ed0 into NixOS:master Dec 3, 2023
Copy link
Contributor

github-actions bot commented Dec 3, 2023

Backport failed for release-23.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-23.11
git worktree add -d .worktree/backport-271787-to-release-23.11 origin/release-23.11
cd .worktree/backport-271787-to-release-23.11
git switch --create backport-271787-to-release-23.11
git cherry-pick -x db20831951cebae92b8e630b61bf5ca3c1bdad11 fe27958aed65ac531732544dd6a8b9c20da4d813 4a538d6b3df931c87fb38b14fa1d0038d39f45e5 f2a7764cab5799d2a68e6771679780303b5b3afa

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: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants