GCC Cross Compiler - fenv.h: No such file or directory

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
Lilas
Posts: 2
Joined: Fri Sep 06, 2013 7:38 am

GCC Cross Compiler - fenv.h: No such file or directory

Post by Lilas »

Hi!

I am new in osdev and I was following the GCC_Cross-Compiler tutorial, with x86_64-linux-gnu as host and target, building gcc-4.7.2 and binutils-2.22.

uname -a
Linux roquefort 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

I built the binutils-2.22 without problems.

But when I execute the following command:
> make all-target-libgcc

I got this error:

/home/helen/cross_os/build-gcc-4.7.2/./gcc/xgcc -B/home/helen/cross_os/build-gcc-4.7.2/./gcc/ -B/home/helen/opt/cross/x86_64-linux-gnu/bin/ -B/home/helen/opt/cross/x86_64-linux-gnu/lib/ -isystem /home/helen/opt/cross/x86_64-linux-gnu/include -isystem /home/helen/opt/cross/x86_64-linux-gnu/sys-include -g -O2 -m32 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -fpic -I. -I. -I../../.././gcc -I../../../../gcc-4.7.2/libgcc -I../../../../gcc-4.7.2/libgcc/. -I../../../../gcc-4.7.2/libgcc/../gcc -I../../../../gcc-4.7.2/libgcc/../include -I../../../../gcc-4.7.2/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o bid_decimal_globals.o -MT bid_decimal_globals.o -MD -MP -MF bid_decimal_globals.dep -c ../../../../gcc-4.7.2/libgcc/config/libbid/bid_decimal_globals.c
../../../../gcc-4.7.2/libgcc/config/libbid/bid_decimal_globals.c:47:18: fatal error: fenv.h: No such file or directory

I searched in other sites and some of them says to use the --disable-decimal-float flag, but I am not sure if I should use this flag.

Thanks in advance
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: GCC Cross Compiler - fenv.h: No such file or directory

Post by jnc100 »

We normally recommend the 'x86_64-elf' target for a cross compiler you wish to use for osdev work.

I'd imagine the x86_64-linux-gnu target expects a full working glibc in your cross compile directory. If instead you were trying to build a compiler for a minimal linux system, then the instructions at Linux From Scratch are probably more useful.

Regards,
John.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: GCC Cross Compiler - fenv.h: No such file or directory

Post by sortie »

Hi,

If you set --target=???-linux-gnu, then you are not building a cross-compiler. You are just building a regular compiler. The entire idea of that tutorial is to set --target=something-that-is-not-linux-but-a-generic-target-or-your-os. Additionally, if you are new, starting out with x86_64 is likely a bad idea. The bare bones tutorial (as it is right now) only works on a 32-bit x86 system, which is why you are told to use i586.

If you are new to this, follow the instructions in the tutorials. Bad things are going to happen otherwise, such as this problem you ran into. x86_64 is in particular problematic for newcomers because GRUB doesn't boot x86_64 kernels directly and you need to set up paging and long mode manually through a fake 32-bit kernel, yada yada yada - i586 is a fine start in my opinion and once you get a bit further, adding x86_64 support isn't that bad.
Lilas
Posts: 2
Joined: Fri Sep 06, 2013 7:38 am

Re: GCC Cross Compiler - fenv.h: No such file or directory

Post by Lilas »

Hi!

Thanks for your reply guys.

I used x86_64-linux-gnu instead of x86_64-elf as target, it was a lack of attention on my part, thanks.

As I am following the bare bone tutorial, I built the i586-elf without errors, but I didn't know that GRUB doesn't boot x86_64 kernels directly, there is any tutorial or link you can suggest me to get more informations about this?

Thanks.
Post Reply