Page 1 of 1

Error in GCC building. <stdio.h> not found?

Posted: Tue Nov 21, 2017 6:00 pm
by AwfulMint
I make a search in GCC folder and I found alot of stdio.h files in it so how THEY CANT FIND IT? Here's the pick, all selected files are stdio.h files:
Image

Here's the Cygwin window printscr:
Image

Plz help me m8s! ;-;

Re: Error in GCC building. <stdio.h> not found?

Posted: Tue Nov 21, 2017 6:08 pm
by StudlyCaps
On second look, you are trying to build the cross-compiler, not the OS. My mistake.

Still, the stdio.h in your gcc directory is not the file that the compiler is looking for. The correct file should be in /usr/include. It appears your cygwin installation is missing this necessary file. I'm not very familiar with cygwin, but this SO post here indicates that you need to install the package cygwin-devel to install the standard c headers.

Wrong info: Presumably you are using a cross compiler to build your OS?

In this case, the compiler will not look for stdio.h in your gcc files, but will expect you to make your own stdio.h and tell the compiler where to find it using a custom include path. This is intentional, as the stdio in gcc will be for your host OS, not for your new OS.

Re: Error in GCC building. <stdio.h> not found?

Posted: Tue Nov 21, 2017 6:45 pm
by AwfulMint
Thanks m8 I'll try here, an extra info for ya: I'm building a cross-compiles who target mah OS :D, I'm using $HOME/AetherOS/sysroot as sysroot but I don't have a libc created or ported in it. I'll port Newlib after compiling the compiler (lol)

Re: Error in GCC building. <stdio.h> not found?

Posted: Tue Nov 21, 2017 6:49 pm
by AwfulMint
****, I have the file in /usr/include :/
Image

Re: Error in GCC building. <stdio.h> not found?

Posted: Wed Nov 22, 2017 11:05 am
by Octocontrabass
Are you trying to build a freestanding cross-compiler or a hosted cross-compiler? You can't build a hosted cross-compiler until after you have a C library for your OS's userspace.

Re: Error in GCC building. <stdio.h> not found?

Posted: Wed Nov 22, 2017 5:43 pm
by AwfulMint
I'm trying to make a Hosted Cross-Compilerq

Re: Error in GCC building. <stdio.h> not found?

Posted: Wed Nov 22, 2017 5:45 pm
by AwfulMint
AAAAH now I understand so I need to port Newlib or create mah libc so after this I can build mah hosted CC?

Re: Error in GCC building. <stdio.h> not found?

Posted: Wed Nov 22, 2017 9:56 pm
by StudlyCaps
Ah, OK. Do you need a hosted compiler?
It is recommended that you only build a hosted compiler once you are quite far advanced in you OS project and are ready to start porting already existing programs to your OS. Once you have built a freestanding compiler (follow instructions here) you can already write and compile code to run on the bare metal, and you can start on your kernel. You don't need a hosted compiler for that.