Recent

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

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #15 on: September 27, 2022, 09:01:05 am »
The error states that dlopen/dlsym/dlclose are not available in the libc/'c'.

There is no mention of dlopen, dlsym or dlclose as part of the error. The only time they're mentioned here is in the listing of the unresolved symbols of the binary in the first message and there that is normal.

My guess is there is something wrong somewhere in your code or its dependency, which define dlopen/dlsym/dlclose manuall as external 'c'.
Perhaps try to use the unit dl which defines things as expected.

*sigh* It has nothing to do with these symbols, but with the symbol versioning of the C library. This was already solved.

Anyway, there it is, if you build and distribute binaries to other Linux users, beware !

This! ;D (except if they're statically linked like the FPC compiler binary itself ;) )

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #16 on: September 29, 2022, 12:33:26 am »
Hello.

For info: https://packages.debian.org/search?keywords=libc6
For Debian (who knows, afaik, what is stable or not), version 2.31 is the last stable release.
2.34-2.35 are considered as unstable and 2.36 is experimental.

So if you want that your binary-release can run in lot of distros, better to compile+link with a stable libc.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #17 on: September 29, 2022, 02:15:29 am »
2.34-2.35 are considered as unstable and 2.36 is experimental.
Yes Fred but consider that with Ubuntu, arguably the most used distro, the 22.04 long term release, already 5 months old, is using 2.35, that means that all the Ubuntu derivatives such as Linux Mint are also using 2.35 !  The cat is well and truly out of the bag !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

stephanie

  • New Member
  • *
  • Posts: 27
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #18 on: October 02, 2022, 10:59:43 am »
Hello,

I have the same problem. I've Lazarus both on a Debian 10 Buster, that uses glibc 2.28 and on a Xubuntu 22.04 LTS, that uses glibc 2.34.

If I compile on Xubuntu (glibc 2.34) the executable cant't run on Debian Buster (glibc 2.28):

Code: Pascal  [Select][+][-]
  1. stephanie@PcServer:~$ ldd /home/stephanie/MyErpNew/myerp_new_Laz224c
  2. /home/stephanie/MyErpNew/myerp_new_Laz224c: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/stephanie/MyErpNew/myerp_new_Laz224c)
  3.  

It seems it's always necessary to have a virtual machine with an older version of a Linux distro, in order to allow that the executable works on all version of Linux. Otherwise, if I compile with a new Linux distro, who has an older distro can't run the excecutable.

Of course I find unconfortable this, but I've found a better solution yet.

If anyone have an idea to bypass this problem, it would be very appreciated.

I hope that in the future Lazarus can improve a solution to this case.

Sorry for my bad English.

Best regards,

Stephanie

colo

  • New Member
  • *
  • Posts: 43
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #19 on: October 02, 2022, 11:40:43 am »
You don't really need a complete virtual machine around for this; a chroot environment (or "container") suffices. I keep a systemd-nspawn container with Debian oldstable in it (and a recent Lazarus installed from upstream-provided Debian packages) around to build executables with that will run on rather dated GNU/Linux environments, too.

stephanie

  • New Member
  • *
  • Posts: 27
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #20 on: October 02, 2022, 11:53:47 am »
Thank you for your reply.

How could I configure a chroot environement? Where could I find documentation? I've no experience with this.

Thank you again, best regards,

Stephanie

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #21 on: October 02, 2022, 12:17:06 pm »
...
I hope that in the future Lazarus can improve a solution to this case.


The best solution would be that fpc does not need to link libc.so for his /rtl/.
But this is not for soon (afaik).
« Last Edit: October 02, 2022, 01:42:12 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

colo

  • New Member
  • *
  • Posts: 43
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #22 on: October 02, 2022, 01:56:47 pm »
Thank you for your reply.

How could I configure a chroot environement? Where could I find documentation? I've no experience with this.

Thank you again, best regards,

Stephanie

Assuming you use a Debian-based distribution (such as Ubuntu) to develop on, you can install a package named debootstrap. This software can spawn complete Debian (and a number of derivatives) installations into another directory on your currently mounted file system. The Arch Linux wiki has an excellent article on this technique, which is applicable to an Ubuntu host: https://wiki.archlinux.org/title/Systemd-nspawn#Create_a_Debian_or_Ubuntu_environment

The debbostrap documentation will tell you how you can set up Debian 9 or Debian 10 inside such a deboostrap directory, which you can then use to start that as a container via systemd-nspawn. If you want to run a complete Lazarus environment inside that Debian container, with access to its GUI, check out https://wiki.archlinux.org/title/Systemd-nspawn#Use_an_X_environment (which is kinda advanced, but also not necessary).

You will also want to access the Lazarus project files from your current develpment environment in the container, and for that you will have to map paths from host to container. https://wiki.archlinux.org/title/Systemd-nspawn#Access_host_filesystem touches on that.


