3

When I've tried to execute my C++ demo app on RPI CM4, app that was cross compiled on Ubuntu OS:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

This is my errors from RPI:

root@rpi-cm4:/home/pi# ./demoApp
./demoApp: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by ./demoApp)
./demoApp: /lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./demoApp)

Some info's about my RPI:

# lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

# uname -a
Linux rpi-cm4 5.15.65-v7l+ #1582 SMP Mon Sep 5 15:34:37 BST 2022 armv7l GNU/Linux

# ldd --version
ldd (Debian GLIBC 2.28-10+rpi1) 2.28


# ldd --verbose /lib/arm-linux-gnueabihf/libm.so.6
        linux-vdso.so.1 (0xbefe7000)
        /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6e4d000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6cec000)
        /lib/ld-linux-armhf.so.3 (0xb6ee4000)

        Version information:
        /lib/arm-linux-gnueabihf/libm.so.6:
                ld-linux-armhf.so.3 (GLIBC_2.4) => /lib/ld-linux-armhf.so.3
                libc.so.6 (GLIBC_PRIVATE) => /lib/arm-linux-gnueabihf/libc.so.6
                libc.so.6 (GLIBC_2.4) => /lib/arm-linux-gnueabihf/libc.so.6
        /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so:
                libc.so.6 (GLIBC_2.4) => /lib/arm-linux-gnueabihf/libc.so.6
        /lib/arm-linux-gnueabihf/libc.so.6:
                ld-linux-armhf.so.3 (GLIBC_2.4) => /lib/ld-linux-armhf.so.3
                ld-linux-armhf.so.3 (GLIBC_PRIVATE) => /lib/ld-linux-armhf.so.3

How can I make a GLIBC update?

User
  • 67
  • 1
  • 1
  • 8
  • 1
    Do not make a glibc update. The OS depends heavily on the correct version of glibc and updating it will probably cause problems in many other programs. Use a cross compiler environment with the correct version of glibc instead and link your demo program to the same glibc version that is present on the target. – Jakob Stark Dec 09 '22 at 09:19
  • I used on my Ubuntu OS this version: `$ ldd --version ldd (Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31` How can I downgraded it? – User Dec 09 '22 at 09:30
  • 1
    For the same reasons that I mentioned above you should neither downgrade glibc on your Ubuntu. You need a seperate cross compiling environment with its own compiler and glibc (and any other libraries you need) that match the versions installed on the target system. What compiler did you use to compile your code? – Jakob Stark Dec 09 '22 at 09:35
  • I've used cross gcc compiler `$ arm-linux-gnueabi-gcc --version arm-linux-gnueabi-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0` – User Dec 09 '22 at 09:41
  • The problem is, that your cross compiler environment includes different glibc and libstdc++ versions than those on the target system. It is probably wise to set up a seperate build machine, that matches the OS of the target (debian 10 buster in your case). You could do this for example in a virtual machine, docker container or chroot environment. In such a build environment, you have best chances, that the cross compiler toolchains contain the right library versions. Alternatively you can compile the code right on the target machine, which is easiest to set up. – Jakob Stark Dec 09 '22 at 10:13
  • *How can I make a GLIBC update?* I'll repeat what @JakobStark says - do not try to change the GLIBC version for your entire OS. If you have to ask how to do that, you will almost certainly break your system so that it won't even boot if you try. And even if you know enough that you don't have to ask, you **still** risk breaking your system if you miss some dependency on the version. And should you successfully change the GLIBC version, every time you try to upgrade or update the OS or install a new package you **again** risk breaking everything. – Andrew Henle Dec 09 '22 at 12:05
  • Thank you all for suggestions! I've solved it! I've change those 2 libs (libm.so.6 and libstdc++.so.6) and now exists on target system: `root@raspberrypi:/home/pi# strings /tmp/libm.so.6 | grep GLIBC GLIBC_2.4 GLIBC_2.15 GLIBC_2.18 GLIBC_2.23 GLIBC_2.24 GLIBC_2.25 GLIBC_2.27 GLIBC_2.28 GLIBC_2.29 GLIBC_2.31 GLIBC_PRIVATE ` – User Dec 14 '22 at 08:03

4 Answers4

2

Modifying talsim's answer from below to what worked for me.

wget -4c https://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.gz
tar -zxvf glibc-2.29.tar.gz
cd glibc-2.29
mkdir build_dir
cd build_dir
sudo ../configure --prefix=/opt/glibc
sudo make
sudo make install
Zane Durante
  • 73
  • 1
  • 6
0

I have some error at debian, and solve it via install deb package glibc https://packages.debian.org/buster/amd64/libc6/download

sudo dpkg -i your_package_name
0

I ran into this problem trying to run Node.js 20 on a Raspberry Pi that is running Buster. As this and other threads have noted, updating the system libraries is very unwise as the OS depends on specific versions. As I also have Raspberry's running Bullseye, and Node.js 20 runs on Bullseye, it was easy enough to get various updated libraries to experiment with. I created a subdirectory in my home directory called ~/lib and then issued the command export LD_LIBRARY_PATH=~/lib. By copying various newer libraries from my Bullseye system to my ~/lib directory on the Buster system, I was able to determine that only libm.so.6 and libstdc++.so.6 were the out of date libraries preventing Node.js 20 from running.

So if I want to run Node.js 20, I use a bash script that exports the LD_LIBRARY_PATH variable and then invokes node. For me, it is a good workaround until I migrate this system to Bookworm.

I should note that the older the system is, the harder it will be to catch all the dependencies. Just as test, I booted an SD card with an old Wheezy system on it. I was unable to find any collection of libraries that would allow a relatively recent Node.js release to run. I suspect that if I was trying to get Node.js 20 to run under Stretch, it would probably be even more involved than just two libraries and even that might not work due to the age of the system.

-2

You can try to download the glibc from their official website and install it:

wget -4c https://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.gz
tar -zxvf glibc-2.29.tar.gz
cd glibc-2.29
./configure --prefix=/opt/glibc
make
make install
talsim
  • 42
  • 4
  • After I ran the fourth command `./configure --prefix=/opt/glibc` I got the following error message at the end: `configure: error: you must configure in a separate build directory`. It seems to suggest that I should use a more local path while configuring. Or perhaps add `sudo` to some of the commands? Please recommend the exact changes one would need to make to the above. – Leonid Dec 18 '22 at 05:28
  • I might've explained how to run the config correctly, as I thought it was obvious. You should ran `./configure` from a different folder and not within `glibc-2.29` folder. e.g `../configure`. This is because `./configure` creates a makefile dependent to your system, so it can fit to your machine dependencies, etc. – talsim Dec 19 '22 at 08:34
  • You've got to make a build directory and start the "configure" step inside that directory. See https://github.com/jueve/build-glibc – txyoji Jan 03 '23 at 19:30