this happens on redhat-6.0 with egcs-1.1.2-12 installed: $ mkdir foo $ cd foo $ echo 'main(){return 0;}' > bar.c $ /usr/bin/gcc -o bar bar.c $ mkdir ld $ /usr/bin/gcc -o bar bar.c collect2: ld returned 33 exit status
Do you have the current directory in your path?
yes, my PATH begins with ":". schludi
Jeffrey A Law <law> writes: > Take "." out of your path. Or at least put it at the end of your > path. You're > a wonderful candidate for a trojan horse right now. > > jeff I know that if PATH begins with ":", someone evil could do me some harm. But this is what I want (as non-root user)! If I say: $ mkdir man $ type man man is /usr/bin/man this is what I expect. Since the directory "man" is not an "program" (though it has "x" bits) "type" ignores it. I think this is what gcc should do when it searches for "ld". regards, schludi
One could argue that gcc should behave like "type" and ignore directories, but I can't say I see a big problem with the current behavior.
The good news is that this has been fixed in the GCC development version (2.96; Ian Lance Taylor's change of 4 Aug 1999). The bad news is that this GCC won't ship with Red Hat Linux for a while, due to C++ incompatibilities.
*** Bug 5647 has been marked as a duplicate of this bug. *** If there is a directory called "ld" in the current directory, and your PATH searches the current directory before other directories, the command "gcc x.c -o x" fails with: "collect2: ld returned 33 exit status". The problem probably exists on all architectures and may occur under other circumstances. I have only tested it on RH6.0 x86. Found while trying to run configure in binutils.