GCC cross compiler setting up. No includes files in inc dir

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
buridan
Posts: 2
Joined: Tue Dec 28, 2021 1:50 am

GCC cross compiler setting up. No includes files in inc dir

Post by buridan »

Hi!

I tried to setting up gcc cross-compilation enviroment with this tutorial: https://wiki.osdev.org/GCC_Cross-Compiler
But after all these steps, I have a problem:
There is no include files in dir: /home/$(username)/opt/cross/include/
So when I try to include string.h header, I have a problem.

I am using this script:

Code: Select all

ARG_PREFIX ="$HOME/opt/cross"
ARG_TARGET =i686-elf
ARG_GCC_VERSION="9.5.0"

cd build-gcc
echo "Start building gcc{$ARG_GCC_VERSION, $ARG_TARGET}"
../deps/gcc-$ARG_GCC_VERSION/configure \
	--target=$ARG_TARGET \
	--prefix=$ARG_PREFIX \
	--disable-nls \
	--enable-languages=c,c++ \
	--without-headers

make all-gcc
make install-gcc
make all-target-libgcc
make install-target-libgcc
#make install-gcc
cd ..
I don't see any error in make logs(https://drive.google.com/file/d/1LDaaOz ... sp=sharing)
User avatar
eekee
Member
Member
Posts: 891
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: GCC cross compiler setting up. No includes files in inc

Post by eekee »

Doesn't string.h come from the standard library, libc? libc is separate from the compiler.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: GCC cross compiler setting up. No includes files in inc

Post by iansjack »

That's not an error. There should be no include files. You supply your own when you create libraries.
Barry
Member
Member
Posts: 54
Joined: Mon Aug 27, 2018 12:50 pm

Re: GCC cross compiler setting up. No includes files in inc

Post by Barry »

When you build GCC and Binutils you can specify a target, in your case i686-elf. Both of those programs have a known set of targets that have different settings, among them an include directory. This is the directory that is searched if you do #include <something.h>. i686-elf doesn't have one by default, but GCC can provide some inbuilt headers still - see gcc/include/ in your build directory. You get given headers like stdint, stddef, stdarg that don't rely on the C library i.e. they don't actually link to anything, just provide definitions. string.h requires libc functions e.g. memcpy() and as such, you have to provide that header with your libc. To do this, either make your own libc or use a publicly available one like newlib.

Thanks,
Barry
Post Reply