Build cross compiler but when compiling include error linux

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
yerri07
Member
Member
Posts: 26
Joined: Sat Apr 29, 2017 6:56 am

Build cross compiler but when compiling include error linux

Post by yerri07 »

I build a cross compiler i successfully installed but when compiling include error appearing.
$ i686-elf-gcc main.c -o main
main.c:1:10: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^~~~~~~~~
compilation terminated.


I installed in $HOME/opt/cross when i run command i686-elf-gcc main.c -o main
Error command not found
Last edited by yerri07 on Wed May 24, 2017 2:56 am, edited 2 times in total.
mallard
Member
Member
Posts: 280
Joined: Tue May 13, 2014 3:02 am
Location: Private, UK

Re: Build cross compiler but when compiling include error li

Post by mallard »

You obviously haven't ported/written a C standard library for your OS/kernel. Do you think the functions in "stdio.h" will "magically" know how to operate your device/file I/O implementation?

Remove the "#include" and see which functions are needed. Implement them. Problem solved.
Image
yerri07
Member
Member
Posts: 26
Joined: Sat Apr 29, 2017 6:56 am

Re: Build cross compiler but when compiling include error li

Post by yerri07 »

I didn't created the code for Kernel . i just wanted to test the gcc is working or not?. When i compiled without header got


Error command not found
Last edited by yerri07 on Wed May 24, 2017 2:57 am, edited 1 time in total.
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Re: Build cross compiler but when compiling include error li

Post by davidv1992 »

You seem to be missing the main point of the cross compiler. It is build such that it does depend on any external runtime. In particular, this means that it is completely unsuited for building programs for your current OS, as it misses the runtime support for that.
yerri07
Member
Member
Posts: 26
Joined: Sat Apr 29, 2017 6:56 am

Re: Build cross compiler but when compiling include error li

Post by yerri07 »

I know it is not intended for the current Os. My question is Not able to compile and command not found errors
mallard
Member
Member
Posts: 280
Joined: Tue May 13, 2014 3:02 am
Location: Private, UK

Re: Build cross compiler but when compiling include error li

Post by mallard »

"$HOME/opt/cross" is probably not in your PATH. "stdio.h" is part of the C standard library.

If that doesn't give you enough information to solve your problems, you lack the prerequisite knowledge and experience required for OS development.
Image
yerri07
Member
Member
Posts: 26
Joined: Sat Apr 29, 2017 6:56 am

Re: Build cross compiler but when compiling include error li

Post by yerri07 »

I know stdio.h is the c library . Any way i know how to compile Kernel and what to do. I thought c library are installed too, i found those are not installed in opt/cross folder.


Any way thanks for the reply and concern. Have a great day
mallard
Member
Member
Posts: 280
Joined: Tue May 13, 2014 3:02 am
Location: Private, UK

Re: Build cross compiler but when compiling include error li

Post by mallard »

yerri07 wrote:i found those are not installed in opt/cross folder.
Correct. They don't exist by "magic". You must create them (or the bits of them that you need).
Image
Post Reply