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
Build cross compiler but when compiling include error linux
Build cross compiler but when compiling include error linux
Last edited by yerri07 on Wed May 24, 2017 2:56 am, edited 2 times in total.
Re: Build cross compiler but when compiling include error li
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.
Remove the "#include" and see which functions are needed. Implement them. Problem solved.
Re: Build cross compiler but when compiling include error li
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
Error command not found
Last edited by yerri07 on Wed May 24, 2017 2:57 am, edited 1 time in total.
-
- Member
- Posts: 223
- Joined: Thu Jul 05, 2007 8:58 am
Re: Build cross compiler but when compiling include error li
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.
Re: Build cross compiler but when compiling include error li
I know it is not intended for the current Os. My question is Not able to compile and command not found errors
Re: Build cross compiler but when compiling include error li
"$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.
If that doesn't give you enough information to solve your problems, you lack the prerequisite knowledge and experience required for OS development.
Re: Build cross compiler but when compiling include error li
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
Any way thanks for the reply and concern. Have a great day
Re: Build cross compiler but when compiling include error li
Correct. They don't exist by "magic". You must create them (or the bits of them that you need).yerri07 wrote:i found those are not installed in opt/cross folder.