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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
AwfulMint
Member
Member
Posts: 35
Joined: Wed Nov 01, 2017 7:41 pm

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

Post 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! ;-;
OS Development is awesome!

|AetherOS Project|
StudlyCaps
Member
Member
Posts: 232
Joined: Mon Jul 25, 2016 6:54 pm
Location: Adelaide, Australia

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

Post 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.
AwfulMint
Member
Member
Posts: 35
Joined: Wed Nov 01, 2017 7:41 pm

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

Post 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)
OS Development is awesome!

|AetherOS Project|
AwfulMint
Member
Member
Posts: 35
Joined: Wed Nov 01, 2017 7:41 pm

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

Post by AwfulMint »

****, I have the file in /usr/include :/
Image
OS Development is awesome!

|AetherOS Project|
Octocontrabass
Member
Member
Posts: 5586
Joined: Mon Mar 25, 2013 7:01 pm

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

Post 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.
AwfulMint
Member
Member
Posts: 35
Joined: Wed Nov 01, 2017 7:41 pm

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

Post by AwfulMint »

I'm trying to make a Hosted Cross-Compilerq
OS Development is awesome!

|AetherOS Project|
AwfulMint
Member
Member
Posts: 35
Joined: Wed Nov 01, 2017 7:41 pm

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

Post 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?
OS Development is awesome!

|AetherOS Project|
StudlyCaps
Member
Member
Posts: 232
Joined: Mon Jul 25, 2016 6:54 pm
Location: Adelaide, Australia

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

Post 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.
Post Reply