2017-05-24 3 views
0

Ich habe ein Problem mit Bibliotheken auf CentOS. Ich bin mir nicht sicher, was falsch ist. Wenn ich versuche, ein Projekt zu machen, bekomme ich diesen Fehler:Linker kann Standard-C-Bibliothek nicht finden

gcc -Wall -Winline -O2 -fPIC -g -D_FILE_OFFSET_BITS=64 -o bzip2 bzip2.o -L. -lbz2 
/usr/bin/ld: cannot find -lc 
collect2: error: ld returned 1 exit status 

ich kann - und habe - einen Symlink machen, die /usr/lib64/libc.so zu /usr/lib64/libc-2.17.so verbindet, die vorhanden ist, aber das schafft nur einen weiteren Fehler:

gcc -Wall -Winline -O2 -fPIC -g -D_FILE_OFFSET_BITS=64 -o bzip2 bzip2.o -L. -lbz2 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crt1.o: In function `_start': 
(.text+0x12): undefined reference to `__libc_csu_fini' 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crt1.o: In function `_start': 
(.text+0x19): undefined reference to `__libc_csu_init' 
collect2: error: ld returned 1 exit status 

Offensichtlich ist die Toolchain kaputt. Wie kann ich es richtig beheben? Symlinks macht offensichtlich nichts Fixierung ...

Ich versuchte auch ganze Entwicklung mit Toolchain yum group remove "Development Tools" dann yum group install "Development Tools"

+0

Sollten Sie nicht mit 'g ++' kompilieren? – Rakete1111

+0

@ Rakete1111 Nein, es ist eine C-Bibliothek. Das Makefile gehört nicht mir. Das Problem ist, dass die ganze gcc toolchain kaputt ist. Ich habe es ohne Erfolg neu installiert. –

+0

@ TomášZato Denken Sie daran, dass die Reihenfolge wichtig ist, wenn Sie die Bibliotheken angeben. –

Antwort

1

/usr/lib64/libc.so ist keine symbolische Verbindung, es ist ein Linker-Skript neu zu installieren.

auf Fedora enthält:

/* GNU ld script 
    Use the shared library, but some functions are only in 
    the static library, so try that secondarily. */ 
OUTPUT_FORMAT(elf64-x86-64) 
GROUP (/lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED (/lib64/ld-linux-x86-64.so.2)) 

Und sicher genug:

$ nm -C --defined-only /usr/lib64/libc_nonshared.a 

elf-init.oS: 
0000000000000070 T __libc_csu_fini 
0000000000000000 T __libc_csu_init 
... 

/usr/lib64/libc.so gehört glibc Umdrehungen pro Minute. Ich schlage vor, es neu zu installieren.

+0

Danke, ich werde versuchen, 'glibc' erneut zu installieren. –