Newbie building GHC

Mike Thomas
Wed, 25 Sep 2002 06:57:15 +1000

Hi again.

Thanks for the feedback.

> > The only way I know to make all this work is to use a straightforward
> > Cygwin environment for building (with absolutely no mingw
> > stuff in your
> > path) and use --with-gcc in your configure line.  Other
> > things may work,
> > but you're on your own.

> I think Mike has a point here - unless mingw is first in your PATH, you
> get the cygwin binutils (ar, ld, maybe even as?) which could conceivably
> be a problem if they behave differently from the mingw versions.
> Presumably they don't, however, so we get away with it.

The reason that this worries me is that Cygwin "ld" links with libraries
from the Cygwin "lib" directory rather than the Mingw equivalent, regardless
of which "gcc" was used to compile the object files.

> FWIW, I recently build GHC on cygwin/mingw using the instructions from
> the building guide and it worked fine.

After the emails last night, I rebuilt after running the script below
(including specification of gcc) and with the Mingw32 bin directory  first
in the path.

make clean
find . -iname *.o -exec rm \{\} \;
find . -iname *.hi -exec rm \{\} \;
find . -iname *.p_o -exec rm \{\} \;
find . -iname *.p_hi -exec rm \{\} \;
cvs -z3 update -dP
rm -f configure
autoconf; cd ghc; autoconf; cd ..
./configure --build=mingw32 \
            --enable-hopengl \
            --enable-objectio \
            --with-gcc=c:/lang/MinGW295/bin/gcc.exe \
            --prefix=c:/lang/ghc \
            --datadir=c:/lang/ghc/imports \
            --libdir=c:/lang/ghc \
            > configure.log 2>&1

It went well until "hslibs/win32" where a previously mentioned missing file
stopped the build as shown below - a separate problem.


Mike Thomas.



../../ghc/compiler/ghc-inplace -cpp -fvia-C -optc-DTARGET_GHC -fglasgow-exts
win32 -H32m -O -W -fno-warn-unused-matches -fwarn-unused-imports  -package
lang    -c Win32Spawn.hs -o Win32Spawn.o


    Warning: foreign declaration uses deprecated non-standard syntax

c:\DOCUME~1\mike\LOCALS~1\Temp\ghc196.hc: In function `s678_ret':

c:\DOCUME~1\mike\LOCALS~1\Temp\ghc196.hc:449: warning: implicit declaration
of function `spawnProc'

c:/lang/MinGW295/bin/gcc.exe -mno-cygwin -O -DTARGET_GHC -I../../ghc/include
s    -c WndProc.c -o WndProc.o
c:/lang/MinGW295/bin/gcc.exe -mno-cygwin -O -DTARGET_GHC -I../../ghc/include
s    -c diatemp.c -o diatemp.o
c:/lang/MinGW295/bin/gcc.exe -mno-cygwin -O -DTARGET_GHC -I../../ghc/include
s    -c dumpBMP.c -o dumpBMP.o
c:/lang/MinGW295/bin/gcc.exe -mno-cygwin -O -DTARGET_GHC -I../../ghc/include
s    -c errors.c -o errors.o
c:/lang/MinGW295/bin/gcc.exe -mno-cygwin -O -DTARGET_GHC -I../../ghc/include
s    -c finalizers.c -o finalizers.o
c:/lang/MinGW295/bin/gcc.exe -mno-cygwin -O -DTARGET_GHC -I../../ghc/include
s    -c spawnProc.c -o spawnProc.o
rm -f libHSwin32.a
c:/lang/MinGW295/bin/ar clqs    libHSwin32.a WndProc.o diatemp.o dumpBMP.o
errors.o finalizers.o spawnProc.o Win32Dialogue_stub.o Win32Window_stub.o
Win32Spawn.o WndProc.o diatemp.o dumpBMP.o errors.o finalizers.o spawnProc.o
c:\lang\MinGW295\bin\ar.exe: Win32Dialogue_stub.o: No such file or directory

make[2]: *** [libHSwin32.a] Error 1
make[1]: *** [all] Error 1
make[1]: Leaving directory `/cygdrive/c/cvs/fptools/hslibs'
make: *** [all] Error 1