I am trying to use my new Pi 4 to run a Rust executable that I compiled on Linux but it will not run because it needs libc 2.29 and it appears that buster comes with libc 2.28. Is it possible to update the version of libc6 and if it is then what is the procedure to do so?
-
1Doing anything to libc is prone to lead to disasters. You could install a different version in a non-standard location and link to that, but it would really be much better if you either compiled it on the Pi or (cross-)compiled it in a compatible way. Also: Pretty sure rust compiles to machine code, which is not very portable, meaning, if you compiled it on an x86/64 box it will just plain not run on the ARM based pi regardless of lib versioning. Hence the need for cross compiling (which a quick look online reveals people have done in this context, ie. rust + pi).– goldilocks ♦Commented Feb 12, 2020 at 18:54
-
1The binary was indeed cross-compiled on an x86/64 machine. I'm not sure at this time how to cross-compile it in a compatible way, but someone else suggested I look into using Docker to help with that so that will probably be my next step.– Dan ForbesCommented Feb 12, 2020 at 18:57
-
Upgrading the standard library is risky, as some programs and libraries may depend on the current version. My recommendation if you need to run newer programs is to install a full chrooted distribution. More– Mohi RostamiCommented Feb 13, 2020 at 6:26
-
I got where I needed to be with the help of this gist: gist.github.com/pepyakin/2ff227c2d837a2eacd8d3879d5e0c94f– Dan ForbesCommented Feb 13, 2020 at 14:38
1 Answer
If glibc
is literally the only library your executable uses, just force the dynamic linker to use the right file with LD_PRELOAD
.
However, what I expect to happen is that your program uses other libraries, and Buster versions of those libraries in turn use glibc
2.28. It could so happen that those libs will work with glibc
2.29, but I wouldn't bet on it.
As you won't be able to link against two different versions of glibc
at the same time, you'll have to recompile all the libs your program uses with glibc
2.29, and then load them all with LD_PRELOAD
. This may well turn to be a non-viable approach in practice, considering the number of dependencies (including recursive ones!) you'll have to consider.
You should really try to use the glibc
2.28 when compiling your app.
-
Thank you for the answer! I've moved on from this project a bit so not sure if I'll be able investigate and accept it or not, but I still really appreciate it. Commented Dec 17, 2020 at 21:32
-
1@DanForbes No problem. Someone referred to this question, and I figured I drop a few lines here as well. Now that glibc moved to version 2.32 I bet nobody will test 2.29 :) Commented Dec 18, 2020 at 15:33