Page 1 of 1

Statically linking dependencies

Posted: Fri May 06, 2022 7:42 pm
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

Re: Statically linking dependencies

Posted: Fri May 06, 2022 9:59 pm
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.

Re: Statically linking dependencies

Posted: Fri May 06, 2022 11:18 pm
by jack
perhaps Appimage would solve your portability problem https://appimage.org/

Re: Statically linking dependencies

Posted: Sat May 07, 2022 1:10 pm
by Fred
The rule is to compile on the lowest version you want to support, it usually does the trick.

Re: Statically linking dependencies

Posted: Sat May 07, 2022 2:31 pm
by akamicah
All very valid solutions - was just living in hope :P