My personal setup is an Arch Linux installation on my desktop computer, and I use Lazarus under my user account named "colo" there to develop applications. The source code is stored in /home/colo/codebase in that Arch Linux installation. I do have a Debian 10 Container in /var/lib/machines/deb10 (initially created via deboostrap), which also has a user account named "colo" created. To start and enter the container, I invoke `sudo systemd-nspawn -D /var/lib/machines/deb10 -b --bind=/home/colo/codebase/ --bind=/home/colo/.Xauthority --bind=/tmp/.X11-unix/` on my Arch Linux host, and log in to the Debian-based account on the login prompt that show up after that command succeeds. There, I can set the DISPLAY environment variable to point at my Xorg display on the host (export DISPLAY=:0.0) and use lazarus-ide from inside the container, or use lazbuild to create a new executable without having to use the GUI. The binaries end up in the directory shared between the host and the container. When I'm done, I shut down the container as if it were a real machine.

stephanie

  • New Member
  • *
  • Posts: 27
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #23 on: October 02, 2022, 09:04:19 pm »
Thank you very very much!

Very interesting.

I'll study the documentaion and I'll try.

Thank you again, best regards,

Stephanie

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #24 on: October 03, 2022, 02:28:45 pm »
I hope that in the future Lazarus can improve a solution to this case.

There is no better solution than to compile your application on a suitable, older distribution. Anything else is just a hack waiting to break at the most unwanted time possible.

...
I hope that in the future Lazarus can improve a solution to this case.


The best solution would be that fpc does not need to link libc.so for his /rtl/.
But this is not for soon (afaik).

Not linking to libc means no support for threads or linking to any other more involved library as the C library these libraries in turn depend on wouldn't be initialized correctly (as that is the task of the application startup code).

stephanie

  • New Member
  • *
  • Posts: 27
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #25 on: October 03, 2022, 10:14:44 pm »
Hello,

an AppImage might be a solution?

I don't know if there is an easy tool to generate a Linux AppImage from Lazarus.

An AppImage should have all dipendences in the unique file.

Anyone has tried?

Best regards,

Stephanie

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #26 on: October 04, 2022, 12:03:21 am »
Hello,

an AppImage might be a solution?

I don't know if there is an easy tool to generate a Linux AppImage from Lazarus.

An AppImage should have all dipendences in the unique file.

Anyone has tried?

Best regards,

Stephanie

The quick, easy an safe way is to install Debian 10 Buster that uses libc.so.6 ver 2.28.
https://www.debian.org/releases/buster/debian-installer/

You may install the downloaded iso image with a server virtualization software like VMWare or VirtualBox or QEmu.

Then install on that virtual machine last fpc, last Lazarus and compile your last source (that you have developed on your main dev-machine an copy on a usb stick, loaded in the virtual machine).
An copy the compiled-result-binary and paste it in your release-package.

Your release will run on nearly all actual Linux distros.
« Last Edit: October 04, 2022, 01:07:39 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

colo

  • New Member
  • *
  • Posts: 43
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #27 on: October 04, 2022, 10:19:34 am »
You could look at AppImage, Flatpak, Snap, and potentially other "modern" software distribution vehicles and mechanisms, but they come with a fair share of added complexity and responsibility. If you just dynamically link the host OS's libc, you don't have to keep track of that library's security issues in your distributed copy. So as long as you can get away without shipping a complete "runtime" set of userspace libs along with our application, I think it's wise to do so.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #28 on: October 04, 2022, 11:02:05 am »
Hmm, I always have several, maybe 10 or 12 current VirtualBox machines on hand because you need to test your app with different desktops. So, my build machine is U2004 Gnome. Its a good idea to build (ie a final, release build) on a different system than you develop on, helps catch situations where your app depends on something that you just happened to have installed on your day to day machine.

And I need to test against Gnome and I'd never work, by choice, on a Gnome system.

AppImage ?  I looked at that awhile ago, got some very conflicting answers about a GTK2 based AppImage, somone answered my question about where it is only to have that answer removed and replaced by a "we don't do GTK2" - no further response.

Packaging containers are generally a real pain !  My App, tomboy-ng is about a 3Meg download and uses about 6meg of diskspace. It replaces the original Tomboy that you can still install as a Flatpack, its a 700Meg download and uses 2.4G of diskspace. Anyone want to guess how much RAM it uses when running ?

Another build model that might be useful if you already make debs to distribute your app (and its open source) is Ubuntu's PPA. Despite my grizzels above about having to work with a Debian deb of FPC/Lazarus, I have built an up to date PPA based on U2004 with FPC3.2.2 and Lazarus 2.2.2, if you can make a source package, welcome to use it to build (and distribute) your app.

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
« Reply #29 on: October 04, 2022, 01:15:26 pm »
an AppImage might be a solution?

I don't know if there is an easy tool to generate a Linux AppImage from Lazarus.

An AppImage should have all dipendences in the unique file.

That would also mean that you're responsible for maintaining all the libraries (and when you replace libc it really is all the libraries) and keeping them up-to-date. Not to mention the size issue as dbannon mentioned.

 

TinyPortal © 2005-2018