OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:28 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: GCC cross compiler setting up. No includes files in inc dir
PostPosted: Mon Oct 24, 2022 6:56 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: GCC cross compiler setting up. No includes files in inc
PostPosted: Mon Oct 24, 2022 7:11 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 812
Location: Hyperspace
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


Top
 Profile  
 
 Post subject: Re: GCC cross compiler setting up. No includes files in inc
PostPosted: Mon Oct 24, 2022 8:24 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
That's not an error. There should be no include files. You supply your own when you create libraries.


Top
 Profile  
 
 Post subject: Re: GCC cross compiler setting up. No includes files in inc
PostPosted: Mon Oct 24, 2022 9:43 am 
Offline
Member
Member

Joined: Mon Aug 27, 2018 12:50 pm
Posts: 54
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group