Recent

Author Topic: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found  (Read 67798 times)

robert rozee

  • Sr. Member
  • ****
  • Posts: 259
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #180 on: July 06, 2023, 11:09:23 pm »
It depends on you installing the dev package which does that labour (of figuring out which specific library to use) for you.

is this the dev package you mean?
Code: Text  [Select][+][-]
  1. user@DH61BE:~$ dpkg -s libc6-dev
  2. Package: libc6-dev
  3. Status: install ok installed
  4. Priority: optional
  5. Section: libdevel
  6. Installed-Size: 13037
  7. Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
  8. Architecture: amd64
  9. Multi-Arch: same
  10. Source: glibc
  11. Version: 2.35-0ubuntu3.1
  12. Provides: libc-dev

it comes pre-installed with the distros i am using - i didn't install it myself. but there is no libdl.so symlink in /lib/x86_64-linux-gnu:
Code: Text  [Select][+][-]
  1. user@DH61BE:~$
  2. user@DH61BE:~$ ls /lib/x86_64-linux-gnu/libdl*
  3. /lib/x86_64-linux-gnu/libdl.a  /lib/x86_64-linux-gnu/libdl.so.2
  4. user@DH61BE:~$

i get the same results from a fresh VM created from a Linux Mint 21.1 XFCE .iso. libc6-dev already installed, but no libdl.so symlink exists.

i shall sleep on this, it is now 9am here and i've been working away at this all night!


cheers,
rob   :-)

TRon

  • Hero Member
  • *****
  • Posts: 4165
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #181 on: July 06, 2023, 11:17:17 pm »
is this the dev package you mean?
I was speaking generally. Whenever you need to use a versioned library, say for example libgtk2, then you are required to install libgtk2-dev in order to actually be able to make use of it (sorry for the bad example but it was the first things that came to mind)..

The C library and it's brethren are a bit peculiar in that regards. Probably because things are so tight together, same as for libpthread (it was part of libc then it wasn't or the other way around, can't remember).

Quote
it comes pre-installed with the distros i am using - i didn't install it myself. but there is no libdl.so symlink in /lib/x86_64-linux-gnu:
Code: Text  [Select][+][-]
  1. user@DH61BE:~$
  2. user@DH61BE:~$ ls /lib/x86_64-linux-gnu/libdl*
  3. /lib/x86_64-linux-gnu/libdl.a  /lib/x86_64-linux-gnu/libdl.so.2
  4. user@DH61BE:~$
note the unversioned name libdl.a (analog for libdl.so in eyes of the linker/fpc) that symlinks to versioned name libdl.so.2

Quote
i shall sleep on this, it is now 9am here and i've been working away at this all night!
No problem. Thank you for the interesting discussion. Sleep well.

edit:
A very helpful read about versioning/symlinks/packaging/distributions: https://dmerej.info/blog/post/symlinks-and-so-files-on-linux/
« Last Edit: July 06, 2023, 11:51:17 pm by TRon »
Today is tomorrow's yesterday.

TRon

  • Hero Member
  • *****
  • Posts: 4165
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #182 on: July 07, 2023, 07:09:58 am »
is this the dev package you mean?
In this particular case , yes.

For more information, see (also) libc release notes:
Quote
In order to support smoother in-place-upgrades and to simplify
  the implementation of the runtime all functionality formerly
  implemented in the libraries libpthread, libdl, libutil, libanl has
  been integrated into libc.  New applications do not need to link with
  -lpthread, -ldl, -lutil, -lanl anymore.  For backwards compatibility,
  empty static archives libpthread.a, libdl.a, libutil.a, libanl.a are
  provided, so that the linker options keep working.  Applications which
  have been linked against glibc 2.33 or earlier continue to load the
  corresponding shared objects (which are now empty).  The integration
  of those libraries into libc means that additional symbols become
  available by default.  This can cause applications that contain weak
  references to take unexpected code paths that would only have been
  used in previous glibc versions when e.g. preloading libpthread.so.0,
  potentially exposing application bugs.
Today is tomorrow's yesterday.

robert rozee

  • Sr. Member
  • ****
  • Posts: 259
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #183 on: July 07, 2023, 03:53:16 pm »
A very helpful read about versioning/symlinks/packaging/distributions: https://dmerej.info/blog/post/symlinks-and-so-files-on-linux/

