Skip to content

Comments

elfutils: split debuginfod into its own output#235618

Merged
lheckemann merged 1 commit intoNixOS:stagingfrom
DeterminateSystems:elfutils-split
Jun 9, 2023
Merged

elfutils: split debuginfod into its own output#235618
lheckemann merged 1 commit intoNixOS:stagingfrom
DeterminateSystems:elfutils-split

Conversation

@lheckemann
Copy link
Member

Description of changes

This avoids a dependency on gcc, reducing closure size significantly for dependents (including systemd, via libbpf).

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot requested review from edolstra and r-burns June 2, 2023 16:36
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jun 2, 2023
@lheckemann lheckemann merged commit 74321e5 into NixOS:staging Jun 9, 2023
@lheckemann lheckemann deleted the elfutils-split branch June 9, 2023 12:11
@trofi
Copy link
Contributor

trofi commented Jun 11, 2023

Bisect says d7ccc25 elfutils: split debuginfod into its own output broke aat least gdb and linuxPackages_latest.systemtap in staging.

checking for libdebuginfod >= 0.179... no
configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable
."
make[1]: *** [Makefile:11481: configure-gdb] Error 1
error: builder for '/nix/store/fmbv5f1z1zw051kra0p318wchldh5gwa-systemtap-4.8.drv' failed with exit code 2;
       last 10 log lines:
       > util.cxx:51:10: fatal error: elfutils/debuginfod.h: No such file or directory
       >    51 | #include <elfutils/debuginfod.h>
       >       |          ^~~~~~~~~~~~~~~~~~~~~~~
       > compilation terminated.

Is there practical difference in closure size? systemd is not an optional dependency on NixOS. And elfutils is an development-style dependency. It sounds reasonable to have a bit closure around it.

@trofi
Copy link
Contributor

trofi commented Jun 11, 2023

#223240 has a bit of discussion why it should be fine to uncoinditionally enable debuginfod.

@trofi trofi mentioned this pull request Jun 11, 2023
12 tasks
@lheckemann
Copy link
Member Author

lheckemann commented Jun 12, 2023

It makes a relatively big practical difference because it's the only thing making systemd depend on gcc. But yes, let's try to unbreak those 😅

@trofi
Copy link
Contributor

trofi commented Jun 12, 2023

It makes a relatively big practical difference because it's the only thing making systemd depend on gcc.

debuginfod should not depend on full gcc clousure. If it does I think it's a bug and it should be fixed instead of elfutils.

Can you be a bit more specific here? Which gcc output you are concerned about? Some gcc outputs are used everywhere, like libgcc or libstdc++.

$ nix build github:NixOS/nixpkgs/staging-next#systemd
$ nix path-info -rsSh github:NixOS/nixpkgs/staging-next#systemd |& fgrep gcc
/nix/store/1hgk46w2n5fkw9n5b2z1wlx7swfahwg9-xgcc-12.3.0-libgcc                   139.1K  139.1K
/nix/store/d4wb4vw0i85xyy7qs82l4s4mr2yigvc9-gcc-12.3.0-libgcc                    139.1K  139.1K
/nix/store/75622q2wranjp6zl81ldq5j54s788dqz-gcc-12.3.0-lib                         7.5M   38.8M

These are not rare dependencies.

@vcunat vcunat mentioned this pull request Jun 12, 2023
3 tasks
@vcunat
Copy link
Member

vcunat commented Jun 12, 2023

let's try to unbreak those

By that you mean to revert this PR for now or something else?

@fabianhjr
Copy link
Member

Trying this patch on gdb:

diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index 129b55e7409..528f6cd3719 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ ncurses readline gmp mpfr expat libipt zlib zstd guile sourceHighlight ]
     ++ lib.optional pythonSupport python3
     ++ lib.optional doCheck dejagnu
-    ++ lib.optional enableDebuginfod (elfutils.override { enableDebuginfod = true; });
+    ++ lib.optional enableDebuginfod (elfutils.override { enableDebuginfod = true; }).debuginfod;
 
   propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
 

@evrim
Copy link
Contributor

evrim commented Jun 13, 2023

  • ++ lib.optional enableDebuginfod (elfutils.override { enableDebuginfod = true; });
  • ++ lib.optional enableDebuginfod (elfutils.override { enableDebuginfod = true; }).debuginfod;

Fwiw, this doesnt solve the problem, still getting

checking for libdebuginfod >= 0.179... no                                                                                                                                                                                                      
configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable."            

