www.digitalmars.com         C & C++   DMDScript  

D.gnu - Compiling relocatable mingw gdc

reply Bill Baxter <dnewsgroup billbaxter.com> writes:
This is mostly meant for Anders... a continuation of an off-NG mail 
exchange about trying to build mingw gdc from source.

So here's where I currently am

The Makefile is generating compile lines like this:

stage1/xgcc.exe -Bstage1/ -B/gdc/mingw32/bin/ -c   \
     -g0 -O2 -DIN_GCC   \
     -W -Wall -Wwrite-strings -Wstrict-prototypes \
     -Wmissing-prototypes -pedantic \
     -Wno-long-long -Wold-style-definition \
     -DHAVE_CONFIG_H -DGENERATOR_FILE
     -I. -I. \
     -I../../gcc-3.4.5-20060117-1/gcc \
     -I../../gcc-3.4.5-20060117-1/gcc/. \
     -I../../gcc-3.4.5-20060117-1/gcc/../include  \
     ../../gcc-3.4.5-20060117-1/gcc/genmodes.c -o genmodes.o

none of those -I's point to place where there are actually any system 
headers, and genmodes there tries to #include something which #includes 
<stdio.h> among other things.  The xgcc (boostrap compiler?) seems not 
to have any intrinsic knowlege of where system headers are.

I was reading the MinGW install instructions from the MinGW site, and 
they said "runtime and win32 headers are separate".  So I thought maybe 
I could fix things by downloading the mingw runtime and copying its 
include,lib,and bin dirs into the toplevel gcc-3.4.5-20060117-1 dir.

That sort of worked but then there's a conflict over "mem.h" which is in 
the MinGW runtime include dir and also in the dmd front end.  It was 
finding the runtime version when trying to compile gdc.  So I renamed 
the runtime version to _mem.h.  And that let me get past that.

Now I'm stuck on an ld error.  It can't find crt2.o --
-----------------
stage1/xgcc.exe -Bstage1/ -B/gdc/mingw32/bin/   \
      -g0 -O2 -DIN_GCC   \
      -W -Wall -Wwrite-strings \
      -Wstrict-prototypes -Wmissing-prototypes \
      -pedantic -Wno-long-long -Wold-style-definition \
      -DHAVE_CONFIG_H -DGENERATOR_FILE  -o genmodes.exe \
       genmodes.o errors.o ../libiberty/libiberty.a
c:\MinGW\bin\ld.exe: crt2.o: No such file: No such file or directory
-------------
I've got crt2.o in both:
   C:\mingw\lib
and
   ../gcc-3.4.5-20060117-1/lib/crt2.o

Apparently something about my environment doesn't match what the mingw 
make files are expecting.  In particular these -B/gdc/mingw32/bin paths 
look odd.  /gdc is a bogus directory to begin with (I'm using the fstab 
hack you pointed me to), and I don't have a dir like mingw32/bin 
anywhere even in my c:\mingw install.  That string "mingw32" as part of 
a path is included in the Makefile.  I'm not sure where it comes from. 
Maybe coming from --target=mingw32 flag passed to configure?

Any ideas appreciated.

--bb
Mar 05 2008
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Bill Baxter wrote:
 This is mostly meant for Anders... a continuation of an off-NG mail 
 exchange about trying to build mingw gdc from source.
...
 I was reading the MinGW install instructions from the MinGW site, and 
 they said "runtime and win32 headers are separate".  So I thought maybe 
 I could fix things by downloading the mingw runtime and copying its 
 include,lib,and bin dirs into the toplevel gcc-3.4.5-20060117-1 dir.
I redid the build again on Windows XP, and ran into two things that I had forgotten all about since the pre-1.0 time when I last did it... First, I couldn't get the setup to work with MinGW but only in Cygwin (seems patch is silly). Second, something had hardcoded /usr/include. My hackaround was to ln -s /mingw/include /usr/include while building, which probably is totally wrong but I didn't feel like diving into it. If everything is working alright, I'll package the pre-release up and put it on the gdcwin site - maybe even with some building instructions. --anders
Mar 06 2008
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Anders F Björklund wrote:
 Bill Baxter wrote:
 This is mostly meant for Anders... a continuation of an off-NG mail 
 exchange about trying to build mingw gdc from source.
...
 I was reading the MinGW install instructions from the MinGW site, and 
 they said "runtime and win32 headers are separate".  So I thought 
 maybe I could fix things by downloading the mingw runtime and copying 
 its include,lib,and bin dirs into the toplevel gcc-3.4.5-20060117-1 dir.
I redid the build again on Windows XP, and ran into two things that I had forgotten all about since the pre-1.0 time when I last did it... First, I couldn't get the setup to work with MinGW but only in Cygwin (seems patch is silly). Second, something had hardcoded /usr/include. My hackaround was to ln -s /mingw/include /usr/include while building, which probably is totally wrong but I didn't feel like diving into it. If everything is working alright, I'll package the pre-release up and put it on the gdcwin site - maybe even with some building instructions. --anders
Ok. Great. --bb
Mar 06 2008