0

The project I am working on at the minute must be compiled using a cross compiler. My binutils and gcc have been installed into ~/opt/cross, however when I try to compile, I am faced with this error:

/home/george/opt/cross/lib/gcc/i686-elf/6.1.0/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/george/opt/cross/lib/gcc/i686-elf/6.1.0/../../../../i686-elf/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status

My code uses only GCC's freestanding headers (my full compile command: ~/opt/cross/bin/i686-elf-gcc kernel.c tty.c -std=gnu99 -ffreestanding -O2 -Wall -Wextra).

So what is crt0.o and how can I fix this error?

  • 1
    Try adding `-nostdlib -nostdinc`, assuming, of course, that you don't use the C standard library or its includes. – zneak May 24 '16 at 19:02
  • `crt0` is a part of runtime library, implementing (among the others) the standard startup code (entry point) for the application. If you want it to be freestanding without standard libraries, you will have to implement the startup code yourself. Are you doing so? – Eugene Sh. May 24 '16 at 19:03

0 Answers0