Tried with autoreconfHook269.

$ echo $buildInputs                                                                                                                                                                                           
/nix/store/4hd4jjhnmkxc745d3ca48xkjp0svb033-ncurses-6.4-dev /nix/store/4p2mz1ir0dzcnyzkzlsb7jd3jfmkba1y-readline-8.2p1-dev /nix/store/amf1l89q7b10vxdi4svamxi55yp3mvna-gmp-with-cxx-6.2.1-dev /nix/store/w4b6zkk4inxck8w904aigsh6sm1gyfi3-mpfr\
-4.2.0-dev /nix/store/v2ih2chpb47kmmdj8jga2asp3iaqgkgn-expat-2.5.0-dev /nix/store/yqd7xbwkwnj6g3bxw8vfsx42l50iqriv-libipt-2.0.5 /nix/store/w99lhkib7z3hx9lcmlz17apzcm1qpsr7-zlib-1.2.13-dev /nix/store/dzfh5wzcgs2jyk2y6l9ay6m5ds936n2b-zstd-1\
.5.5-dev /nix/store/civgvncfva22yszmq47ikx2dmy95mnf2-source-highlight-3.1.9-dev /nix/store/5a457g4zr7q11b4mz0ifc9z88kwcp8g7-python3-3.10.12 /nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod                              

Maybe its because it is burried in there:

$ find /nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/                                                                                                                       
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/                                                                                                                                                               
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189                                                                                                                
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189/lib                                                                                                            
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189/lib/libdebuginfod.so.1                                                                                         
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189/lib/libdebuginfod.so                                                                                           
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189/lib/libdebuginfod-0.189.so                                                                                     
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/1ykjykd6m45ff8h0ay1rxq3gynjc1rg8-elfutils-0.189-bin                                                                                                            
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/1ykjykd6m45ff8h0ay1rxq3gynjc1rg8-elfutils-0.189-bin/bin                                                                                                        
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/1ykjykd6m45ff8h0ay1rxq3gynjc1rg8-elfutils-0.189-bin/bin/debuginfod                                                                                             
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/1ykjykd6m45ff8h0ay1rxq3gynjc1rg8-elfutils-0.189-bin/bin/debuginfod-find                                                                                        
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/b214w1i9xi7y16arsr1fyhypwmwk0hp7-elfutils-0.189-dev                                                                                                            
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/b214w1i9xi7y16arsr1fyhypwmwk0hp7-elfutils-0.189-dev/include                                                                                                    
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/b214w1i9xi7y16arsr1fyhypwmwk0hp7-elfutils-0.189-dev/include/elfutils                                                                                           
/nix/store/mk39f9yi6cpwcdlrx05ycaia0zaxk9qr-elfutils-0.189-debuginfod/nix/store/b214w1i9xi7y16arsr1fyhypwmwk0hp7-elfutils-0.189-dev/include/elfutils/debuginfod.h       

I believe this is due to lacking of pkg-config .pc file.

@evrim
Copy link
Contributor

evrim commented Jun 13, 2023

OK, so the problem I've spotted is basically override({ enableDebugInfod = true; }) generates the following .pc:

$ cat /nix/store/b214w1i9xi7y16arsr1fyhypwmwk0hp7-elfutils-0.189-dev/lib/pkgconfig/libdebuginfod.pc                                                                                                                           
prefix=/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189                                                                                                                                                                              
exec_prefix=${prefix}                                                                                                                                                                                                                          
libdir=/nix/store/a839cj2hnqld17jcmbma4vsgr2pphaiw-elfutils-0.189/lib                                                                                                                                                                          
includedir=/nix/store/b214w1i9xi7y16arsr1fyhypwmwk0hp7-elfutils-0.189-dev/include                                                                                                                                                              
                                                                                                                                                                                                                                               
Name: debuginfod                                                                                                                                                                                                                               
Description: elfutils library to query debuginfo files from debuginfod servers                                                                                                                                                                 
Version: 0.189                                                                                                                                                                                                                                 
URL: http://elfutils.org/                                                                                                                                                                                                                      
                                                                                                                                                                                                                                               
Libs: -L${libdir} -ldebuginfod                                                                                                                                                                                                                 
Cflags: -I${includedir}                                                                                                                                                                                                                        

The paths the file points to don't have the debuginfo libs or includes so gdb configure script fails.

@trofi
Copy link
Contributor

trofi commented Jun 13, 2023

Proposed the revert against staging-next as #237595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants