collect2: error: ld returned 1 exit status

Vom einfachen Programm zum fertigen Debian-Paket, Fragen rund um Programmiersprachen, Scripting und Lizenzierung.
Antworten
mgolbs
Beiträge: 259
Registriert: 22.03.2009 18:08:17
Wohnort: Tirschenreuth - Löbau

collect2: error: ld returned 1 exit status

Beitrag von mgolbs » 10.10.2013 17:53:18

Hallo,

habe folgende Meldung beim compilieren einer kleinen ANSI-C Anwendung unter Deb 7:

NoPaste-Eintrag37417

Linkerproblem mit Fehlerausgabe im Terminal, dachte ich... Komisch nur, das der Code 1:1 mit Optionen beim compilieren unter Ubuntu 12.04 funktioniert, Programm erzeugt. Nur warum unter Deb7 nicht und unter 12.04 schon...???

Über Tipps und Infos woran es liegen könnte, wo ich suchen sollte... wäre ich sehr dankbar.


Gruß Markus
Dem Überflüssigen nachlaufen, heißt das Wesentliche verpassen.
Jules Saliège

jkoerner

Re: collect2: error: ld returned 1 exit status

Beitrag von jkoerner » 10.10.2013 20:41:07

Vergleiche einmal die Versionen der verwendeten Compiler miteinander.

mgolbs
Beiträge: 259
Registriert: 22.03.2009 18:08:17
Wohnort: Tirschenreuth - Löbau

Re: collect2: error: ld returned 1 exit status

Beitrag von mgolbs » 11.10.2013 10:57:43

Hallo,

danke für die Rückmeldung.

Unter Debian 7:
golbs@debian7-ha-1861:~/Software$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)
golbs@debian7-ha-1861:~/Software$
unter Ubuntu 12.04 LTS
golbs@CELSIUS-R920-POWER:~$ gcc -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Ziel: x86_64-linux-gnu
Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread-Modell: posix
gcc-Version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
golbs@CELSIUS-R920-POWER:~$
Ich sollte unter Deb7 mal eine ältere gcc Version probieren? Werde mal gcc-4.6 bzw. gcc-4.4 installieren.

Gruß und Dank Markus

PS-Nachtrag
Auch mit:
golbs@debian7-ha-1861:~/Software$ gcc-4.4 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.7-2' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.7 (Debian 4.4.7-2)


golbs@debian7-ha-1861:~/Software$ gcc-4.4 -ansi -std=c99 -g -Wall softtest.c -o softtest -lm
/tmp/ccTnNoxd.o: In function `main':
/home/golbs/Software/softtest.c:187:(.text+0x35): relocation truncated to fit: R_X86_64_32 against symbol `temp' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:191:(.text+0x71): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:193:(.text+0x7b): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:193:(.text+0x8a): relocation truncated to fit: R_X86_64_32S against symbol `Dateiname_ein' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:194:(.text+0x95): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:194:(.text+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `harkomp' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:196:(.text+0xb3): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:198:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `soft_Export' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:200:(.text+0x102): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:206:(.text+0x141): relocation truncated to fit: R_X86_64_PC32 against symbol `harkomp' defined in COMMON section in /tmp/ccTnNoxd.o
/home/golbs/Software/softtest.c:218:(.text+0x179): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
oder
golbs@debian7-ha-1861:~/Software$ gcc-4.6 -v
Using built-in specs.
COLLECT_GCC=gcc-4.6
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14)
golbs@debian7-ha-1861:~/Software$


golbs@debian7-ha-1861:~/Software$ gcc-4.6 -ansi -std=c99 -g -Wall softtest.c -o softtest -lm
/tmp/cceC3yb9.o: In function `main':
/home/golbs/Software/softtest.c:187:(.text+0x34): relocation truncated to fit: R_X86_64_32 against symbol `temp' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:191:(.text+0x70): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:193:(.text+0x7a): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:193:(.text+0xa7): relocation truncated to fit: R_X86_64_32S against symbol `Dateiname_ein' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:194:(.text+0xb2): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:194:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `harkomp' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:196:(.text+0xd0): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:198:(.text+0x141): relocation truncated to fit: R_X86_64_PC32 against symbol `soft_Export' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:200:(.text+0x155): relocation truncated to fit: R_X86_64_32 against symbol `Dateiname_ein' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:206:(.text+0x194): relocation truncated to fit: R_X86_64_PC32 against symbol `harkomp' defined in COMMON section in /tmp/cceC3yb9.o
/home/golbs/Software/softtest.c:218:(.text+0x1cc): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
Kann ich einen anderen gcc überhaupt so ansprechen:?

Code: Alles auswählen

gcc-4.6 -ansi -std=c99 -g -Wall softtest.c  -o softtest -lm
Gruß und Dank Markus
Dem Überflüssigen nachlaufen, heißt das Wesentliche verpassen.
Jules Saliège

nudgegoonies
Beiträge: 939
Registriert: 16.02.2009 09:35:10

Re: collect2: error: ld returned 1 exit status

Beitrag von nudgegoonies » 19.10.2013 10:53:57

Ich würde ja zuerst einen Bug vermuten, aber die Fehlermeldung sagt ja im Prinzip, dass mit dem Memory-Model was nicht stimmt. Sieh Dir mal die beiden stackoverflow Fragen und Antworten an die in Google ganz oben sind wenn Du nach "relocation truncated to fit:" suchst. Wieso Du da aber unter 64 Bit Probleme bekommst kann ich Dir leider nicht sagen.
Soft: Bullseye AMD64, MATE Desktop. Repo's: Backports, kein Proposed, eigene Backports. Grafik: Radeon R7 360 MESA.
Hardware: Thinkstation S20, Intel X58, 16GB, Xeon W3530, BCM5755 NIC, EMU10K1 SND, SATA SSD+HDS und DVD+RW.

Antworten