First of all, don't put an alternate libc (or alternate version of your libc) in a path searched by the normal include and library search (both link-time and runtime library search) for your main system one. This is a recipe for disaster. Installing a different glibc in /usr/local/ does avoid clobbering your system one, but now you just have two installed in places where the same tools can see and use them.

To do this right, you really need a full separate toolchain (gcc, binutils) in some completely separate path (like ~/my_glibc_root/... or /opt/alt_glibc_root/...). I'm not sure if there's a recommended way to do this. The glibc build procedures in Linux From Scratch might be a good place to look for ideas. In theory it can be done in a single stage; I do that with musl libc in musl-cross-make by careful use of intermediate make rules in the gcc build system. But applying the same idea to glibc probably requires some extra care.

Answer from R.. GitHub STOP HELPING ICE on Stack Overflow
Top answer
1 of 2
3

First of all, don't put an alternate libc (or alternate version of your libc) in a path searched by the normal include and library search (both link-time and runtime library search) for your main system one. This is a recipe for disaster. Installing a different glibc in /usr/local/ does avoid clobbering your system one, but now you just have two installed in places where the same tools can see and use them.

To do this right, you really need a full separate toolchain (gcc, binutils) in some completely separate path (like ~/my_glibc_root/... or /opt/alt_glibc_root/...). I'm not sure if there's a recommended way to do this. The glibc build procedures in Linux From Scratch might be a good place to look for ideas. In theory it can be done in a single stage; I do that with musl libc in musl-cross-make by careful use of intermediate make rules in the gcc build system. But applying the same idea to glibc probably requires some extra care.

2 of 2
0

Second Try Command: In second try, I am using "-I" & "-L" GCC command options.

gcc -Wall -g -I/usr/local/glibc/include -o main main.c -L/usr/local/glibc/lib -Wl,--rpath=/usr/local/glibc/lib -Wl,--dynamic-linker=/usr/local/glibc/lib/ld-linux-x86-64.so.2

This command is almost correct. The thrd_create and thrd_join functions are defined in libpthread, which you didn't link against.

Add -pthread to your compile command, and the link should succeed.

P.S. R's advice of not installing alternate GLIBC into /usr/local is also a good one.

🌐
GitHub
github.com › sdwru › glibc-centos-8 › blob › master › BUILD › glibc-2.28 › INSTALL
glibc-centos-8/BUILD/glibc-2.28/INSTALL at master · sdwru/glibc-centos-8
glibc for Centos v8 including 2.6.32 kernel compatibility as required when using OpenVZ v6. The master and release branches track official source and the custom branches contain the changes. https://github.com/sdwru/glibc-centos-8/releases contains an OVZ6 template and the compiled RPM packages - glibc-centos-8/BUILD/glibc-2.28/INSTALL at master · sdwru/glibc-centos-8
Author   sdwru
Discussions

How to install GLIBC version 2.29 in the Linux Binary Compat layer? | The FreeBSD Forums
Activitywatch is a program that is used to track the amount of time that is spent on a computer, they only officially have support for Windows, Linux and MacOS. I have installed the Linux Binary compatibility layer and installed activitywatch under /compat/ubuntu/opt/activitywatch, when I run... More on forums.freebsd.org
🌐 forums.freebsd.org
September 5, 2023
centos7 - Install package failed because of dependency problem - Stack Overflow
to update a package with yum or rpm the install failed because of a dependency issue rpm -ivh sudo-1.8.29-6.el8_3.1.x86_64.rpm warning: sudo-1.8.29-6.el8_3.1.x86_64.rpm: Header V3 RSA/SHA256 Signa... More on stackoverflow.com
🌐 stackoverflow.com
I compiled Glibc 2.29, the installation was unsuccessful and I want to remove it. How to proceed?
I compiled a version of Glibc (2.29) required by a game that I downloaded from the internet. I did all the procedures listed on a site (upgrade - How to update glibc to 2.14 in CentOS 6.5 - Unix & Linux Stack Exchange) but the installation gave an error in the middle of the process and my computer ... More on forum.zorin.com
🌐 forum.zorin.com
1
0
March 22, 2021
How to install GLIBC 2.29 or higher in Ubuntu 18.04 - Stack Overflow
So I am trying to install truDesk on my local system. I am getting this error while running the command npm install -g yarn: node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found ( More on stackoverflow.com
🌐 stackoverflow.com
🌐
Pkgs.org
pkgs.org › download › glibc(x86-64)
Glibc(x86-64) Download for Linux (rpm)
Download glibc(x86-64) linux packages for AlmaLinux, Amazon Linux, CentOS, Fedora, Mageia, OpenMandriva, openSUSE, PCLinuxOS, Rocky Linux · Filter: Distros: all Arches: arm intel Types: official thirdparty · AlmaLinux 9 · AlmaLinux 8 · Amazon Linux 2 · Amazon Linux 1 ·
🌐
FreeBSD
forums.freebsd.org › server and networking › emulation and virtualization
How to install GLIBC version 2.29 in the Linux Binary Compat layer? | The FreeBSD Forums
September 5, 2023 - /usr/bin/ld: /root/glibc-2.29/build/elf/librtld.os: in function `_rtld_main_check': /root/glibc-2.29/elf/../sysdeps/x86/dl-prop.h:33: undefined reference to `_dl_cet_check' /usr/bin/ld: /root/glibc-2.29/elf/../sysdeps/x86/dl-prop.h:33: undefined reference to `_dl_cet_check' /usr/bin/ld: /root/glibc-2.29/elf/../sysdeps/x86/dl-prop.h:33: undefined reference to `_dl_cet_check' /usr/bin/ld: /root/glibc-2.29/build/elf/librtld.os: in function `_dl_open_check': /root/glibc-2.29/elf/../sysdeps/x86/dl-prop.h:41: undefined reference to `_dl_cet_open_check' /usr/bin/ld: /root/glibc-2.29/build/elf/ld.so.n
Top answer
1 of 3
23

Check it is actually needed

Firstly check the python application as it could be out of date and is probably misreading the glibc version. CentOS shows the base version as installed and is patched to keep up with changes and it could just be a case of fixing the version that is being looked for in the code as a quick fix, but if the application is being actively developed you need to let the developers know or fork it for yourself if you can.

An up to date glibc on CentOS 7 should be 2.17-196.el7_4.2

If it is needed, Containerise

If it's absolutely necessary to run this application, the official RHEL approach would be to containerize, but you would still need to provide a working glibc, which wouldn't be possible with stock CentOS 7.

As a last resort, install glibc in a nonstandard location

If this isn't viable, and as an absolute last resort, it is possible to install a newer version of glibc than 2.18 as that is 9 years old now and glibc has been updated for several vulnerabilities and I'm not sure off the top of my head if it will build with the version of make in CentOS 7, but any newer version should work as follows:

  • This can potentially affect the functionality of your computer so make sure you know what you are doing

You can build the version of glibc you require elsewhere on your server and add it to LD_LIBRARY_PATH for the application. Note this must only be done for the application only.

wget http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
tar zxvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/opt/glibc-2.18
make -j4
sudo make install

Then to run a binary you need to use patchelf to update its interpreter

patchelf --set-interpreter /opt/glibc-2.18/lib/ld-linux-x86-64.so.2 program_you_are_running

And you need to enable it to find the new glibc library, either by

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.18/lib

Or you can use patchelf to update the binary's rpath (you can combine this with the previous pathelf command)

patchelf --set-rpath /opt/glibc-2.18/lib:/usr/lib64 program_you_are_running

If you change LD_LIBRARY_PATH don't export it for the whole system because all the binaries unmodified by patchelf will segfault.

/opt is the standard place to install third-party applications and libraries but you can use any path away from the system paths.

2 of 3
4

In the end,I did not have to upgrade GLIBC. The gdc-client tool I downloaded through R seemed to be for Ubuntu and not CentOS, though I did it on CentOS 7. I then downloaded the gdc-client for CentOS and it worked fine.

🌐
Ngelinux
ngelinux.com › home › how to install glibc package version 2.28+ on rhel 7 unofficially for testing purposes?
How to install glibc package version 2.28+ on RHEL 7 unofficially for testing purposes? | New Generation Enterprise Linux
June 22, 2022 - CentOS or RHEL does not officially support this and provides glibc version 2.17 as official version. Since these packages affect the core OS, upgrading unofficial version makes your OS out of support.
Find elsewhere
🌐
The Linux Cluster
thelinuxcluster.com › 2023 › 06 › 30 › compiling-glibc-2-29-at-centos-7
Compiling glibc-2.29 at CentOS-7 – The Linux Cluster
July 9, 2023 - Step 1: Download the glibc To Download the glibc-2.29, do download at https://ftp.gnu.org/gnu/glibc/ Step 2: Compile and Build the glibc libraries # tar zxvf glibc-2.29.tar.gz # cd glibc-2.29 # mkdir build # cd build Step 3: Compile and install ...
🌐
GitHub
github.com › arkmanager › ark-server-tools › wiki › Install-of-required-versions-of-glibc-and-gcc-on-RHEL-CentOS
Install of required versions of glibc and gcc on RHEL CentOS
June 23, 2015 - RHEL/CentOS 6.6 and below have an outdated version of glibc and gcc, you can make ARK server works manually upgrading these libraries: yum groupinstall "Development tools" yum install glibc-devel.i686 glibc-i686 · cd /tmp wget http://ftp.g...
Author   arkmanager
🌐
Remi's RPM Repository
rpms.remirepo.net › rpmphp › zoom.php
Packages in Fedora / RHEL / CentOS / EPEL - Package: glibc
Show more informations from pkgdb · The Fedora Project is maintained and driven by the community and sponsored by Red Hat. This is a community maintained site. Red Hat is not responsible for content
🌐
CentOS Repositories
centos.pkgs.org › 8 › centos-baseos-x86_64 › glibc-2.28-127.el8.x86_64.rpm.html
Glibc Download (EOPKG, RPM, TXZ, XBPS, XZ, ZST)
Download glibc packages for AlmaLinux, ALT Linux, Amazon Linux, Arch Linux, CentOS, Fedora, KaOS, Mageia, OpenMandriva, openSUSE, PCLinuxOS, Rocky Linux, Slackware, Solus, Void Linux
🌐
Red Hat
access.redhat.com › discussions › 3244811
Red Hat Customer Portal - Access to 24x7 support and knowledge
If you are developing programs which : will use the standard C libraries, your system needs to have these : standard object files available in order to create the : executables. : : Install glibc-devel if you are going to develop programs which will : use the standard C libraries.
🌐
Liquid Web
liquidweb.com › home › how to update the glibc (gnu libc) in centos / red hat
How to Update the glibc (GNU libc) in CentOS / Red Hat | Liquid Web
December 3, 2024 - Looking to update glibc (GNU libc) in CentOS or Red Hat? Learn how to upgrade this critical library and ensure your system’s stability and security.
🌐
Bits and Dragons
bitsanddragons.wordpress.com › 2020 › 08 › 26 › glibc_2-25-compile-on-centos-7-8
GLIBC_2.25 compile on CentOS 7.8 | Bits and Dragons
September 9, 2020 - I previously had issues with GLIBC, now on my current CentOS 7.8 I can’t update it via yum anymore. This is my (simple) recipe: wget https://ftp.gnu.org/gnu/glibc/glibc-2.25.tar.gz tar -xvzf glibc-2.25.tar.gz cd glibc-2.25/ mkdir build cd build/ ../configure --prefix=/opt/local/glibc-2.25/ make -j8 make install
🌐
Stack Overflow
stackoverflow.com › questions › 74471037 › i-need-glibc-install
linux - I need Glibc install - Stack Overflow
Since you tagged your question with ubuntu-18.04, it came with GLIBC-2.27. You want any newer Ubuntu, e.g.
Top answer
1 of 1
5

You can use dnf to upgrade it - dnf update -y glibc.

Full example from a container on my machine:

[root@0df679e04d17 /]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.2 (Ootpa)
[root@0df679e04d17 /]# rpm -qa glibc
glibc-2.28-101.el8.x86_64
[root@50a1768b4fcf /]# dnf update glibc
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Red Hat Universal Base Image 8 (RPMs) - BaseOS                                                                                                                                       1.1 MB/s | 827 kB     00:00
Red Hat Universal Base Image 8 (RPMs) - AppStream                                                                                                                                    3.7 MB/s | 3.2 MB     00:00
Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder                                                                                                                            138 kB/s |  29 kB     00:00
Dependencies resolved.
=====================================================================================================================================================================================================================
 Package                                                     Architecture                                Version                                             Repository                                         Size
=====================================================================================================================================================================================================================
Upgrading:
 glibc                                                       x86_64                                      2.28-211.el8                                        ubi-8-baseos                                      2.2 M
 glibc-common                                                x86_64                                      2.28-211.el8                                        ubi-8-baseos                                      1.0 M
 glibc-minimal-langpack                                      x86_64                                      2.28-211.el8                                        ubi-8-baseos                                       63 k
Installing weak dependencies:
 glibc-gconv-extra                                           x86_64                                      2.28-211.el8                                        ubi-8-baseos                                      1.5 M
 glibc-langpack-en                                           x86_64                                      2.28-211.el8                                        ubi-8-baseos                                      825 k

Transaction Summary
=====================================================================================================================================================================================================================
Install  2 Packages
Upgrade  3 Packages

Total download size: 5.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): glibc-minimal-langpack-2.28-211.el8.x86_64.rpm                                                                                                                                401 kB/s |  63 kB     00:00
(2/5): glibc-langpack-en-2.28-211.el8.x86_64.rpm                                                                                                                                     2.5 MB/s | 825 kB     00:00
(3/5): glibc-common-2.28-211.el8.x86_64.rpm                                                                                                                                          1.7 MB/s | 1.0 MB     00:00
(4/5): glibc-gconv-extra-2.28-211.el8.x86_64.rpm                                                                                                                                     1.6 MB/s | 1.5 MB     00:00
(5/5): glibc-2.28-211.el8.x86_64.rpm                                                                                                                                                 1.8 MB/s | 2.2 MB     00:01
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                4.0 MB/s | 5.6 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                             1/1
  Installing       : glibc-gconv-extra-2.28-211.el8.x86_64                                                                                                                                                       1/8
  Running scriptlet: glibc-gconv-extra-2.28-211.el8.x86_64                                                                                                                                                       1/8
  Upgrading        : glibc-common-2.28-211.el8.x86_64                                                                                                                                                            2/8
  Running scriptlet: glibc-2.28-211.el8.x86_64                                                                                                                                                                   3/8
  Upgrading        : glibc-2.28-211.el8.x86_64                                                                                                                                                                   3/8
  Running scriptlet: glibc-2.28-211.el8.x86_64                                                                                                                                                                   3/8
  Installing       : glibc-langpack-en-2.28-211.el8.x86_64                                                                                                                                                       4/8
  Upgrading        : glibc-minimal-langpack-2.28-211.el8.x86_64                                                                                                                                                  5/8
  Cleanup          : glibc-minimal-langpack-2.28-101.el8.x86_64                                                                                                                                                  6/8
  Cleanup          : glibc-2.28-101.el8.x86_64                                                                                                                                                                   7/8
  Cleanup          : glibc-common-2.28-101.el8.x86_64                                                                                                                                                            8/8
  Running scriptlet: glibc-common-2.28-101.el8.x86_64                                                                                                                                                            8/8
  Running scriptlet: glibc-common-2.28-211.el8.x86_64                                                                                                                                                            8/8
  Verifying        : glibc-langpack-en-2.28-211.el8.x86_64                                                                                                                                                       1/8
  Verifying        : glibc-gconv-extra-2.28-211.el8.x86_64                                                                                                                                                       2/8
  Verifying        : glibc-minimal-langpack-2.28-211.el8.x86_64                                                                                                                                                  3/8
  Verifying        : glibc-minimal-langpack-2.28-101.el8.x86_64                                                                                                                                                  4/8
  Verifying        : glibc-2.28-211.el8.x86_64                                                                                                                                                                   5/8
  Verifying        : glibc-2.28-101.el8.x86_64                                                                                                                                                                   6/8
  Verifying        : glibc-common-2.28-211.el8.x86_64                                                                                                                                                            7/8
  Verifying        : glibc-common-2.28-101.el8.x86_64                                                                                                                                                            8/8
Installed products updated.

Upgraded:
  glibc-2.28-211.el8.x86_64                                     glibc-common-2.28-211.el8.x86_64                                     glibc-minimal-langpack-2.28-211.el8.x86_64

Installed:
  glibc-gconv-extra-2.28-211.el8.x86_64                                                                     glibc-langpack-en-2.28-211.el8.x86_64

Complete!
[root@0df679e04d17 /]# rpm -qa glibc
glibc-2.28-211.el8.x86_64