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

cc-wrapper: Cleanup of Nix #28556

Merged
merged 4 commits into from
Aug 26, 2017

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Aug 25, 2017

Motivation for this change

I cleaned up the installation script a bit. This is a prereq for me splitting out the ld wrappers into a binutils-wrapper.

One of the changes was using set -u but that will be simpler and cleaner if #28057 is accepted. This also depends on #28556

This is most easily reviewed commit-by-commit.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built stdenv on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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.

Copy link
Member Author

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Here's 3 more interesting changes. Two of which were needed for set -u compliance for reasons I don't fully understand.

@fpletz the first comment, marked outdated, concerns arguing. Pinging you here as a ping from a hidden message probably looks like a GitHub bug :).

@@ -320,7 +322,7 @@ stdenv.mkDerivation {
rm $out/nix-support/setup-hook.tmp

# some linkers on some platforms don't support specific -z flags
hardening_unsupported_flags=""
export hardening_unsupported_flags=""
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this export, substitute failed. but more more broadly I'm surprised it previously worked at all: substituteAll only crawls through the output of env, not set, yet it's important this variable be substituted. Maybe it was only on some branches exported?

CC @fpletz

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked in both builds and @hardening_unsupported_flags@ was substituted.


if [[ -z ''${dynamicLinker+x} ]]; then
echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2
local dynamicLinker="${libc_lib}/lib/ld*.so.?"
Copy link
Member Author

Choose a reason for hiding this comment

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

Added local to avoid it lasting to the next phase.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ensured in both builds this made it the right file.

echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi

local ldflagsBefore=(-dynamic-linker "$dynamicLinker")
Copy link
Member Author

Choose a reason for hiding this comment

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

Added local to avoid it lasting to the next phase, and because it weirdly caused substituteAll problems if I didn't.

Copy link
Member Author

@Ericson2314 Ericson2314 Aug 25, 2017

Choose a reason for hiding this comment

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

Ensured in finished Linux build that these were still written to the right file.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Aug 25, 2017

Fixed Linux's allowedRequisites so both stdenv builds passed.

@@ -320,15 +234,129 @@ stdenv.mkDerivation {

+ optionalString cc.langVhdl or false ''
ln -s $ccPath/${prefix}ghdl $out/bin/${prefix}ghdl
'';

propagatedBuildInputs = extraPackages;
Copy link
Member Author

Choose a reason for hiding this comment

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

This was tantamount propagatedNativeBuildInputs before, but it doesn't (currently) make a difference with native, and this is more correct with cross.

@Ericson2314
Copy link
Member Author

Ericson2314 commented Aug 25, 2017

I'm interested in merging this within the next 24 hours---I've gone any manual checked everything I was concerned about, as documented in the comments above.

@Ericson2314 Ericson2314 merged commit 42e6390 into NixOS:staging Aug 26, 2017
@Ericson2314 Ericson2314 deleted the cc-wrapper-nix-cleanup branch August 26, 2017 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant