Missing stdint.h
Missing stdint.h
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
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
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Missing stdint.h
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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Missing stdint.h
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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Missing stdint.h
I build cross compiler according to the wiki article, the standard header is shipped with libgcc even with --without-headers
PS: Don't sudo gcc for the obvious reason.
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
Re: Missing stdint.h
<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?
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?
Every good solution is obvious once you've found it.
Re: Missing stdint.h
I just add -I/usr/local/cross/..... to the compile option until I pull in newlib, which also provide those headers.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Missing stdint.h
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.
Last edited by Love4Boobies on Wed Jun 06, 2012 4:27 am, edited 1 time in total.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Missing stdint.h
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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Missing stdint.h
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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]