treewide: migrate to -fno-common#110571
Conversation
|
Huh, it's weird that this causes an stdenv rebuild on darwin. It should only affect GCC. |
|
r-burns
left a comment
There was a problem hiding this comment.
I wonder if this would warrant a hydra job. Since this primarily affects linux, it could be a good task for spare x86_64-linux builders.
There was a problem hiding this comment.
The darwin stdenv contains cpio, but we can avoid the rebuild:
| NIX_CFLAGS_COMPILE = "-fcommon"; | |
| NIX_CFLAGS_COMPILE = if stdenv.cc.isGNU then "-fcommon" else null; |
There was a problem hiding this comment.
Also it looks like gentoo has a fix for this: https://bugs.gentoo.org/705900
There was a problem hiding this comment.
It goes to staging anyway so we don't really need to worry about stdenv rebuilds.
There was a problem hiding this comment.
Aha, that solves the Darwin mystery.
My inclination is to use CFLAGS instead of patches initially, because it keeps the PR simple and seems less likely to break things; we can always switch to patches on a per-package basis later. But I can probably be convinced otherwise.
There was a problem hiding this comment.
I ran into this for #126411 too. I opted for patches in the cases I came across because I figured they'd break sooner and trigger people to reevaluate them. For cpio in particular I've also sent an email to upstream (no response so far). So I'm in favor of having this apply for Darwin and clang too : )
|
iso_minimal now builds. I can upload to cachix if it helps anyone. |
|
Bah, there's a merge conflict, but if I try to merge in aa8868c (the output of |
|
There’s a conflict in |
|
Clang 11 is making the same change (changelog, D75056) so these changes shouldn't be restricted to GCC. I ran into this when working on |
|
Sorry this PR is languishing (and for all the force pushes) - I can't manage to fix the merge conflict without GitHub pulling in thousands of unrelated commits. I thought |
|
All failing packages noticed on hydra are now fixed in After that we'll be ready for merge. |
|
Failures extracted from this iteration:
|
|
Jobset: as x86_64-darwin is now catching up about a week of outage on Hydra, I canceled it here and put in aarch64-darwin instead (was idling right now). |
3fdf85c to
e9ee2e0
Compare
GCC 10 sets -fno-common by default. This broke some packages, so when moving to GCC 10 we initially disabled this behavior. This commit reverts that, bringing us closer to the standard and upstream. Co-authored-by: Sergei Trofimovich <[email protected]>
|
I hereby declare all (~240) the knows failures to be fixed. Should be ready for |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
@ofborg build nixosTests.gnome |
|
Thanks. This must've taken really lots of work. I'm convinced it's in good enough shape for |
|
Recent package additions that fail now: |
|
Thank you for your efforts trofi |
Motivation for this change
GCC 10 defaults to
-fno-common, a change that broke some packages. To ease the transition when migrating to GCC 10, we changed the default back in our build of GCC. This commit undoes that, bringing us closer to upstream and reducing our technical debt. (Clang, which made the same change, also cites "performance and code-size benefits"; it's unclear if this is the case for GCC.)In an effort to reduce the potential breakage from this PR, I've made no effort to patch or upgrade packages broken by this. Instead, for any package that fails to build, I fix it by setting
NIX_CFLAGS_COMPILE = "-fcommon", i.e. returning to the status quo. This brings the vast majority of packages onto the new default, and has no risk of introducing new bugs due to incorrect patches. As the rest of the world migrates towards GCC 10, most of these will probably get fixed by upstream, and we can remove the flag; for the rest, we can decide whether to write/find a patch or keep the flag indefinitely.This PR is not ready to merge at this point. Before doing so, I'd like to try building at least these things:
configuration.nixof the laptop I'm testing this onrelease.nixIt might also be a good idea to set up a hydra job.
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)