excellent article - am not sure i understand it all yet, will have to read through it a few more times. what is most immediately useful is the -d parameter to readelf:
Code: Bash  [Select][+][-]
  1. user@Mint19:~/Desktop$ readelf -d -W test07 | grep "NEEDED"
  2.  0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
  3.  0x0000000000000001 (NEEDED)             Shared library: [libgdk-x11-2.0.so.0]
  4.  0x0000000000000001 (NEEDED)             Shared library: [libgtk-x11-2.0.so.0]
  5.  0x0000000000000001 (NEEDED)             Shared library: [libX11.so.6]
  6.  0x0000000000000001 (NEEDED)             Shared library: [libgdk_pixbuf-2.0.so.0]
  7.  0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
  8.  0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
  9.  0x0000000000000001 (NEEDED)             Shared library: [libgthread-2.0.so.0]
  10.  0x0000000000000001 (NEEDED)             Shared library: [libgmodule-2.0.so.0]
  11.  0x0000000000000001 (NEEDED)             Shared library: [libpango-1.0.so.0]
  12.  0x0000000000000001 (NEEDED)             Shared library: [libcairo.so.2]
  13.  0x0000000000000001 (NEEDED)             Shared library: [libatk-1.0.so.0]
  14.  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
  15. user@Mint19:~/Desktop$

this shows the shared libraries needed by the binary, and i can see binaries that work with pre 2.34 versions of GLIBC have libdl.so.2 listed as "NEEDED", while those that do not work do not have libdl.so.2 listed. this means i can build a test binary and instantly see if it is backward/forward compatible, and was one of the pieces of the puzzle that had up until now eluded me. it makes the job of testing out different solution so much quicker!

For more information, see (also) libc release notes

i had read that a couple of weeks back, but didn't understand the significance of libdl.a:
"For backwards compatibility, empty static archive [...] libdl.a [... is] provided, so that the linker options keep working. Applications
which have been linked against glibc 2.33 or earlier continue to load the corresponding shared objects (which are now empty).
"

so libdl.a is not a symlink, but some sort of a 'signpost' for the linker that indicates "nothing more to see here, move along to the next library".

it seems that some linux distros include a libdl.so symlink to libdl.so.2, while others do not. there is no hard-and-fast rule. Fred vS suggests that simply creating the symlink is safe and that it should not break anything - what do you think?

i'm currently think around the idea of creating a program or shell script that:
- patches the RTL sources to add @GLIBC_2.2.5 to all the externals that reference know GLIBC 2.2.5 compatible functions,
- runs the necessary commands to rebuild the RTL,
- creates the libdl.so symlink in /lib/x86_64-linux-gnu if it is not already present. or creates an empty libdl.so library in /lib/x86_64-linux-gnu if libdl.so.2 does not exist.

by my reckoning this should give a Lazarus/FPC that permanently generates binaries that are GLIBC 2.2.5 compatible - with @GLIBC_2.2.5 versioned libc symbols - and thus able to run against all versions of GLIBC up until such time as the GLIBC developers drop 2.2.5 support.


cheers,
rob   :-)

WayneSherman

  • Sr. Member
  • ****
  • Posts: 254
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #184 on: July 08, 2023, 05:28:17 am »

is this the dev package you mean?
Code: Text  [Select][+][-]
  1. Package: libc6-dev
  2.  
  3. it comes pre-installed with the distros i am using - i didn't install it myself. but there is no [b][tt]libdl.so[/tt][/b] symlink in [b][tt]/lib/x86_64-linux-gnu[/tt][/b]:
  4. [code=plain]user@DH61BE:~$
  5. user@DH61BE:~$ ls /lib/x86_64-linux-gnu/libdl*
  6. /lib/x86_64-linux-gnu/libdl.a  /lib/x86_64-linux-gnu/libdl.so.2
  7. user@DH61BE:~$

i get the same results from a fresh VM created from a Linux Mint 21.1 XFCE .iso. libc6-dev already installed, but no libdl.so symlink exists.

How Debian names libraries
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html

Quote
The development package should contain a symlink for the associated shared library without a version number. For example, the libgdbm-dev package should include a symlink from /usr/lib/libgdbm.so to libgdbm.so.3.0.0. This symlink is needed by the linker (ld) when compiling packages, as it will only look for libgdbm.so when compiling dynamically.

Where are libdl.so and libdl.a located in Debian and Ubuntu?

Debian 7 Wheezy (2013)
https://packages.debian.org/search?suite=wheezy&arch=amd64&searchon=contents&keywords=libdl.so
https://packages.debian.org/search?suite=wheezy&arch=amd64&searchon=contents&keywords=libdl.a

Debian 11 Bullseye (2021):
https://packages.debian.org/search?suite=bullseye&arch=amd64&searchon=contents&keywords=libdl.so
https://packages.debian.org/search?suite=bullseye&arch=amd64&searchon=contents&keywords=libdl.a

Ubuntu 14.04 Trusty Tahr (2014)
https://packages.ubuntu.com/search?suite=trusty&arch=amd64&searchon=contents&keywords=libdl.so
https://packages.ubuntu.com/search?suite=trusty&arch=amd64&searchon=contents&keywords=libdl.a

Ubuntu 22.04 Jammy Jellyfish (2022) (libdl.so is not found in this version of Ubuntu)
https://packages.ubuntu.com/search?suite=jammy&arch=amd64&searchon=contents&keywords=libdl.so
https://packages.ubuntu.com/search?suite=jammy&arch=amd64&searchon=contents&keywords=libdl.a
« Last Edit: July 08, 2023, 05:34:56 am by WayneSherman »

TRon

  • Hero Member
  • *****
  • Posts: 4165
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #185 on: July 08, 2023, 06:14:57 pm »
If you wish to know more about those parameters (NEEDED etc) and about versioning then you could perhaps also have a look here for more technical details.

so libdl.a is not a symlink, but some sort of a 'signpost' for the linker that indicates "nothing more to see here, move along to the next library".
Correct, though it could also be a symlink pointing to an 'empty' library.

Quote
Fred vS suggests that simply creating the symlink is safe and that it should not break anything - what do you think?
In all honestly: that I know just enough to be dangerous. In principle I think it can't harm but on the other side how does it reflect on functions that really requires a fix especially when code relies on certain behaviour.

Quote
i'm currently think around the idea of creating a program or shell script that:
- patches the RTL sources to add @GLIBC_2.2.5 to all the externals that reference know GLIBC 2.2.5 compatible functions,
My knowledge on linking is next to none but I still have the notion/idea that it should be possible to realize with a linker script that replaces the symbols. That would allow for a solution that is independent of any changes in the RTL/compiler.

I have tried to come up with an more intelligent answer on that subject but so far was unable to find something that was relevant enough to mention (hence my delayed reply). Trying to understand the gnu linker is probably a lifetime commitment  :)


@WayneSherman: thank you for the pointers/links !
« Last Edit: July 09, 2023, 04:57:40 am by TRon »
Today is tomorrow's yesterday.

funlw65

  • Full Member
  • ***
  • Posts: 149
    • Visual Pin Configurator for Nucleo 64pin boards
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #186 on: July 09, 2023, 11:19:20 pm »
I have a (Debian based) linux distro < 2.34, so I looked at the elf binary of my app
that gcc produces and mostly, functions are versioned at 2.2.5 but there are some
at 2.17, 2.27, 2.29 etc., I guess that is the lowest version that that respective function
was first introduced in glibc...

Can't try with a >= 2.34 to see the effect, and is OK for me to stay with my actual version
of linux, but, I'm pretty sure that if they had the courage to introduce
such restriction, the following one that will prevent older software to run on newer
glibc versions is around the corner. Probably a credible reason is already prepared.
And probably more will follow shortly after that, at a faster pace.

So, I understand why FreePascal is forced to follow suit without fighting back..

It might be a chance if the world opposes (musl might be the one?), as is the case of
init against systemd, but if the opposition does not win the popularity contest, then it is
just a matter of time to when the white flag will be raised. In a way, Linux follows Apple...
FreePascal 3.2.2, C 10.2.1, D 1.24 under Linux(init,musl,glibc), DragonflyBSD, NetBSD
gui: gtk2, qt5, raylib4.x+raygui3.x, nanovg 
tui: freevision, tvision2, termbox2+widgets, finalcut
db: typhoon-1.11...

robert rozee

  • Sr. Member
  • ****
  • Posts: 259
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #187 on: July 10, 2023, 06:13:24 am »
If you wish to know more about those parameters (NEEDED etc) and about versioning then you could perhaps also have a look here for more technical details.

a good read - but oh so complicated! it looks like --allow-shlib-undefined  passed to the linker may achieve the same result as a fake libdl.so file, has anyone tried this? i agree, it would be nice to find a solution that does not involve tinkering with the RTL source or creating fake libraries.


Quote
Fred vS suggests that simply creating the symlink is safe and that it should not break anything - what do you think?
[...] I think it can't harm but on the other side how does it reflect on functions that really requires a fix especially when code relies on certain behaviour.

that has always been one of my major concerns - and was pointed out by PascalDragon earlier on. however, as funlw65 alludes to, what happens if the old @GLIBC_2.2.5 symbols and the functions that lie behind them are depreciated by the GLIBC developers at some future time? these symbols are, after all, already 20 years old.

if some versioned symbols are depreciated, then strictly speaking i feel that libc.so.6 should be bumped up to libc.so.7, but we can not be certain this will happen in practice. Fred vS has emailed me with this concern. if the FPC RTL (and Lazarus LCL) made use of the C header files to define the prototypes of the library functions they use (such as dlopen() etc) then one could simply rebuild the RTL and LCL. but (in the case of the FPC RTL at least) the C header files are not used, instead the function prototypes hard-coded. and hard-coded in a selection of locations that it is not necessarily easy to locate - this is good reason in itself for ALL externals to library functions being brought together into a single .inc file. but that is way beyond the scope of my own experiments.

i would also suggest that research be carried out into having ONLY __libc_start_main, dlopen, and dlsym accessed by external. ALL other library calls should then be managed through dlopen and dlsym. if this is possible, then it substantially reduced the exposed surface, as well as allowing for the RTL et al to catch incompatibility errors and intelligently decide how to handle versioned symbols with multiple prototypes as required.


@WayneSherman: thank you for the pointers/links !

likewise, many thanks Wayne. we do need fresh eyes looking at these problems. it is a shame we do not have one or two of the GLIBC developers involved, as i am sure they could provide useful guidance! your checks indeed show how libdl.so symlink has itself been purged from some distros.


cheers,
rob   :-)

WayneSherman

  • Sr. Member
  • ****
  • Posts: 254
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #188 on: July 10, 2023, 07:10:43 pm »
from:  https://stackoverflow.com/questions/13753528/what-are-the-3-digits-in-a-so-name

Quote
Basically, the naming convention allows for three levels of compatibility for programs that link against the library. A program can choose to link against the library name itself, a specific major number, or a specific major.minor number. This is really up to an application developer to determine what makes the most sense.

from:  https://www.unix.com/unix-for-advanced-and-expert-users/90028-naming-conventions-shared-libraries-linux.html

Quote
They are version numbers, and are there for two reasons; so that you can safely and easily upgrade your libraries, and so you can have more than one version of them installed at the same time.

When there's two numbers there's a major and a minor version. libncursesw.so.5.6 has major version 5 and minor version 6; in theory any minor version of the same major version is compatible without recompiling, so programs that linked to libncursesw.so.5 wouldn't miss a beat if you upgraded to 5.7 for a bugfix. If you had an ancient program demanding version 4, you could safely install a 4.x library alongside the 5.x ones, and nothing but that program would use it.

Sometimes programmers don't think that far ahead though; they might link to a too specific version, breaking their program every time you upgrade a library, or link to libncursesw.so itself, causing crashes and/or strange runtime errors when the library's not what they expected.

A nice discussion on shared library versioning is here:
https://dcreager.net/2017/10/shared-library-versions/
« Last Edit: July 16, 2023, 12:37:52 am by WayneSherman »

WayneSherman

  • Sr. Member
  • ****
  • Posts: 254
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #189 on: July 10, 2023, 07:30:59 pm »
Regarding Linux software source code that depends on an external library (some_library.so).  During development, it is compiled, linked, and tested against a specific library version (e.g. some_library.so.2.1) and possibly versioned symbols within that library (e.g. (GLIBC_2.2.5) dlopen).  (EDIT - What follows is in regard to *static* loading of a library or symbol with the use of the "external" compiler directive. Runtime binding i.e. dynamic loading of a library can have different rules since runtime version checking can be used)

Not knowing any better :-) and for the sake of conversation, here are some assertions (which may or may not be correct):

Versioned Libraries
1) A *versioned* reference to an external library should be embedded in the executable. Why?  Because it was designed and tested with a version that is known to work correctly.  The referenced version should usually refer to the *major* version of the library only (e.g. some_library.so.2).

2) If a minor version of a shared library is specifically required for correct program execution, then the referenced version in the ELF file should include the minor version (e.g. some_library.so.2.1). EDIT - I feel like this is not a good idea.

3) When some_library.so.2 has backward incompatible changes (API, ABI, or changed function behaviors), the library developers *should* increment the library major version. (e.g. some_library.so.3)

Versioned Symbols within a Library
4) If versioned symbols are available (e.g. glibc), then *versioned* symbols for the external library should be embedded in the executable (e.g. (GLIBC_2.2.5) dlopen).  For the same reason as #1, because the source code using the symbol was designed and tested with a version that is known to work correctly.

5) For versioned symbols, when a function has backward incompatible changes (API, ABI, or behavior) the library developers *should* increment the symbol version.  EDIT - The previous version of that symbol should still be available to maintain backward compatibility.
« Last Edit: July 16, 2023, 02:52:19 am by WayneSherman »

circular

  • Hero Member
  • *****
  • Posts: 4391
    • Personal webpage
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #190 on: July 12, 2023, 07:15:07 am »
About specifying the minor version number, in general that may not be a good idea but unfortunately I have an example of a library (libavif) that has introducted breaking changes at many points, including minor version numbers.

In LazPaint, that runs as well on MacOS and Windows where I cannot know which version of the library would be available, the only solution I found was to bind without version but to check the version at runtime, and to use the version of the records that corresponds to it.
Conscience is the debugger of the mind

WayneSherman

  • Sr. Member
  • ****
  • Posts: 254
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #191 on: July 12, 2023, 05:58:15 pm »
About specifying the minor version number, in general that may not be a good idea but unfortunately I have an example of a library (libavif) that has introducted breaking changes at many points, including minor version numbers.

In LazPaint, that runs as well on MacOS and Windows where I cannot know which version of the library would be available, the only solution I found was to bind without version but to check the version at runtime, and to use the version of the records that corresponds to it.

If relying on a specific minor version, does that make distributing your application on Linux difficult?  You might have to statically link or include the library with your application if the minor version required is not available from the distro repository.  But then you have to keep the app or library patched for security issues instead of relying on the distro to do that.

For the "libavif" library, you might not even have the major version available that you need.  For example:

Debian 10 Buster (2019):
libavif is not included in the repos

Debian 11 Bullseye (2021):
https://packages.debian.org/search?suite=bullseye&section=all&arch=amd64&searchon=names&keywords=libavif
https://packages.debian.org/bullseye/amd64/libavif9/filelist
libavif9 with files libavif.so.9 and libavif.so.9.0.0

bullseye-backports
https://packages.debian.org/bullseye-backports/amd64/libavif13/filelist
libavif13 with files libavif.so.13 and libavif.so.13.0.0

Debian 12 Bookworm (2023):
https://packages.debian.org/search?suite=bookworm&arch=amd64&searchon=names&keywords=libavif
https://packages.debian.org/bookworm/amd64/libavif15/filelist
libavif15 with files libavif.so.15 and libavif.so.15.0.1

In the future, lets say bullseye updates libavif9 with a security release and increments to libavif.so.9.1.0 or libavif.so.9.0.1.  At that point they probably will remove libavif.so.9.0.0 from the repo.

EDIT - Dynamically loading and runtime checking a library version allows for more flexibility.  I added to my previous post (two posts up):  "(EDIT - What follows is in regard to *static* loading of a library or symbol with the use of the "external" compiler directive. Runtime binding i.e. dynamic loading of a library can have different rules since runtime version checking can be used)"
« Last Edit: July 12, 2023, 06:12:14 pm by WayneSherman »

circular

  • Hero Member
  • *****
  • Posts: 4391
    • Personal webpage
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #192 on: July 12, 2023, 10:47:14 pm »
For now, the following versions are handled by BGRABitmap:
Code: Pascal  [Select][+][-]
  1. const
  2.   AVIF_VERSION_0_8_4 = 00080400;
  3.   AVIF_VERSION_0_9_2 = 00090200;
  4.   AVIF_VERSION_0_9_3 = 00090300;
  5.   AVIF_VERSION_0_10_0 = 00100000;
  6.   AVIF_VERSION_0_10_1 = 00100100;
  7.   AVIF_VERSION_0_11_0 = 00110000;
  8.  
It handles up to 0.11.0 and from version 0.11.1 it is not compatible anymore (an exception is raised by safety checks). So I will need to update BGRABitmap and LazPaint to handle newer versions. And hope records will not change again in the future.

I don't know if libavif provide a table of versions, but that would be great to use some compatible functions of latest version handled (0.11.0 in this case). I don't know if this can be done with dynamic linking.
Conscience is the debugger of the mind

robert rozee

  • Sr. Member
  • ****
  • Posts: 259
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #193 on: July 15, 2023, 05:04:19 pm »
another useful data point:

Code: Bash  [Select][+][-]
  1. user@DH61BE:~$ readelf --dyn-syms -W /lib/x86_64-linux-gnu/libc.so.6 | grep -E " dl|start_main|Num:" | (sed -u 1q; sort -k 8)
  2.    Num:    Value          Size Type    Bind   Vis      Ndx Name
  3.    977: 000000000008fe60    74 FUNC    GLOBAL DEFAULT   15 dladdr1@GLIBC_2.3.3
  4.    978: 000000000008fe60    74 FUNC    GLOBAL DEFAULT   15 dladdr1@@GLIBC_2.34
  5.    139: 000000000008fe30    42 FUNC    GLOBAL DEFAULT   15 dladdr@GLIBC_2.2.5
  6.    138: 000000000008fe30    42 FUNC    GLOBAL DEFAULT   15 dladdr@@GLIBC_2.34
  7.   1998: 000000000008feb0    69 FUNC    GLOBAL DEFAULT   15 dlclose@GLIBC_2.2.5
  8.   2000: 000000000008feb0    69 FUNC    GLOBAL DEFAULT   15 dlclose@@GLIBC_2.34
  9.    163: 000000000008ff00   536 FUNC    GLOBAL DEFAULT   15 dlerror@GLIBC_2.2.5
  10.    162: 000000000008ff00   536 FUNC    GLOBAL DEFAULT   15 dlerror@@GLIBC_2.34
  11.   2348: 0000000000090430   134 FUNC    GLOBAL DEFAULT   15 dlinfo@GLIBC_2.3.3
  12.   2346: 0000000000090430   134 FUNC    GLOBAL DEFAULT   15 dlinfo@@GLIBC_2.34
  13.   1138: 0000000000174d30   532 FUNC    WEAK   DEFAULT   15 dl_iterate_phdr@@GLIBC_2.2.5
  14.    802: 00000000000905c0   155 FUNC    GLOBAL DEFAULT   15 dlmopen@@GLIBC_2.34
  15.    801: 00000000000905c0   155 FUNC    GLOBAL DEFAULT   15 dlmopen@GLIBC_2.3.4
  16.   1887: 0000000000090700   154 FUNC    GLOBAL DEFAULT   15 dlopen@GLIBC_2.2.5
  17.   1890: 0000000000090700   154 FUNC    GLOBAL DEFAULT   15 dlopen@@GLIBC_2.34
  18.    795: 00000000000907c0   206 FUNC    GLOBAL DEFAULT   15 dlsym@GLIBC_2.2.5
  19.    793: 00000000000907c0   206 FUNC    GLOBAL DEFAULT   15 dlsym@@GLIBC_2.34
  20.   1125: 00000000000908c0   219 FUNC    GLOBAL DEFAULT   15 dlvsym@GLIBC_2.2.5
  21.   1129: 00000000000908c0   219 FUNC    GLOBAL DEFAULT   15 dlvsym@@GLIBC_2.34
  22.    678: 0000000000029dc0   328 FUNC    GLOBAL DEFAULT   15 __libc_start_main@GLIBC_2.2.5
  23.    674: 0000000000029dc0   328 FUNC    GLOBAL DEFAULT   15 __libc_start_main@@GLIBC_2.34
  24. user@DH61BE:~$
  25. user@DH61BE:~$


