2

Here is the step I'm on. Everything has gone fine up to this point, but after replacing the old linker with the new one and making the changes to the specs file, I get the following error when trying to compile dummy.c

 /tools/libexec/gcc/i686-pc-linux-gnu/5.3.0/collect2 -plugin /tools/libexec/gcc/i686-pc-linux-gnu/5.3.0/liblto_plugin.so -plugin-opt=/tools/libexec/gcc/i686-pc-linux-gnu/5.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cciBczi2.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /tools/lib/gcc/i686-pc-linux-gnu/5.3.0/crtbegin.o -L/tools/lib/gcc/i686-pc-linux-gnu/5.3.0 -L/tools/lib/gcc/i686-pc-linux-gnu/5.3.0/../../../../i686-pc-linux-gnu/lib /tmp/ccxbWIWi.o "" -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /tools/lib/gcc/i686-pc-linux-gnu/5.3.0/crtend.o /usr/lib/crtn.o
/tools/lib/gcc/i686-pc-linux-gnu/5.3.0/../../../../i686-pc-linux-gnu/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status

After a lot of google searching, I've seen other posts about similar problems at the same stage, but all of those errors refer to specific files that are missing (usually crt*.o files), but this error is different and perplexing in that it doesn't actually list a file it can't find. I've made sure ld and the various links to it exist and do things when you invoke them. I've even cut and pasted the directory into a cd command and it does work (I was originally thrown off by the /../../../../ in the path but it seems to work so okay). What file is missing or not being found by collect2?

4
  • 1
    ... Did you miss the empty pair of double quotes in the command line? Jul 16, 2016 at 23:33
  • Can you get ld to output verbose? Also ld usually prints the name of the missing file after that error, so it appears to be looking for a file called : might be worth checking if you've got an extra colon in there somewhere.
    – GregHNZ
    Jul 16, 2016 at 23:34
  • @GregHNZ No, it's looking for an empty filename because of this part: ... /tmp/ccxbWIWi.o "" -lgcc ...
    – melpomene
    Jul 16, 2016 at 23:53
  • Since that part is generated by gcc/ld, I'm not sure where it's coming from. Jul 16, 2016 at 23:59

1 Answer 1

2

The problem was an extra space in the command issued to compile the file.

The correct command is: cc dummy.c -v -Wl,--verbose &>dummy.log

What I entered was: cc dummy.c -v -Wl, --verbose &>dummy.log

That very small difference meant four hours of hair pulling. Thank you to everyone who offered help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.