OS Specific Toolchain - libgcc+stdint.h compile failure

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
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

OS Specific Toolchain - libgcc+stdint.h compile failure

Post by thepowersgang »

I've finally gotten around to setting up a patchset for GCC to target my OS's userland. However, compiling libgcc fails due to __INT_LEAST8_TYPE__ (and friends) not defined (included from stdint.h, which is eventually included by my stdio.h)

Has anyone else seen this behavior, and/or knows how to fix it?

I have enabled the GCC provided stdint.h by putting `use_gcc_stdint=provide` in gcc/config.gcc - This might be something to put in the wiki article.

I'm compiling using GCC 4.7.1 (I'll give 4.7.2 a stab later today, but a quick check of the changelist doesn't mention stdint)

Patch sets and root makefile (the patches were made against binutils 2.22 and gcc 4.7.1)
https://github.com/thepowersgang/acess2 ... s-compiler

Compilation output (last few lines from make) - project root replaced with ...

Code: Select all

.../Externals/cross-compiler/build-x86/gcc/./gcc/xgcc -B/home/tpg/Projects/GitClones
/acess2/Externals/cross-compiler/build-x86/gcc/./gcc/ -B.../Externals/cross-compiler
/cross/i586-pc-acess2/bin/ -B.../Externals/cross-compiler/cross/i586-pc-acess2/lib/
-isystem .../Externals/cross-compiler/cross/i586-pc-acess2/include -isystem /home/tp
g/Projects/GitClones/acess2/Externals/cross-compiler/cross/i586-pc-acess2/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -I. -I. -I../.././gcc -I../../../../gcc-4.7.1/libgcc -I../../../../gcc-4.7.1/libgcc/. -I../../../../gcc-4.7.1/libgcc/../gcc -I../../../../gcc-4.7.1/libgcc/../include  -DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../../gcc-4.7.1/libgcc/libgcc2.c
In file included from ../../../../gcc-4.7.1/libgcc/../gcc/tsystem.h:88:0,
                 from ../../../../gcc-4.7.1/libgcc/libgcc2.c:29:
.../Externals/cross-compiler/build-x86/gcc/./gcc/include-fixed/stdio.h:40:1: error: unknown type name 'off_t'
In file included from .../Externals/cross-compiler/cross/usr/include/sys/stat.h:11:0,
                 from .../Externals/cross-compiler/cross/usr/include/unistd.h:34,
                 from ../../../../gcc-4.7.1/libgcc/../gcc/tsystem.h:103,
                 from ../../../../gcc-4.7.1/libgcc/libgcc2.c:29:
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:60:1: error: unknown type name '__INT_LEAST8_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:61:1: error: unknown type name '__INT_LEAST16_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:62:1: error: unknown type name '__INT_LEAST32_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:63:1: error: unknown type name '__INT_LEAST64_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:64:1: error: unknown type name '__UINT_LEAST8_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:65:1: error: unknown type name '__UINT_LEAST16_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:66:1: error: unknown type name '__UINT_LEAST32_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:67:1: error: unknown type name '__UINT_LEAST64_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:71:1: error: unknown type name '__INT_FAST8_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:72:1: error: unknown type name '__INT_FAST16_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:73:1: error: unknown type name '__INT_FAST32_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:74:1: error: unknown type name '__INT_FAST64_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:75:1: error: unknown type name '__UINT_FAST8_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:76:1: error: unknown type name '__UINT_FAST16_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:77:1: error: unknown type name '__UINT_FAST32_TYPE__'
.../Externals/cross-compiler/build-x86/gcc/./gcc/include/stdint.h:78:1: error: unknown type name '__UINT_FAST64_TYPE__'
In file included from .../Externals/cross-compiler/cross/usr/include/unistd.h:34:0,
                 from ../../../../gcc-4.7.1/libgcc/../gcc/tsystem.h:103,
                 from ../../../../gcc-4.7.1/libgcc/libgcc2.c:29:
.../Externals/cross-compiler/cross/usr/include/sys/stat.h:15:1: error: unknown type name 'uint64_t'
.../Externals/cross-compiler/cross/usr/include/sys/stat.h:17:1: error: unknown type name 'uint64_t'
.../Externals/cross-compiler/cross/usr/include/sys/stat.h:19:1: error: unknown type name 'uint32_t'
.../Externals/cross-compiler/cross/usr/include/sys/stat.h:21:1: error: unknown type name 'uint32_t'
.../Externals/cross-compiler/cross/usr/include/sys/stat.h:22:1: error: unknown type name 'uint32_t'
make[2]: *** [_muldi3.o] Error 1
make[2]: Leaving directory `.../Externals/cross-compiler/build-x86/gcc/i586-pc-acess2/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `.../Externals/cross-compiler/build-x86/gcc'
make: *** [.../Externals/cross-compiler/cross/bin/i586-pc-acess2-gcc] Error 2
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: OS Specific Toolchain - libgcc+stdint.h compile failure

Post by jnc100 »

What are the contents of the stdint.h produced during the build? I.e. the one referenced in the build output.

Regards,
John.
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: OS Specific Toolchain - libgcc+stdint.h compile failure

Post by thepowersgang »

It's what you'd expect, a long list of typedefs from the capitalised definitions and the standard names.

After some sniffing about, I determined that the origin of those definitions is in the compiler code (obviously), but they are conditionally defined, based on some compiler compile-time #defines. The place where these are correctly defined are in config/newlib-stdint.h (there's other ones, like glibc-stdint.h, and some platform-specific ones), adding "newlib-stdint.h" to the tm_file list in gcc/config.gcc fixed these compile errors.

I question the logic of having stdint.h "tied" to the libc, it seems a little backwards (the compiler knows what size char/short/int/long/... are going to be, and hence is in the best position to define the types)
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Post Reply