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

Fix build of 3 perl packages with ld-is-cc-hook #32830

Merged
merged 3 commits into from Dec 19, 2017
Merged

Conversation

orivej
Copy link
Contributor

@orivej orivej commented Dec 19, 2017

Motivation for this change

This is small rebuild targeting staging to fix small breakage introduced in #29396.

  1. makeSetupHook: make the default name "hook" overridable for occasional convenience while looking at drv paths, such as in the output of nix-build and nix-diff.
  2. ld-is-cc-hook: init
    This hook sets LD to CC, for use with software that works as if LD=$CC when LD is unset, and does not work when LD=ld.
  3. perlPackages: use ld-is-cc-hook to fix build after Bintools Wrapper: Init by refactoring out of cc-wrapper, take 2 #29396 removed -L path/to/dir/of/libstdc++.so from ld flags. See Bintools Wrapper: Init by refactoring out of cc-wrapper, take 2 #29396 (comment)
    Module::Build build helper works correctly when LD is unset (taking LD from Perl config to be cc). However, we can not unset LD because this goes contrary to the cross compilation effort, and we can not make it propagate ld-is-cc-hook because it breaks e.g. the build of libguestfs. However, Bintools Wrapper: Init by refactoring out of cc-wrapper, take 2 #29396 makes LD=ld incompatible with just 3 perl packages; they are individually fixed by this commit.
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.

for occasional convenience while looking at drv paths,
such as in the output of nix-build and nix-diff.
This hook sets LD to CC, for use with software that works as if LD=$CC when LD
is unset, and does not work when LD=ld.
after NixOS#29396 removed `-L path/to/dir/of/libstdc++.so` from ld flags

See NixOS#29396 (comment)

Module::Build build helper works correctly when LD is unset (taking LD from Perl
config to be `cc`).  However, we can not unset LD because this goes contrary to
the cross compilation effort, and we can not make it propagate ld-is-cc-hook
because it breaks e.g. the build of `libguestfs`. However, NixOS#29396 makes LD=ld
incompatible with just 3 perl packages; they are individually fixed by this
commit.
@orivej
Copy link
Contributor Author

orivej commented Dec 19, 2017

A setup hook would have been necessary only as a propagated build input, but this PR uses it in non propagated ways. Nevertheless, it is easier to add, more noticeable as a kludge, and easier to remove: #27415 (comment)

@vcunat
Copy link
Member

vcunat commented Dec 19, 2017

I just wonder if there are (many) cases where LD=$CC could be harmful and if it might be a good default.

@vcunat vcunat merged commit 69345ec into NixOS:staging Dec 19, 2017
@Ericson2314
Copy link
Member

There are harmful cases, because -Wl, is needed for ld flags. In this scenario, my ultimate goal would be to always build libstdc++ in its own derivation and have be a regular dependency rather than something specially treated by the wrapper scripts. Then ld would work fine.

@Ericson2314
Copy link
Member

But yes this is a great approach for now, thanks @orivej!

@orivej orivej deleted the ld-is-cc branch December 19, 2017 22:18
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

4 participants