Closed thatcppnerd closed 1 year ago
Can you please provide some more information such as
The fact it is looking for crt0 is very questionable to me, in an operating system there is no standard library, indicating you may not be specifying the correct arguments to gcc
Are you specifying -ffreestanding
? Here is an example makefile that compiles assembly/C files using i686-elf-tools
Hello!
I am currently running Linux(Debian). Yes, I unzipped my files from i686-elf-tools-linux.zip The error was from a test of bin/i686-elf-gcc to see if everything was in order.
IDK if this helps, but the exact command executed was "bin/i686-elf-gcc test.c"
BTW, the mentioned test.c program: " int main() { int a = 0; } "
Yo!
Tested same command with -ffreestanding
and -nostdlib
and got an executable!
I think the issue was that I wasn't cross-compiling, but that's just my guess.
You cannot write an operating system by simply defining a main
function. main
is an illusion that is actually invoked by the CRT, which can have various names, but in this case will be called _start
. To get started writing an operating system, I recommend reading the OSDev Wiki. Before you can even get to C you need to write a boot sector for your operating system using assembly. Once you have a boot sector and are ready to start writing the kernel portion in C, you will need to specify -ffreestanding
to i686-elf-gcc
Thanks!
I'm (VERY) new to the os-dev scene, and have spent the past few days trying to find a cross-compiler to compile my kernel. When I first tested gcc I got the following error messages:
"bin/../lib/gcc/i686-elf/7.1.0/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory" "bin/../lib/gcc/i686-elf/7.1.0/../../../../i686-elf/bin/ld: cannot find -lc"
These just seem to be errors pertaining to the linker, but i'm still very confused.
I have made no modifications to my version thus far. Reinstall or find another compiler elsewhere?