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

Mingw_w64 fix to get cross-compilation working again #33167

Merged
merged 6 commits into from Dec 29, 2017

Conversation

bnikolic
Copy link
Contributor

Motivation for this change

These gets cross compilation for win64 targets using mingw32-w64 working again. Includes PR #33110 .

Key change is to disable hardening when compiling windows.mingw_w64 . Also enable ssp and shared for the final cross compilation GCC so that final version can work with normal hardening flags.

Tested using:

nix-build /home/bnikolic/oss/nixpkgs -I /home/bnikolic/oss/ -A bzip2 --arg crossSystem '(import <nixpkgs/lib>).systems.examples.mingwW64' -j 10 --cores 50 --show-trace -K -k

Needs more testing but hopefully a good starting point

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • [X ] 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@bnikolic
Copy link
Contributor Author

cc @Ericson2314

@Ericson2314
Copy link
Member

Woo thanks! I'm going to do some investigating of the wrapper symlinks first, but get these fixes right after, all today.

@@ -155,13 +155,13 @@ let version = "6.4.0";
"--enable-threads=win32"
"--enable-sjlj-exceptions"
"--enable-hash-synchronization"
"--disable-libssp"
"--enable-libssp"
"--disable-nls"
"--with-dwarf2"
# I think noone uses shared gcc libs in mingw, so we better do the same.
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
Copy link
Contributor

Choose a reason for hiding this comment

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

So this old comment about mingw32 g++ linking being broken with shared libs must be wrong.

Copy link
Member

Choose a reason for hiding this comment

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

@DavidEGrayson or we didn't build any C++ lol.

bnikolic and others added 4 commits December 29, 2017 13:27
Hardening on by default now that we don't use the cross wrapper. In
turn, hardening requires libssp in particular.
Do this because it is built with the static stage
@Ericson2314
Copy link
Member

Ericson2314 commented Dec 29, 2017

@bnikolic I updated your PR to avoid the binutils changes. The merge commits are so I can directly compare before and after my PR which broke mingw to begin with, which I do in https://hydra.nixos.org/eval/1421871?compare=ericson2314-old-cross-known-good.

As you can see the binutils changes aren't needed (at least back then), and I also added this change to #26805 where I could at least build the compiler.

@Ericson2314 Ericson2314 changed the base branch from staging to master December 29, 2017 20:26
@Ericson2314
Copy link
Member

Ericson2314 commented Dec 29, 2017

I'm going to merge this once @GrahamcOfBorg signs off on it, and then start after the hardening change to fix the packages that regressed.

@Ericson2314 Ericson2314 self-assigned this Dec 29, 2017
@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Dec 29, 2017
@Ericson2314 Ericson2314 merged commit 52a4a7c into NixOS:master Dec 29, 2017
Ericson2314 added a commit that referenced this pull request Dec 29, 2017
@Ericson2314 Ericson2314 added this to Needed by the big PR---nice to move pick off pieces of it and move here, rebasing the big PR on top in Cross compilation Dec 29, 2017
@Ericson2314 Ericson2314 added the 6.topic: windows Running, or buiding, packages on Windows label Jan 2, 2018
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 sort platform than than they will be run on 6.topic: windows Running, or buiding, packages on Windows 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
No open projects
Cross compilation
Needed by the big PR---nice to move p...
Development

Successfully merging this pull request may close these issues.

None yet

4 participants