-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
relocation error: symbol pthread_sigmask version GLIBC_2.2.5 not defined in file libc.so.6 with link time reference #7667
Comments
|
@daurnimator found this: https://sourceware.org/pipermail/glibc-cvs/2020q2/069412.html TL;DR: as of |
Sure:
|
Hmm, is there any way to workaround this? |
I also faced this issue (and suspect the same underlying cause) but was unable to find a reasonable workaround. |
I am getting this too on an internal project (which requires use of glibc 2.19):
+1 on "would be nice to find a reasonable workaround". I will try to find some time to read about linkers and hopefully find one. |
It seems that the problem might be related more to dynamically loaded libraries and incorrect symbol mapping to library from zig side. Minimal reproducible c code example in debian jessie: #define _GNU_SOURCE
#include <dlfcn.h>
int main()
{
void *lib = dlopen("./libshared.so", RTLD_LAZY);
void (*exported_func)(void);
exported_func = (void (*)(void))dlsym(lib, "exported_func");
exported_func();
return 0;
}
zig cc --target=x86_64-linux-gnu.2.19 -c -Wall -Werror -fpic sharedlib.c -o sharedlib.o
zig cc -shared -o libshared.so sharedlib.o -lpthread #include <signal.h>
#include <stdio.h>
void exported_func()
{
printf("Address of pthread_sigmask: %p\n", pthread_sigmask);
} Output of
It seems that zig maps pthread_sigmask to
I assume that this edge case where a symbol can move between libraries might be overlooked and would need to be fixed by either having a separate |
@mjonaitis1 thanks for looking into this. Your suggested solution seems reasonable to me. |
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower that glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower that glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower that glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower than glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt files based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower than glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt files based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower than glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt files based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower than glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt files based on glibc version.
Currently, zig cc has a flaw: it cannot detect when a symbol is moved between libraries. Example: pthread_sigmask was moved from libpthread to libc since glibc-2.32. As symbol mapping files that are generated using update_glibc.zig tool are based on latest glibc version, compiling for targets with lower than glibc-2.32 version results in pthread_sigmask being linked with libc instead of libpthread. This causes a relocation error ziglang#7667 This commit adds versioning for (fns|abi|vers).txt files based on glibc version.
This commit upgrades glibc shared library stub-creating code to use the new abilists file which is generated by the new glibc-abi-tool project: https://github.com/ziglang/glibc-abi-tool/ The abilists file is different in these ways: * It additionally encodes whether a symbol is a function or an object, and if it is an object, it additionally encodes the size in bytes. * It additionally encodes migrations of symbols from one library to another between glibc versions. * It is binary data instead of ascii. * It is one file instead of three. * It is 165 KB instead of 200 KB. This solves a handful of bugs. Fixes #5882 Fixes #7667 Fixes #8714 Fixes #8896
This commit upgrades glibc shared library stub-creating code to use the new abilists file which is generated by the new glibc-abi-tool project: https://github.com/ziglang/glibc-abi-tool/ The abilists file is different in these ways: * It additionally encodes whether a symbol is a function or an object, and if it is an object, it additionally encodes the size in bytes. * It additionally encodes migrations of symbols from one library to another between glibc versions. * It is binary data instead of ascii. * It is one file instead of three. * It is 165 KB instead of 200 KB. This solves three bugs: Fixes #7667 Fixes #8714 Fixes #8896
This commit upgrades glibc shared library stub-creating code to use the new abilists file which is generated by the new glibc-abi-tool project: https://github.com/ziglang/glibc-abi-tool/ The abilists file is different in these ways: * It additionally encodes whether a symbol is a function or an object, and if it is an object, it additionally encodes the size in bytes. * It additionally encodes migrations of symbols from one library to another between glibc versions. * It is binary data instead of ascii. * It is one file instead of three. * It is 165 KB instead of 200 KB. This solves three bugs: Fixes #7667 Fixes #8714 Fixes #8896
Encountered this error while trying to run CI tests on Github Actions for a Zig project, using the Zig nightly bundle provided here: https://ziglang.org/builds/zig-linux-x86_64-0.7.1+dfacac916.tar.xz. Linking with musl makes the problem go away.
The latest glibc version available in Github Actions is 2.27.
Reproduction requires an 18.2GB Docker image that emulates the Github Actions CI Environment, which can be found here: https://hub.docker.com/layers/nektos/act-environments-ubuntu/18.04/images/sha256-4d991875312e2ad084ff5350aa193e8a7dbdc4c144476d48df6a69e1e3404427
References to
pthread
symbols in built executable:The text was updated successfully, but these errors were encountered: