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: native aarch64-darwin support #115235

Merged
merged 1 commit into from
May 11, 2021
Merged

Conversation

bobrik
Copy link
Contributor

@bobrik bobrik commented Mar 6, 2021

Motivation for this change

This is intended to work in top of #105026.

I just wanted to have a working black, which is a Python code formatter. It depends on aiohttp for an http server in daemon mode, which in turn depends on numpy, which wants blas and lapack, both of which depend on gfortran. So here we are.

Both openblas and lapack require changes for aarch64-darwin support, I'll open PRs for them after we agree on this one.

I need help with every TODO, since I can't figure out the proper way to deal with them.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Mar 6, 2021
@bobrik bobrik mentioned this pull request Mar 6, 2021
21 tasks
@bobrik bobrik force-pushed the ivan/gcc-aarch64-darwin branch from f493b16 to 0628d3a Compare May 5, 2021 02:41
@bobrik
Copy link
Contributor Author

bobrik commented May 5, 2021

Updated the PR to use GCC 11 instead of GCC 10, which reduces the patch from 22.6MiB to 0.5MiB. I also dropped the thinning patch since @thefloweringash removed the need for it.

This PR depends on #121759, which is why I cherry-picked the commit from there.

for configureScript in $configureScripts; do
patchShebangs $configureScript
done
''
# This should kill all the stdinc frameworks that gcc and friends like to
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This section moved from pre to post patch, otherwise the changes in here invalidate the patch base.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracting this into a separate PR targeting staging: #121772.

@bobrik bobrik marked this pull request as ready for review May 5, 2021 02:43
@@ -432,14 +432,16 @@ stdenv.mkDerivation {
# Always add -march based on cpu in triple. Sometimes there is a
# discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in
# that case.
+ optionalString ((targetPlatform ? gcc.arch) &&
# TODO: aarch64-darwin has mcpu incompatible with gcc
+ optionalString ((targetPlatform ? gcc.arch) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64)) &&
Copy link
Member

Choose a reason for hiding this comment

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

What exactly is the problem here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#105026 sets CPU to something GCC doesn't know about:

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

@bobrik bobrik force-pushed the ivan/gcc-aarch64-darwin branch 2 times, most recently from 46fcd10 to a680b4b Compare May 5, 2021 05:24
@bobrik
Copy link
Contributor Author

bobrik commented May 5, 2021

I'm confused why ofborg picks gcc11Stdenv to build s2n-tls here.

@bobrik bobrik force-pushed the ivan/gcc-aarch64-darwin branch from a680b4b to 4aa95e3 Compare May 11, 2021 02:08
@ofborg ofborg bot requested a review from Synthetica9 May 11, 2021 02:17
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 11, 2021
@bobrik
Copy link
Contributor Author

bobrik commented May 11, 2021

Figured out why gcc11Stdenv was used (it was a typo), ofborg is happy now.

We can either:

Copy link
Member

@vcunat vcunat left a comment

Choose a reason for hiding this comment

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

Can't see why block this.

@vcunat vcunat changed the base branch from master to staging May 11, 2021 10:18
@vcunat vcunat merged commit 8eabe2e into NixOS:staging May 11, 2021
@bobrik bobrik deleted the ivan/gcc-aarch64-darwin branch May 14, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants