15

I'd like to update to a 2022 version of glibc, at least 2.35. This seems to be available on Ubuntu 22.04, but how can I get it on 20.04?

Jack M
  • 1,658
  • 2
    the problem is that glibc is a system package, and a lot of things can break if you install the wrong version. what do you need it for? – Esther May 11 '22 at 21:12
  • @Esther I want those sexy new cutting-edge printf features. (It's not very important, but some code I wrote on a newer machine doesn't run on this one because it uses this feature which I didn't realize was new). – Jack M May 11 '22 at 21:21
  • 5
    https://stackoverflow.com/a/44710599/12642499 you can't replace the one you have, because many built-in binaries depend on it. But you can install the newer version from source in some other location, and patch your programs to use glibc from a non-default location. choosing a location for the install happens when you run ./compile --prefix=/path/to/new/glibc in the source directory, you can pass it a flag prefix which will tell it where to install, and then make to compile and install glibc there. – Esther May 11 '22 at 21:47
  • 1
    Export the LD_LIBRARY PATH environment variable to point to the location of a newer lib. – MarkHu May 31 '22 at 02:19
  • @MarkHu, pardon my ignorance, with PATH you mean the path-to-glibc-new-install/bin directory from https://askubuntu.com/a/1345783/123217? – ssi-anik Mar 14 '23 at 10:27
  • For me, glibc-2.35 on Ubuntu-20.04 crashes with Segmentation Fault, whether built from source or extracted from a newer-release .deb.

    $ env LD_LIBRARY_PATH=/home/me/Downloads/Build/glibc-2.35/glibc-build /bin/ls -F

    Segmentation fault (core dumped)

    – Randall Whitman Oct 31 '23 at 22:53

2 Answers2

6

You can use following commands to bring in newer version of glibc in ubuntu 20.04, but note that as it is a system package, upgrading it may impact your system.

apt-get install gawk bison gcc make wget tar -y
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.35.tar.gz
tar -zxvf glibc-2.35.tar.gz && cd glibc-2.35
mkdir glibc-build && cd glibc-build
../configure --prefix=/opt/glibc
make
make install
Atur
  • 269
0

Introducing glibc will break your core binaries. Updated core binaries require a newer kernel which breaks hardware drivers (like NVIDIA) that need your old kernel. This "vicious cycle" makes it impossible to use new glibc w/o breaking your system.

The only solution is to compile the unsupported drivers somehow for the new kernel. So far this is not possible.

If you try using GLIBC without updating its dependencies, you will get complaints of a version mismatch on its dependencies which go all the way down to the kernel, which is why it is not possible.

Your options are limited and it is not possible unless you use a virtual machine. But likely VM is not what you want because VMs do not have the advantage of talking to your hardware directly. They have some VM extensions for making that better but they only cover CPU and RAM, not the video/sound card, that is all emulated.

Summary

If you want to run something that needs newer hardware, there is just no way around that:

  1. You cant use unsupported hardware on newer kernel, and therefore linker, and then GLIBC.

  2. You can't use unsupported GLIBC on older kernel which relies on the new kernel features. If you try to do it by force (point to new compiled version of the new binaries) you will get an error that the linker/kernel versions are incorrect.

  3. The only solution to this is if there was a way to update your hardware drivers. If that isn't your problem, then UPGRADE UBUNTU to the latest version. If that IS your problem, then you are out of luck.

  4. Companies like NVIDIA and AMD drop video support after a few years and leave you up a creek with no paddle, stranded on an old OS unless you buy yet another video card (even if your current one is fast and does just fine, they do NOT care).

  5. Sandboxing in flatpak still needs those libraries to be able to link with your kernel. Sandboxing only fixes dependencies that are above the base system level. HOWEVER, if any of those libraries were built against a binaries that recursively rely on newer core libraries, you will still be stuck and it will still not work, below is an example:

/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
(required by /tmp/.mount_my2newapp.a9fz3/usr/bin/../../usr/lib/liblzma.so.5)

As you can see here, even though the appimage/flatpak/snap was sandboxed, it still needed these new libraries further down the dependency chain.