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

Decrease Nix closure size #31

Closed
neongreen opened this issue Sep 27, 2019 · 6 comments · Fixed by #71
Closed

Decrease Nix closure size #31

neongreen opened this issue Sep 27, 2019 · 6 comments · Fixed by #71
Labels
help wanted Extra attention is needed nix

Comments

@neongreen
Copy link
Contributor

Currently our closure takes about 700 MB:

$ storepath=$(nix-build)
$ nix-store --export $(nix-store -qR $storepath) > out-fencer
$ ls -lah out-fencer
-rw-r--r--  1 yom  staff   708M Sep 27 17:22 out-fencer

The biggest offenders are:

740 MB  └── nix
740 MB      └── store
393 MB          ├─⊕ i2nf6hslid0ak8fzgpj2m082sprihi92-clang-7.1.0
133 MB          ├─⊕ hfy6ibq1hwayv24yrh98f3avc47nmr00-llvm-7.1.0
 63 MB          ├─⊕ 0cifmxw0r6lijng796a3z3nwq67ma5b3-llvm-7.1.0-lib
 27 MB          ├─⊕ 5qk8vydayrvkq313s1srxhrnblhqvahk-grpc-1.2.0-e2cfe9d
 27 MB          ├─⊕ q959m66x0cfryybzapv7c4v0ki2jfr1a-clang-7.1.0-lib
 18 MB          ├─⊕ bhywddq18j79xr274n45byvqjb8fs52j-Libsystem-osx-10.12.6
 11 MB          ├─⊕ i7hz49am5vla34lmpkw5aqkjgd2b98hb-binutils-2.31.1
...

This primarily affects our Docker image size.

@neongreen neongreen added the help wanted Extra attention is needed label Sep 27, 2019
@neongreen
Copy link
Contributor Author

Oh, this was on macOS. The situation on Linux is slightly better:

310 MB  └── nix
310 MB      └── store
132 MB          └─⊕ wr5dlcw1asw8dwgm4bwjmga8f52m5lfx-gcc-7.4.0
126 MB          ├─⊕ awmkcm3rk4d74lgm828phvslgb7drcij-grpc-1.2.0-e2cfe9d
 28 MB          ├─⊕ iykxb0bmfjmi7s53kfg6pjbfpd8jmza6-glibc-2.27
5.7 MB          ├─⊕ pjx3f50x0qziyivs7rbg5s12p99nn2np-gcc-7.4.0-lib
...

Still, it's unclear why gcc becomes a part of the closure.

@neongreen neongreen added nix and removed help wanted Extra attention is needed labels Oct 1, 2019
@mdimjasevic
Copy link
Contributor

As a side note, it seems that something affects the choice of a C compiler. On your macOS LLVM was chosen, while on a Linux-based system it was GCC. Probably there is a constraint along the lines depends-on: GCC | LLVM.

@neongreen
Copy link
Contributor Author

Well, I didn't do a --pure build. In fact, I'm not even sure I can get a --pure build on macOS.

@neongreen
Copy link
Contributor Author

Might be because stripping is disabled for grpc.

$ nix why-depends \
  /nix/store/xnndslwbim4zs06y1dw8dkqi9z1clak2-fencer-1.0.0 \
  /nix/store/i2nf6hslid0ak8fzgpj2m082sprihi92-clang-7.1.0

/nix/store/xnndslwbim4zs06y1dw8dkqi9z1clak2-fencer-1.0.0
╚═══bin/fencer: ….p.................../nix/store/pgisjgza96csd22mpxymc6qnw1bx8vjx-grpc-1
    => /nix/store/pgisjgza96csd22mpxymc6qnw1bx8vjx-grpc-1.2.0-e2cfe9d
    ╚═══lib/libgrpc++.a: …...................../nix/store/qvagarl5ghs07v39zhszm5x9rn08k2
        => /nix/store/qvagarl5ghs07v39zhszm5x9rn08k231-clang-wrapper-7.1.0
        ╚═══bin/clang: …k disable=SC2193.[[ "/nix/store/i2nf6hslid0ak8fzgpj2m082sprihi92
            => /nix/store/i2nf6hslid0ak8fzgpj2m082sprihi92-clang-7.1.0

@neongreen
Copy link
Contributor Author

No, it's not disabled. And I tried strip-ping libgrpc++.a manually and didn't get anywhere.

@neongreen neongreen added the help wanted Extra attention is needed label Oct 4, 2019
@neongreen
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed nix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants