RE: Newbie building GHC
| In retrospect I think that unless "configure" is doing something really | tricky, if you want the Mingw32 "ar" and "ld" to be picked up instead of the | Cygwin equivalents then you must have the Mingw32 bin directory in your path | ahead of the Cygwin bin directory.
The right thing to do is what the building guide says.
The GHC build system is careful to use the newly-built GHC for compiling even .c files, and for doing linking. The newly-built GHC will use the gcc that you point to with the --with-gcc configure command. It will not use a path in any shape or form (unless you omit --with-gcc in which case it'll pick whatever random gcc is lying around; probably not the right one).
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. FWIW, I recently build GHC on cygwin/mingw using the instructions from the building guide and it worked fine. Cheers, Simon
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. Cheers Mike Thomas. ================================== ..... ../../ghc/compiler/ghc-inplace -cpp -fvia-C -optc-DTARGET_GHC -fglasgow-exts -package-name win32 -H32m -O -W -fno-warn-unused-matches -fwarn-unused-imports -package lang -c Win32Spawn.hs -o Win32Spawn.o Win32Spawn.hs:23: 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
participants (2)
-
Mike Thomas -
Simon Marlow