Hi! On Thu, 2023-02-09 at 14:14 +0000, Peter Maydell wrote: > The "Using getpwuid in statically linked applications" etc warnings > are expected, so we can ignore those; this is the key error:
OK. > > /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdw.a(debuginfod-client.o): in > > function `__libdwfl_debuginfod_init': > > (.text.startup+0x17): undefined reference to `dlopen' > > /usr/bin/ld: (.text.startup+0x32): undefined reference to `dlsym' > > /usr/bin/ld: (.text.startup+0x4b): undefined reference to `dlsym' > > /usr/bin/ld: (.text.startup+0x64): undefined reference to `dlsym' > > /usr/bin/ld: (.text.startup+0x7d): undefined reference to `dlsym' > > /usr/bin/ld: (.text.startup+0xdc): undefined reference to `dlclose' > > collect2: error: ld returned 1 exit status > > We use pkg-config to find out what the libdw library needs on > the compiler/linker command line to link successfully, so > maybe your distro's pkg-config info isn't right. What does > "pkg-config --static --libs libdw" say ? glaubitz@nofan:~> pkg-config --static --libs libdw -ldw -lbz2 -llzma -pthread -lpthread -lelf -lz glaubitz@nofan:~> I'm building on Debian stable (Bullseye). > If libdw needs libdl > then it ought to list it in that output, I think. IME pkg-config > information is often incorrect for static linking, though. > I guess this one happened to work previously because glibc didn't > actually mandate linking with '-ldl', and now on your system it > apparently does. On my system pkg-config says > -ldw -lbz2 -llzma -pthread -lpthread -lelf -lz > which looks like it's missing -ldl, but the link succeeds anyway, > presumably because the symbols are provided by the main glibc .a. > > On the other hand, if libdw wants to use dlopen/dlsym then > I wonder if we should just suppress it for static linking: > on my (Ubuntu 22.04) ld warns: > /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdw.a(debuginfod-client.o): > in function `__libdwfl_debuginfod_init': > (.text.startup+0x1b): warning: Using 'dlopen' in statically linked > applications requires at runtime the shared libraries from the glibc > version used for linking > > so whatever libdw is trying to do will likely not work in most > statically-linked situations anyway. So, just include "-ldl" in LD_FLAGS? > I've cc'd the author of the commit that added the libdw > dependency. Thank you! Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913