Compiling a program with '-Wl,-Bstatic -lc' option is failed due to libgcc_s.so.1 or an STT_GNU_IFUNC symbol in libc.a
Issue
-
Compiling a program is failed with the following error.
# gcc -Wl,-Bstatic -lc test.c /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find -lgcc_s collect2: error: ld returned 1 exit status
# gcc -Wl,-Bstatic -lc -Wl,-Bdynamic -lgcc_s test.c /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie collect2: error: ld returned 1 exit status
Environment
- Red Hat Enterprise Linux 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.