Gcc collect2: fatal error: cannot find 'ld'

Viewed 29258

I'm going through the tutorial on making an OS on http://wiki.osdev.org/Bare_Bones. When I try to link boot.o and kernel.o using this command: i686-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc , I just get this error:

collect2: fatal error: cannot find 'ld'
compilation terminated.

I just installed fresh Ubuntu 15.10 that with gcc-5.2.1 and binutils-2.25.1 . I have searched the internet for answers but nothing helped.

3 Answers

I also got once the same error during a pentest while I was trying to compile my exploit on the victim server.

In my case, the directory where the "ld" program was located had not been defined in the PATH environment variable, so I simply added it.

eg. export PATH=$PATH:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin

I searched a lot to fix this issue and nothing worked but lastly i uninstalled MinGw and reinstalled it then did edited the environment variables again and then uninstalled and reinstalled vs code extensions then it worked.

Related