-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Followed Readme, binary still contains GLIBC_2.33 funcs #32
Comments
Maybe a workaround might be: #define _GNU_SOURCE
#include <dlfcn.h>
#include <fcntl.h>
#define REDIRECT(RET, NAME, T2) \
RET \
NAME (const char *path, T2 A2) \
{ \
RET (*_NAME) (const char *path, T2 A2); \
RET result; \
_NAME = (RET (*)(const char *path, T2 A2)) dlsym (RTLD_NEXT, #NAME); \
result = _NAME (path, A2); \
return result; \
}
REDIRECT(int, stat, struct stat *)
REDIRECT(int, stat64, struct stat64 *)
REDIRECT(int, lstat, struct stat *)
REDIRECT(int, lstat64, struct stat64 *)
REDIRECT(int, fstat, struct stat *)
REDIRECT(int, fstat64, struct stat64 *) |
Hmm I see what you are saying. Sounds like an older glibc on my host might fix it, I'll have to spin up a VM to try that. I tried adding the workaround to the Then I reconfigured with First there are a ton of errors about redefining
But its just a warning, so I pressed on. Unfortunately the workaround doesn't quite work:
|
You have to embed the snippet into your own source code - somewhere at the very beginning. I tried it and it seemed to work. However I am not using it because with glibc_2.34 and newer the approach in general does not work anymore because of the new I would say don't waste your time trying to get it working with glibc_2.33 ;) |
Any update on this? This looked among the most promising approaches. |
I was having problem with |
Update: I gave up and am now setting up compilation in a Docker container based on ubuntu:18.04, to get an old glibc. I'm using llvm with clang-17 to get a modern compiler. The LLVM compiler suite is godsent here, thanks to their ubuntu:18.04 apt repository for the latest clang version. |
I managed to redirect the *stat functions (this example is only for stat() and fstat()):
But I'm indeed stuck on redirecting the |
Actually, figured out that part as well. This is now a program using stat(), compiled on a glibc 2.39 system, referencing only symbols in
Compile with:
I've successfully implemented this in a (simple, dependency-free) program: mid-kid/metroskrew@e382cae |
Just messing around with trying to learn how to compile compatible binaries. I'm working with socat for now:
And if I take the binary from my 22.04 system to an other 18.04 I get the error:
So I build with the provided header:
But my produced binary still has 2.33 symbols in it:
What am I doing wrong?
The text was updated successfully, but these errors were encountered: