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: Move target libraries to lib output when building a cross compiler #81781

Closed

Conversation

eamsden
Copy link
Contributor

@eamsden eamsden commented Mar 5, 2020

Motivation for this change

Programs and libraries cross-compiled with nixpkgs gcc often had the entire gcc store path in their closure, since gcc's target libraries wound up in the main store output. See #58501

Things done

Adjust pkgs/development/compilers/gcc/builder.sh to put target system libraries in the lib output.

  • 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.

@eamsden
Copy link
Contributor Author

eamsden commented Mar 5, 2020

@illegalprime this pulls in stuff from your PR #58606. Do you mind if I take over since the last commit to that PR was April of last year?? I'll make sure you're still credited with authorship in the git commits.

@lopsided98 you had an alternate way of fixing this, right? Does it work for armv7l and across gcc versions too? If so maybe we should compare these approaches and pick one to advocate for merging.

@eamsden
Copy link
Contributor Author

eamsden commented Mar 5, 2020

@flokli cc

@lopsided98
Copy link
Contributor

I'm currently testing my version on armv7l. I don't know of any reason it wouldn't work on other gcc versions, but I haven't tested yet.

@eamsden
Copy link
Contributor Author

eamsden commented Mar 5, 2020

@lopsided98 can you publish it as a branch? I'd love to try it out too.

@lopsided98
Copy link
Contributor

@lopsided98
Copy link
Contributor

I successfully built pkgsCross.armv7l-hf-multiplatform.hello with my patch

@flokli
Copy link
Contributor

flokli commented Mar 5, 2020

@lopsided98 how does your branch differ from the changes proposed here? Can you elaborate?

@lopsided98
Copy link
Contributor

The functional difference is that the libraries are placed in $lib/$targetConfig/lib (which is the directory convention using by the GCC build scripts) rather than $lib/lib. This requires a minor change to cc-wrapper. Subjectively, I believe it is cleaner because it unifies the handling of the cross and non-cross cases and is therefore easier to reason about.

@matthewbauer
Copy link
Member

Closing in favor of #81844

@eamsden
Copy link
Contributor Author

eamsden commented Mar 6, 2020

Great. Glad this is fixed :)

@eamsden eamsden deleted the eamsden/gcc-cross-contamination branch March 6, 2020 18:35
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.

None yet

5 participants