Page 1 of 1
Missing stdint.h
Posted: Tue Jun 05, 2012 9:52 am
by rhughes
Hello All
I am running Ubuntu 12.04 x64
I have (apparently) completed Step 1 of setting up a Cross Compiler as defined here:
http://wiki.osdev.org/GCC_Cross-Compiler
When I try to compile the Kernel.c code described here:
http://wiki.osdev.org/Bare_Bones
I get the attached error.
I have actioned: make all-target-libgcc
make install-target-libgcc
So I am guessing it is a directory error of some sort.
I am more of a Windows person than Linux so forgive me if this is a simple issue to solve.
Thank you all very much for your help,
Richard Hughes
Re: Missing stdint.h
Posted: Tue Jun 05, 2012 10:35 am
by Love4Boobies
The problem is actually with the
GCC Cross-Compiler article. The
Bare Bones tutorial was recently updated to use the freestanding library for portability reasons, yet the GCC cross-compiler is built using the --without-headers flag. I'm not sure whether there's a configuration flag to instruct only the installation of the freestanding library or whether it needs to be installed separately but I will take a look and update the wiki accordingly. In the meantime, you can temporarily write your own implementation of <stdint.h> (for the purposes of that tutorial, it only needs to have "typedef unsigned int uint32_t;" --- note that this is specific to the GCC cross-compiler you have built, don't expect it to work everywhere) or use one of
these libraries.
Re: Missing stdint.h
Posted: Tue Jun 05, 2012 6:35 pm
by Love4Boobies
For 64-bit compatibility, he'd want uint32_t to be a 64-bit unsigned integer type? For 64-bit incompatibility, maybe.
My version works with both the AMD64 and Inte386 SysV ABIs.
Re: Missing stdint.h
Posted: Tue Jun 05, 2012 10:24 pm
by bluemoon
I build cross compiler according to the wiki article, the standard header is shipped with libgcc even with --without-headers
Code: Select all
$ ls /usr/local/cross/lib/gcc/x86_64-elf/4.6.3/include
abmintrin.h bmmintrin.h float.h iso646.h mm_malloc.h smmintrin.h stdfix.h tgmath.h wmmintrin.h
ammintrin.h cpuid.h fma4intrin.h lwpintrin.h nmmintrin.h stdarg.h stdint-gcc.h tmmintrin.h x86intrin.h
avxintrin.h cross-stdarg.h ia32intrin.h mm3dnow.h pmmintrin.h stdbool.h stdint.h unwind.h xmmintrin.h
bmiintrin.h emmintrin.h immintrin.h mmintrin.h popcntintrin.h stddef.h tbmintrin.h varargs.h xopintrin.h
PS:
Don't sudo gcc for the obvious reason.
Re: Missing stdint.h
Posted: Wed Jun 06, 2012 12:40 am
by Solar
<stdint.h> is built regardless, that is correct. If the options we give in the tutorials don't make those includes "visible", we should change them...
I don't have a cross-compiler active ATM so I cannot test, and I don't really have the time to set things up for testing... someone else to step into the breach?
Re: Missing stdint.h
Posted: Wed Jun 06, 2012 12:43 am
by bluemoon
I just add -I/usr/local/cross/..... to the compile option until I pull in newlib, which also provide those headers.
Re: Missing stdint.h
Posted: Wed Jun 06, 2012 4:25 am
by Love4Boobies
I didn't notice you wrote size_t rather than uint32_t either. Your second snippet isn't C, it's GCC-ism, so I would have to disagree with it.
Re: Missing stdint.h
Posted: Wed Jun 06, 2012 4:29 am
by Love4Boobies
If you're using it with clang, it's because it supports GCC-specific extensions. Regardless of what compiler you're using, it's not really C.
Re: Missing stdint.h
Posted: Wed Jun 06, 2012 11:37 am
by Love4Boobies
Fair enough. Given that the OP mentioned the Bare Bones tutorial, I just happened to make the mistake of thinking that your answer wasn't about the wrong data type, wrong compiler, and wrong language.