So there’s:
$ nix-store -q --references $(nix-build '<nixpkgs>' -A mpvScripts.mpris)
Which lists gcc.
The project has this Makefile (no autotools / autoconf / cmake involved):
https://github.com/hoyon/mpv-mpris/blob/a95d2a5007b614b70f32981ea5b1dab90371a840/Makefile#L1
Does anybody see right away from the Makefile why is it referencing gcc? Help will be appreciated.
You can use nix why-depends
to find which file pulls it in.
Thanks, I didn’t know about this command. But, in this case, there’s only 1 file and that’s $out
which is the same as $name
:
https://github.com/NixOS/nixpkgs/blob/fa0849d02308ea4d0b646f6fffff07cd042ab810/pkgs/applications/video/mpv/scripts/mpris.nix#L18-L20
So naturally I’d expect this to be the only one that references it.
$ nix why-depends nixpkgs.mpvScripts.mpris nixpkgs.gcc-unwrapped
/nix/store/vpjygfwbm23sld6b8dkas1cczbii53m1-mpv-mpris-0.4.so
╚═══/: …...................../nix/store/1m52x4908vr922dhnxz1i5rfnrsq244vzc-gcc-9.3.0/lib/gcc/x86_64-unknow…
=> /nix/store/52x4908vr922dhnxz1i5rfnrsq244vzc-gcc-9.3.0
After reading NixOS - Nix Pills, I’m thinking that perhaps this:
glibPreFixupPhase
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/vpjygfwbm23sld6b8dkas1cczbii53m1-mpv-mpris-0.4.so
shrinking /nix/store/vpjygfwbm23sld6b8dkas1cczbii53m1-mpv-mpris-0.4.so
strip is /nix/store/3b3ighb83nhifa1v4n7855hlbdl1mhf9-binutils-2.31.1/bin/strip
patching script interpreter paths in /nix/store/vpjygfwbm23sld6b8dkas1cczbii53m1-mpv-mpris-0.4.so
checking for references to /build/ in /nix/store/vpjygfwbm23sld6b8dkas1cczbii53m1-mpv-mpris-0.4.so...
/nix/store/vpjygfwbm23sld6b8dkas1cczbii53m1-mpv-mpris-0.4.so
Doesn’t remove the reference to gcc because $out
is a file and not a directory?
EDIT: Answer: No that’s not it - even with a different installPhase
that installs mpris.so to a directory it references gcc.
Found it: We don’t run strip
on the output file.
@jtojnar do you happen to know whether the standard fixup phases in Nixpkgs should run strip
? Now that I see that, I remember I noticed strip
is not used also for executables built with buildGoModule
- I mean, file result/bin/*
says not stripped
…
Stripping happens as fixupOutput
hook:
https://github.com/NixOS/nixpkgs/blob/25f9a1b1ae37825e11f2057442efd61829207b84/pkgs/build-support/setup-hooks/strip.sh#L3
and it is only done for files in directories that can be expected to contain elf files:
https://github.com/NixOS/nixpkgs/blob/25f9a1b1ae37825e11f2057442efd61829207b84/pkgs/build-support/setup-hooks/strip.sh#L26
But strip just removes debugging symbols, I am not sure if that would contain GCC reference.
No idea about buildGoModule
, perhaps they set dontStrip
.
Awesome :). Thanks for the references.
I just tried to use stripDebugList
and/or stripAllList
like this:
stripAllList = [ "$out" ];
But I think this doesn’t work if $out
is a file and not a directory, per:
https://github.com/NixOS/nixpkgs/blob/25f9a1b1ae37825e11f2057442efd61829207b84/pkgs/build-support/setup-hooks/strip.sh#L46
Hence, I’ll guess I’ll have to rewrite a bit that mpv plugins system to overcome that…