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

gcc10: use gcc 9 patch of mcfgthread.patch to fix MinGW build #107918

Closed
wants to merge 1 commit into from

Conversation

kira-bruneau
Copy link
Contributor

Motivation for this change

Fixes #107886.

@Ericson2314 The patch files are no longer available from https://github.com/lhmouse/MINGW-packages. The GCC 9 patch applies fine for GCC 10, but should we keep trying to maintain this in the future?

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.

@Ericson2314 @Synthetica9

@kira-bruneau
Copy link
Contributor Author

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

@@ -62,7 +62,7 @@ let majorVersion = "10";
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-9-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
Copy link
Member

Choose a reason for hiding this comment

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

Since there's a sha256 below, we should not import mfcgthreads-patches-repo.nix at all IMO - the outputHash always takes precedence over url in Nix.

@matthewbauer
Copy link
Member

Here's the "official" url for the patch from @lhmouse:

https://raw.githubusercontent.com/lhmouse/MINGW-packages-dev/062ab54a396b838c68756ac240901003be1177d1/mingw-w64-gcc-git/9000-gcc-10-branch-Added-mcf-thread-model-support-from-mcfgthread.patch

It is in fact the same thing as 9000-gcc-9-branch-Added-mcf-thread-model-support-from-mcfgthread.patch though :-).

@matthewbauer
Copy link
Member

matthewbauer commented Dec 29, 2020

Here's a commit removing mfcgthreads-patches-repo.nix that I can push if @Ericson2314 is okay with it:

matthewbauer@789ccc1

@kira-bruneau
Copy link
Contributor Author

Thanks, @matthewbauer! Yeah, that's probably a better way of handling it.

@Ericson2314
Copy link
Member

Ericson2314 commented Dec 30, 2020

While I'm decently ambivalent, if we remove that file they will certainly drift out of sync. Also, I think we can go back to using -${majorVersion} now that we found it?

Certainly switching repos and getting new patches is good, though.

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Dec 30, 2020

I'll close this then in favour of @matthewbauer's fix. @Ericson2314 Wouldn't it also be easy to forget to update the hash when updating mfcgthreads-patches-repo.nix?

@lhmouse
Copy link

lhmouse commented Dec 30, 2020

I am afraid the links with commit SHA-1 values will expire sooner or later, as the master branch is constantly rebased on upstream and force-pushed. You may fork the repo and maintain a permanent link yourself, or maintain a local copy of it. The patch itself is less likely to result in conflicts nowadays (it used to cause some back in GCC 7 or 8 days).

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Dec 30, 2020

@lhmouse Thank you! GitHub should always keep around the old commits, even if they were never merged. (for example youtube-dl on the dcma repo), but yeah we probably shouldn't rely on it, and I think it would be better to maintain a local copy.

@matthewbauer
Copy link
Member

While I'm decently ambivalent, if we remove that file they will certainly drift out of sync. Also, I think we can go back to using -${majorVersion} now that we found it?

They drift out of sync anyway since the sha256 is cached in cache.nixos.org. You have to update both URL & sha256 to change the contents. Since Nix looks up the cache first, it's bad practice to concat paths in this way, since it's providing more confusion than abstraction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GCC 10 doesn't build for any MinGW configuration
4 participants