I've come to realise the ITK build has 15 libraries that lintian flags with error library-not-linked-against-libc.
https://lintian.debian.org/tags/library-not-linked-against-libc.html[1]
The error description seems straightforward. But how does one solve this? I have to
assume that the linker would by default link with the libc (?), so perhaps the linker
invocation has options that suppress this? What would that be?
I've come to realise the ITK build has 15 libraries that lintian flags with error library-not-linked-against-libc.
I've come to realise the ITK build has 15 libraries that lintian flags with
The error description seems straightforward. But how does one solve
this? I have to assume that the linker would by default link with the
libc (?), so perhaps the linker invocation has options that suppress
this? What would that be?
$ objdump -p file.so
...
NEEDED libc.so.6
...
The (CMake-generated) link line does have a bunch of options. Nothing jumped out at me:^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/bin/c++ -fPIC -g -O2 -ffile-prefix-map=/home/steve/Packages/insighttoolkit/build-area/
insighttoolkit5-5.4.0=. -fstack-protector-strong -fstack-clash-protection -Wformat -
Werror=format-security -fcf-protection -Wdate-time
-D_FORTIFY_SOURCE=2 -I/usr/include/nifti -g1 -mtune=generic -march=corei7 -Wall -
Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-^^^^^^
nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wctad-
maybe-unsupported -Wstrict-null-sentinel -fno-sized-deallocation -msse2 -Wl,--
dependency-file=CMakeFiles/ITKColormap.dir/link.d -Wl,-z,re
lro -shared -Wl,-soname,libITKColormap-5.4.so.1 -o ../../../../lib/x86_64-linux-gnu/
libITKColormap-5.4.so.1 CMakeFiles/ITKColormap.dir/ itkScalarToRGBColormapImageFilter.cxx.o
The error description seems straightforward. But how does one solve this? I have to assume that the linker would by default link with the libc (?), so perhaps the linker invocation has options that suppress this? What would that be?
You may not need to solve it if it's intentional.
For example, you have a "plugin" style library that only uses functions from the main library and nothing else.
I do this to confirm if lintian is correct:
$ objdump -p file.so
...
NEEDED libc.so.6
...
I've come to realise the ITK build has 15 libraries that lintian flags with error library-not-linked-against-libc.
Someone suggested to run ldd -r. Okay, so what does this tell me?
$ ldd -r /lib/x86_64-linux-gnu/libITKColormap-5.4.so
linux-vdso.so.1 (0x00007f1b218a1000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1b21400000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1b21766000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1b2120a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1b218a3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1b21739000)
Thanks,
-Steve
P.S. Please CC, not subscribed, thanks!
On Sun, Jan 26, 2025 at 11:07:12AM +0000, Ahmad Khalifa wrote:
I do this to confirm if lintian is correct:
$ objdump -p file.so
...
NEEDED libc.so.6
...
No?
Lintian already says there is no "NEEDED libc.so.6", the question is whether that is an error or not.
The lintian error is a great heads-up and it's up to the reader to
decide whether it's a true error to fix or a false-positive to override.
On Sun, Jan 26, 2025 at 6:28 AM Ahmad Khalifa <ahmad@khalifa.ws> wrote:
The lintian error is a great heads-up and it's up to the reader to
decide whether it's a true error to fix or a false-positive to override.
I have never seen this Lintian error actually be useful. I think an
error is far too strong for this; I think even a warning is too
strong; maybe info would be ok.
On Sun, Jan 26, 2025 at 6:28 AM Ahmad Khalifa <ahmad@khalifa.ws> wrote:
The lintian error is a great heads-up and it's up to the reader to
decide whether it's a true error to fix or a false-positive to
override.
I have never seen this Lintian error actually be useful. I think an
error is far too strong for this; I think even a warning is too strong;
maybe info would be ok.
maybe it's more common these days to have plugin libraries
that aren't linked with libc? Back in the day, it was very rare for people
to successfully manage to write code that never called a libc symbol.
On Sun, 26 Jan 2025 at 09:14:30 -0800, Russ Allbery wrote:
maybe it's more common these days to have plugin libraries that aren't
linked with libc? Back in the day, it was very rare for people to
successfully manage to write code that never called a libc symbol.
In ecosystems with a "platform" runtime library like GLib, Qt or even
SDL, and especially when intending to be portable to Windows and macOS
as well as Linux and other Unixy platforms, it's very common to write
code that only ever calls into that runtime library, and never directly
calls libc functions. I think the reason Jeremy is so negative about
this lintian check is that false positives are particularly common in
GNOME, where basically everything is linked to GLib and uses its
functions in preference to going directly to libc.
In theory it would be possible to do better in Lintian by scanning the
symbol table to see if the libc dependency is really unneeded. But doing
that sounds at least a little annoying.
* Russ Allbery <rra@debian.org> [250126 12:47]:
In theory it would be possible to do better in Lintian by scanning the
symbol table to see if the libc dependency is really unneeded. But
doing that sounds at least a little annoying.
Annoying to users of lintian or annoying to implement? How so?
I thought of this solution while reading earlier in this thread, and it
seems like the "correct" solution to me. What is wrong with it?
Clearly the current state is a bug in lintian, as so many packages
override this error. And from your description, the test has a
significant purpose that is still needed in the situations it was
intended to catch, even if they are few.
Marvin Renich <mrvn@renich.org> writes:
* Russ Allbery <rra@debian.org> [250126 12:47]:
In theory it would be possible to do better in Lintian by scanning the
symbol table to see if the libc dependency is really unneeded. But
doing that sounds at least a little annoying.
Annoying to users of lintian or annoying to implement? How so?
Annoying to implement because I think the implementation would have to
know what symbols are provided by libc.
On 27/01/2025 18:24, Russ Allbery wrote:
Annoying to implement because I think the implementation would have to
know what symbols are provided by libc.
To my knowledge objdump will spit out the symbols with (GLIBC_v*)
Having said that, lintian is slow enough as a single thread, I'd vote for downgrading the tag to Pedantic, but not deleting it.
Ahmad Khalifa <ahmad@khalifa.ws> writes:
Having said that, lintian is slow enough as a single thread, I'd vote for
downgrading the tag to Pedantic, but not deleting it.
So, I guess I'll say this more explicitly: I am opposed to downgrading the tag to pedantic. If the tag is useful, we should fix it; if it's not
useful, we should delete it.
It's not a pedantic issue with the package. If the error is real, it's serious, but Lintian's check for the error has a high false positive rate. That's not what pedantic is for. Pedantic is intended for tags where
Lintian has correctly understood the thing that it is complaining about,
but people do not always agree that thing is worth fixing.
If you really want to keep the tag despite a lot of false positives, the
way to do that would be to make it experimental, but I think experimental tags are often a dumping ground for things that will never be fixed and it might be better to just delete it.
wget https://ftp.debian.org/debian/pool/main/a/abseil/libabsl20230802_20230802.1-4_{amd64,arm64,armel,armhf,i386,mips64el,mipsel,ppc64el,s390x,riscv64}.deb
wget https://ftp.debian.org/debian/pool/main/c/clanlib/libclanapp-1.0t64_1.0~svn3827-11.2+b1_{amd64,arm64,armel,armhf,i386,mips64el,mipsel,ppc64el,s390x,riscv64}.deb
wget https://ftp.debian.org/debian/pool/main/c/chicken/chicken-bin_5.3.0-2_{amd64,arm64,armel,armhf,i386,mips64el,mipsel,ppc64el,s390x,riscv64}.deb
for f in *.deb; do dpkg --extract "$f" ROOT; done
for f in ROOT/usr/lib/*-linux-gnu/*.so.* ROOT/var/lib/chicken/11/*.so*; do
(objdump -T "$f" | grep " (GLIBC_[0-9]" > /dev/null) &&
( (objdump -p "$f" | grep -E 'NEEDED *libc.so|NEEDED *libm.so|NEEDED *ld-linux.*.so|NEEDED *ld64.so' > /dev/null) || echo "bad so: $f");
done
But reading that, I don't see how the linker could declare a dynamic
GLIBC_ symbol without the related library reference.
In fact, it should choke with "undefined reference" long before outputting
a .so file. Even when compiling with -nolibc. But there is always a
special case somewhere :)
"Russ" == Russ Allbery <rra@debian.org> writes:
On 28/01/2025 22:28, Sam Hartman wrote:
"Russ" == Russ Allbery <rra@debian.org> writes:
Russ> recollection (it's been a *lot* of years so I'm hoping I'm
Russ> getting this right) is that this interfered with proper
Russ> symbol versioning and could cause the symbols to be resolved
Russ> weirdly in a way that could cause serious bugs.
Yeah, and so the symbol versions would not be present, and so I think
we're back to needing to know what symbols are from libc6. A better
error if we knew how to generate it efficiently would be using a libc
symbol without a symbol version.
dlopen() itself is versioned to libc on the calling object, but there is
no record of what is passed to it aside from a floating string somewhere
in the ro section. Unless you parse the source or disassemble the .so,
you can't find out what is being called.
In other words, lintian can't find out if the library loads printf() for example. But you can test it to see if it works correctly :)
Instead, lintian should alert that some symbols are "unversioned".
Whether you can detect this or not, it would probably be a new tag
anyway. But being practical, the stability of libc nowadays is much
higher and it's better to just have lintian-is-always-right!!
In my short experience running lintian, it has been right 99% of the
time, so this feels like a bug.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 547 |
Nodes: | 16 (2 / 14) |
Uptime: | 60:12:01 |
Calls: | 10,398 |
Calls today: | 6 |
Files: | 14,067 |
Messages: | 6,417,474 |
Posted today: | 1 |