if i'm not mistaken, the above tells us that the @GLIBC_2.2.5 and @GLIBC_2.34 versions of each of main libc/libdl functions used in FPC's RTL in fact map onto the same code. ie: __libc_start_main@GLIBC_2.2.5 and __libc_start_main@@GLIBC_2.34 both point to the same (0x29dc0) entry point, dlopen@GLIBC_2.2.5 and dlopen@GLIBC_2.34 both point to the same (0x90700) entry point, etc.

this would negate any arguments about wanting to use the 'most recent' version of a given function as it will have bugs fixed that may remain existing in an older version; the old (2.2.5) and new (2.34) versions are one and the same. quoting from another thread:

as long as the version number used exists (which we have just checked using readelf) the linker should (as far as i can see, although i am far from an expert) be happy. we end up with a binary file that will run against an early version of glibc without needing to build on an 'old' VM. would this work?

And what if the user does not want the old behavior? What if the new function fixed some critical functionality and by using the old one you'll run into problems because code you expect to work against the new behavior will run into problems? The __libc_start_main is exactly such an example.
(my bold italics)

if i am not mistaken - and i would be happy for anyone to demonstrate so - PascalDragon is wrong.

now i have only checked a few of the symbols from GLIBC, someone else may wish to conduct a more exhaustive check. perhaps write something to pick out all the matching sets of functions and for each set check for 'value' fields that are not the same.


cheers,
rob   :-)
« Last Edit: July 15, 2023, 05:09:11 pm by robert rozee »

WayneSherman

  • Sr. Member
  • ****
  • Posts: 254
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #194 on: July 15, 2023, 05:49:02 pm »
Code: Bash  [Select][+][-]
  1. user@DH61BE:~$ readelf --dyn-syms -W /lib/x86_64-linux-gnu/libc.so.6 | grep -E " dl|start_main|Num:" | (sed -u 1q; sort -k 8)
  2.    Num:    Value          Size Type    Bind   Vis      Ndx Name
  3.    977: 000000000008fe60    74 FUNC    GLOBAL DEFAULT   15 dladdr1@GLIBC_2.3.3
  4.    978: 000000000008fe60    74 FUNC    GLOBAL DEFAULT   15 dladdr1@@GLIBC_2.34
  5.    139: 000000000008fe30    42 FUNC    GLOBAL DEFAULT   15 dladdr@GLIBC_2.2.5
  6.    138: 000000000008fe30    42 FUNC    GLOBAL DEFAULT   15 dladdr@@GLIBC_2.34
  7. ...

now i have only checked a few of the symbols from GLIBC, someone else may wish to conduct a more exhaustive check. perhaps write something to pick out all the matching sets of functions and for each set check for 'value' fields that are not the same.

Although those symbols map to the same function code, there are symbols that map to different implementations as seen in this article:

https://developers.redhat.com/blog/2019/08/01/how-the-gnu-c-library-handles-backward-compatibility

Quote
For example, if we look at the 32-bit libc-2.29.so's dynamic symbol table, we see three versions of the glob64 function (in 2017, the glob function was changed to handle dangling symlinks differently, which would cause older programs to crash, but that's a different story):

Code: [Select]
$ readelf --dyn-syms -W /lib/libc-2.29.so | grep glob64
   411: 0012d0e0  7183 FUNC    GLOBAL DEFAULT   14 glob64@GLIBC_2.1
   412: 0012edb0  7183 FUNC    GLOBAL DEFAULT   14 glob64@GLIBC_2.2
   413: 000b69a0  7183 FUNC    GLOBAL DEFAULT   14 glob64@@GLIBC_2.27

BTW, one of my search results found an appropriate description which struck me as hilarious:
  "Versioned Symbols - A New Level of Hell" :-)
« Last Edit: July 15, 2023, 06:00:11 pm by WayneSherman »

 

TinyPortal © 2005-2018