c++ - Compiling with -static-libgcc -static-libstdc++ still results in dynamic dependency on libc.so -
I am trying to make an executable which is probably portable, after removing some dependency, During binary running, the following came in:
/ lib / x86_64-linux-gnu / libm so much .6: version 'GLIBC_2. 15 'not found (required by FOB) /lib/x86_64-linux-gnu/libc.so.6: version' GLIBC_2.15 'not found (required by phob) / lib / x86_64- Linux-gnu / libc.so. 6: version 'GLIBC_2.14' not found (required by FOB) I like my binary that the user does not need to upgrade their version libc , so I want to remove this dependency equally I am Linkar flags which used to produce the above binary already include -static-libgcc -static-libstdc ++ . How does binary still need to share libc.so.6 ? I also tried to add the -static flag, but when I try that is very strange to run binary: $ ls -l foob -rwxr-xr-x 1 claudiu claudiu 13278191 10 October 13:03 foob $ ./foob bash: ./foob: such What should a file or directory do?
Edit:
$ file foob foob: ELF 64-bit LSB executable, x86-64, version 1 ( GNU / Linux), GNU / Linux 2.6.24, BuildID [RA 1] = 5 ADA 9A 598 B9261A 29F1C7B for Dynamically Linked (uses shared lbs) 0 FFDADCFC 72197 CD7, Stress-F. / FOF Exhaave (". / FOB", [". / FOB"], [/ * 64Wars * /]) 1 ENOENT (no such file or directory) (2, "Stress: F: Such a file Or d ... ", 40strace: exec: no such file or directory) = 40 exit_group (1) =? +++ 1 +++ If I ldd version without -static , There are two less entries than the version with -static in it, that is: < Code> Libstdc ++.6 = & gt; /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4f420c1000) libgcc_s.so.1 = & gt; /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4f41636000)
GNU Libashi is not designed to be connected statically, for example, important tasks, eg gethostbyname and iconv , malfunction in a stable binary or will not work under certain conditions, under some conditions, a fixed binary dynamically open and Libc.so.6 , although the whole situation of stable relationships is to avoid such dependency. You should compile your program instead.
(This is true for at least 15 years.)
Comments
Post a Comment