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

binutils: use shared libs #46056

Merged
merged 2 commits into from Nov 28, 2018
Merged

binutils: use shared libs #46056

merged 2 commits into from Nov 28, 2018

Conversation

vcunat
Copy link
Member

@vcunat vcunat commented Sep 4, 2018

Motivation for this change

Fixing #44936

I had tested this on a different version of staging, including building various packages with the stdenv, the bootstrap-testing job, etc.

206 -> 32 MiB, i.e. not like the previous 26, but much better now.
@vcunat
Copy link
Member Author

vcunat commented Sep 4, 2018

We might additionally consider having the libraries in a separate output, but we should look at the overall design – the separately built libs, etc.

Copy link
Member

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

Note that GDB has the same bad --enable-static stuff, and probably should have a similar treatment

, fetchurl, zlib, autoreconfHook264
# Enabling all targets increases output size to a multiple.
, withAllTargets ? false, libbfd, libopcodes
, enableShared ? true
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we even need this, but I suppose it doesn't hurt.

, noSysDirs, gold ? true, bison ? null
}:

let
reuseLibs = enableShared && withAllTargets;
Copy link
Member

Choose a reason for hiding this comment

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

Woo! I am a fan of that.

Copy link
Member

Choose a reason for hiding this comment

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

I'd advocate making it unconditional if only there was a way to prevent it from being built at all, sigh.

Copy link
Member Author

Choose a reason for hiding this comment

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

Apart from complicating stdenv bootstrap, they're significantly larger due to supporting all targets.

Copy link
Member Author

Choose a reason for hiding this comment

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

So far the design is that you have "simple" versions of the libs inside the binutils derivation, and then those more "featureful" variants built separately for use by other packages.

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, good point.

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: binutils

Partial log (click to expand)

building '/nix/store/4hsd39w3phx0n3vv35kxkkdavbhv84a2-binutils-wrapper-2.30.drv'...
unpacking sources
patching sources
configuring
no configure script, doing nothing
installing
post-installation fixup
patching script interpreter paths in /nix/store/q1yv172qmsc9vlc8lcla4hpyamb2m00s-binutils-wrapper-2.30
Using dynamic linker: '/usr/lib/dyld'
/nix/store/q1yv172qmsc9vlc8lcla4hpyamb2m00s-binutils-wrapper-2.30

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: binutils

Partial log (click to expand)

patching sources
updateAutotoolsGnuConfigScriptsPhase
configuring
no configure script, doing nothing
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/384y8p4y58iljrhksv495m53vwg42dp3-binutils-wrapper-2.30
checking for references to /build in /nix/store/384y8p4y58iljrhksv495m53vwg42dp3-binutils-wrapper-2.30...
Using dynamic linker: '/nix/store/2cx8in8awx0ga4f5236qpn5fy7qv910y-glibc-2.27/lib/ld-linux-aarch64.so.1'
/nix/store/384y8p4y58iljrhksv495m53vwg42dp3-binutils-wrapper-2.30

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-linux (full log)

Attempted: binutils

Partial log (click to expand)

cannot build derivation '/nix/store/pi2hbppd6zcm7nzjlws8xczmnspm8mf3-attr-2.4.47.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/cnvi503k8ws51sgrn58qkf5rb32y534c-bash-4.4-p23.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/bv2jfn9h06zaw7n1pg2a6dc3jc32hbnl-binutils-2.30.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/jd2gzsk6b93iqkwcvjxr01bddwzqy6pj-pcre-8.42.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/f4aiw88jhpl5p70k1aiii6mfcwrqv293-xz-5.2.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/d5j93qdrwdw256palcyppb0vybvqypjb-acl-2.2.52.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/r0qn7brsv020jw6cjwdi4wzb923vhndj-gnugrep-3.1.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/8x69r797pmzr2pjkircx0kpc865glyf8-coreutils-8.29.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/8apyyj8p9j5m5mb6j9vqkaqppqlqcx3k-binutils-wrapper-2.30.drv': 4 dependencies couldn't be built
error: build of '/nix/store/8apyyj8p9j5m5mb6j9vqkaqppqlqcx3k-binutils-wrapper-2.30.drv' failed

@oxij
Copy link
Member

oxij commented Sep 5, 2018 via email

@vcunat
Copy link
Member Author

vcunat commented Sep 5, 2018

Why: when this condition holds, the libraries will be basically the same as the separately built ones, so it seems suitable to de-duplicate. I originally tried that by default, but there were down-sides so I only kept it conditional #46056 (comment)

@vcunat vcunat mentioned this pull request Sep 5, 2018
@oxij
Copy link
Member

oxij commented Sep 5, 2018

@vcunat I see, thanks.

LGTM.

@matthewbauer
Copy link
Member

Can someone confirm this actually fixes the binutils bloat issue? Looks good to merge if so...

@Ekleog
Copy link
Member

Ekleog commented Nov 28, 2018

./test-build binutils && nix path-info -S ./result:

  • On master, 266253800
  • On this branch, 70200080

It's down from ~266M to ~70M. So let's go for the merge, as everyone appears to agree :)

@Ekleog Ekleog merged commit beb063a into NixOS:staging Nov 28, 2018
@Ekleog Ekleog mentioned this pull request Nov 28, 2018
@vcunat vcunat deleted the p/binutils-shared branch November 28, 2018 10: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

6 participants