编译时出错,collect2:找不到ld

编译时出错,collect2:找不到ld,c,gcc,ld,C,Gcc,Ld,可能有人遇到了此问题,我有收集2:尝试时找不到'ld'错误: gcc -v -pthread -I /tmp/usr/include -no-use-gold-linker /tmp/teeest.c -o /tmp/teeest > /tmp/ok.log 2>/tmp/error.log 输出: Using built-in specs. gcc: unrecognized option '-no-use-gold-linker' Target: x86_64-redhat-

可能有人遇到了此问题,我有收集2:尝试时找不到'ld'错误:

gcc -v -pthread -I /tmp/usr/include -no-use-gold-linker /tmp/teeest.c -o /tmp/teeest > /tmp/ok.log  2>/tmp/error.log
输出:

Using built-in specs.
gcc: unrecognized option '-no-use-gold-linker'
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-pthread' '-I' '/tmp/usr/include' '-no-use-gold-linker' '-o' '/tmp/teeest' '-mtune=generic'
 /usr/libexec/gcc/x86_64-redhat-linux/4.4.7/cc1 -quiet -v -I /tmp/usr/include -iprefix ../lib/gcc/x86_64-redhat-linux/4.4.7/ -D_REENTRANT /tmp/teeest.c -quiet -dumpbase teeest.c -mtune=generic -auxbase teeest -version -o /tmp/ccVr6ozd.s
ignoring nonexistent directory "../lib/gcc/x86_64-redhat-linux/4.4.7/include"
ignoring nonexistent directory "../lib/gcc/x86_64-redhat-linux/4.4.7/include-fixed"
ignoring nonexistent directory "../lib/gcc/x86_64-redhat-linux/4.4.7/../../../../x86_64-redhat-linux/include"
ignoring nonexistent directory "../lib/../lib/gcc/x86_64-redhat-linux/4.4.7/include"
ignoring nonexistent directory "../lib/../lib/gcc/x86_64-redhat-linux/4.4.7/include-fixed"
ignoring nonexistent directory "../lib/../lib/gcc/x86_64-redhat-linux/4.4.7/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /tmp/usr/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.4.7 20120313 (Red Hat 4.4.7-17) (x86_64-redhat-linux)
    compiled by GNU C version 4.4.7 20120313 (Red Hat 4.4.7-17), GMP version 4.3.1, MPFR version 2.4.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d2ae160e13b93f509f25a064aa53b455
COLLECT_GCC_OPTIONS='-v' '-pthread' '-I' '/tmp/usr/include' '-no-use-gold-linker' '-o' '/tmp/teeest' '-mtune=generic'
 as -V -Qy -o /tmp/ccCIoBhH.o /tmp/ccVr6ozd.s
GNU assembler version 2.20.51.0.2 (x86_64-redhat-linux) using BFD version version 2.20.51.0.2-5.44.el6 20100205
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.4.7/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.4.7/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.4.7/:../lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:../lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-pthread' '-I' '/tmp/usr/include' '-no-use-gold-linker' '-o' '/tmp/teeest' '-mtune=generic'
 /usr/libexec/gcc/x86_64-redhat-linux/4.4.7/collect2 --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /tmp/teeest /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.7 -L../lib/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L../lib /tmp/ccCIoBhH.o -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtend.o /usr/lib/../lib64/crtn.o
collect2: cannot find 'ld'
检查$PATH

/usr/local/bin:/bin:/usr/bin
我试着在C in/tmp dir上编译hello world应用程序。
CentOS 6,2016,2.6.32-642.1.1.el6.x86_64,x86_64

它在不使用未知选项的情况下工作吗?
-不使用黄金链接器
=>。您的命令行看起来比“简单的hello world”复杂一点,为什么不先尝试一下
gcc foo.c
,看看它给您带来了什么?因为它是工作区中成员的虚拟机。我没有root权限,这不是factoring选项,只是针对C库。但是关于ld binary的问题…,option是未知的=>不分解,没有option也不起作用。hellow,'gcc-v-I/tmp/usr/include/tmp/teest.c-o/tmp/teest>/tmp/ok.log 2>/tmp/error.log'给出相同的结果,-I选项用于标准库的include目录(这是代码,前面的步骤,这是成功的)下一个就是-stdout&stderror。我试过了。对不起,我不明白你的评论。您不需要root权限即可自行执行
gcc
。只需打开一个终端,进入你的目录,键入
gcc yourCode.c
(请确保实际使用你的源代码文件而不是'yourCode.c'。“#eto pizdez”:D。关于答案:你去掉了那个古怪的参数,应该是它,因为
PATH=$PATH
绝对没有用。
PATH=$PATH; export PATH; gcc -v -pthread -I /tmp/usr/include /tmp/test.c -o /tmp/test > /tmp/ok.log  2>/tmp/error.log; #eto pizdez
PATH=$PATH; export PATH; gcc -v -pthread -I /tmp/usr/include /tmp/test.c -o /tmp/test > /tmp/ok.log  2>/tmp/error.log; #eto pizdez