Statically linking dependencies

Linux specific forum
akamicah
User
User
Posts: 18
Joined: Fri May 06, 2022 7:11 pm
Contact:

Statically linking dependencies

Post by akamicah »

Hello,

I like PureBasic and I'm a Linux user, and one drawback (which isn't PureBasic specific, but more a linux thing) is if I were to compile a program on Ubuntu 21.10 and want to deploy that to my server which is running Ubuntu 20.04 I get the dreaded
./test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./test)


Typically in C/C++ this can be prevented by compiling with '-static' though trying it with PureBasic inside ImportC just doesn't want to work.

Since I imagine the C back-end is going to gain in popularity, would it be feasible to perhaps offer the option to statically link dependency libraries so that something compiled on one version/distro will work on others, or at least will have a considerably better chance?

GLIBC will continue to be a huge pain in the backside with Linux distros as new versions come out
Bitblazer
Enthusiast
Enthusiast
Posts: 732
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Statically linking dependencies

Post by Bitblazer »

I simply look for all dependencies on linux projects and find the lowest possible version of a linux system that fullfills them. For example most of my linux projects are compiled on ubuntu 16 because of that.

IMHO - Don't compile on high linux versions, compile on the lowest possible.
webpage - discord chat links -> purebasic GPT4All
jack
Addict
Addict
Posts: 1336
Joined: Fri Apr 25, 2003 11:10 pm

Re: Statically linking dependencies

Post by jack »

perhaps Appimage would solve your portability problem https://appimage.org/
Fred
Administrator
Administrator
Posts: 16616
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Statically linking dependencies

Post by Fred »

The rule is to compile on the lowest version you want to support, it usually does the trick.
akamicah
User
User
Posts: 18
Joined: Fri May 06, 2022 7:11 pm
Contact:

Re: Statically linking dependencies

Post by akamicah »

All very valid solutions - was just living in hope :P
Post Reply