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

Feature/gcc ng #40637

Closed
wants to merge 6 commits into from
Closed

Feature/gcc ng #40637

wants to merge 6 commits into from

Conversation

angerman
Copy link
Contributor

Motivation for this change
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
    • 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.

@angerman
Copy link
Contributor Author

@Ericson2314 as I mentioned earlier...

This is a rather rough cut, and it doesn't allow me to build packages with it yet, due to some missing headers (e.g. mingw-w64) isn't properly injected into the CFLAGS, and as such building packages like zlib will fail with <stdio.h> not found.

The general idea:

  1. configure gcc and build gcc (all-gcc) out of tree.
  2. collect the build results and the source, and call this -prebuilt.
  3. Use -prebuilt to actually install gcc (install-gcc) -- This is a gcc, with no libgcc, and no libc.
  4. Build the libc (in my case that's msvcrt) -- now we have a gcc, with no libgcc, but a libc.
  5. Build any additionally needed libraries (e.g. winpthreads)
  6. Use -prebuilt to build libgcc (all-target-libgcc and install-target-libgcc). We could also build any other gcc component here, based off of the prebuilt tree.

Finally use 1+4+5+6 to actually have a proper cross gcc.

Any suggestions are welcome!


PS: Yes, I tried to make this work in the existing gcc expression. I tried to follow the GNU/Hurd appraoch with the libpthreadCross, but could not make it work without constantly running into include/library issues.

@angerman angerman mentioned this pull request Jul 25, 2018
10 tasks
@veprbl veprbl added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 28, 2018
Copy link
Member

@Ekleog Ekleog left a comment

Choose a reason for hiding this comment

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

Just a few comments, I don't know enough about both mingw and cross-compilation to say whether this is wanted or a good implementation :)

cc @Ericson2314 for a more general “is this a good idea?” review

binutils
] ++ extraBuildInputs;

# bould out of tree. We don't use `pwd` in the `configureScript` so
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# bould out of tree. We don't use `pwd` in the `configureScript` so
# build out of tree. We don't use `pwd` in the `configureScript` so

@@ -1,7 +1,7 @@
{ fetchurl, stdenv, mingw_header, hostPlatform, buildPlatform }:
Copy link
Member

Choose a reason for hiding this comment

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

With the change below,

Suggested change
{ fetchurl, stdenv, mingw_header, hostPlatform, buildPlatform }:
{ fetchurl, stdenv, mingw_header }:

@@ -6092,7 +6092,7 @@ with pkgs;
gerbil-unstable = callPackage ../development/compilers/gerbil/unstable.nix { };

gccFun = callPackage ../development/compilers/gcc/7;
gcc = gcc7;
gcc = gcc7-ng-msvcrt;
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this setting all gcc to be msvcrt-based, thus breaking the package for non-windows?

@@ -11433,7 +11482,7 @@ with pkgs;

rlog = callPackage ../development/libraries/rlog { };

rocksdb = callPackage ../development/libraries/rocksdb { jemalloc = jemalloc450; };
rocksdb = callPackage ../development/libraries/rocksdb { stdenv = overrideCC stdenv gcc7-ng-msvcrt; jemalloc = jemalloc450; };
Copy link
Member

Choose a reason for hiding this comment

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

Same here, won't setting the compiler to msvcrt break the package on non-windows?

};

buildInputs = [
gmp mpfr libmpc #libelf
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
gmp mpfr libmpc #libelf
gmp mpfr libmpc

Or add a comment as to why it is left here

@mmahut
Copy link
Member

mmahut commented Aug 11, 2019

Are there any updates on this pull request, please?

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@ryantm ryantm added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Oct 3, 2020
@Mindavi
Copy link
Contributor

Mindavi commented Oct 13, 2021

Pretty sure this is made obsolete by #132343. Please reopen if not.

@Mindavi Mindavi closed this Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants