Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gcc collect2: fatal error: cannot find 'ld'

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.

like image 933
XXO2 Avatar asked Mar 13 '16 13:03

XXO2


1 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

like image 121
Lord Boval Avatar answered Sep 19 '22 15:09

Lord Boval