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.
I was building a cross compiler as described in the wiki. I downloaded the sources for gcc 4.2.4 and binutils 2.19 and then succesfully built it with TARGET=i586-elf.
Then I tried to build it again, this time with TARGET=i386-pe. Binutils were created just fine, but running "make all-gcc" failed because it could not find <stdio.h>:
/usr/src/build-gcc/./gcc/xgcc -B/usr/src/build-gcc/./gcc/ -B/usr/local/cross/i386-pe/bin/ -B/usr/local/cross/i386-pe/lib/ -isystem /usr/local/cross/i386-pe/include -isystem /usr/local/cross/i386-pe/sys-include -O2 -I../../gcc-4.2.4/gcc/../winsup/w32api/include -O2 -g -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc-4.2.4/gcc -I../../gcc-4.2.4/gcc/. -I../../gcc-4.2.4/gcc/../include -I../../gcc-4.2.4/gcc/../libcpp/include -I../../gcc-4.2.4/gcc/../libdecnumber -I../libdecnumber -DL_muldi3 -c ../../gcc-4.2.4/gcc/libgcc2.c -o libgcc/./_muldi3.o
In file included from ./tm.h:10,
from ../../gcc-4.2.4/gcc/libgcc2.c:35:
../../gcc-4.2.4/gcc/config/i386/cygming.h:51:19: error: stdio.h: No such file or
directory
My host compiler is: gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Looking for a solution I only found this post that is quite mingw-specific. I know next to nothing about building gcc. Could someone point me to the right direction please?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Combuster wrote:did you supply "--without-headers" to configure?
Yes I did. I did it exactly as in the wiki, except that I changed the target.
Solar wrote:Any particular reason why you need both the "elf" and the "pe" target? (I admit I never tested the tutorial for non-ELF targets.)
I intend to use ELF for my hobby OS and PE for another project involving the WDOSX DOS extender.
Solar wrote:Any particular reason why you're using gcc-3 instead of the standard GCC v4?
My computer is quite old (from 2003) and I didn't want to download that much. 4.2.4 is the highest version that does not need the additional packages GMP, MPFR and MPC.
EDIT: Oh wait, I got that question wrong. GCC 3 comes standard with Cygwin, should I try GCC 4?
I don't really think it will make a difference, I was just trying to be clear about the requirements.
No idea about the PE support, whether it should work or anything. I am currently tied down at work, and pretty much shot when I get home, so I can't have a look at this anytime soon.
Every good solution is obvious once you've found it.
My guess is that the PE support drags in a dependency which in turn "requires" stdio.h.
My approach would be to redirect the output of the ELF build and that of the PE build to seperate logfiles, and by comparing them trying to figure out what went different in the PE build.
Then trying to figure out if it's a "real" dependency, or if the autoconfig / automake / configure files could be hack-patched to avoid the dependency.
Every good solution is obvious once you've found it.
Looking more closely, I don't think <stdio.h> is a real dependency. The error happens when creating "_muldi3.o" from "libgcc2.c" which includes "tm.h" which includes "config/i386/cygming.h" which includes <stdio.h>. I don't know how to fix this without breaking a dozen other dependencies.