MSYS build - stage 2 problem

Gour gour at mail.inet.hr
Fri Feb 27 10:43:33 EST 2004


Simon Peyton-Jones (simonpj at microsoft.com) wrote:

> 4.  hsc2hs runs gcc System\Posix\Signals_hsc_make.o  -o
> System\Posix\Signals_hsc_make.exe
> Does this step work?  You can try it too by hand.

It works by hand, but why hsc2hs keeps feeding the wrong parameter, i.e.

../../ghc/utils/hsc2hs/hsc2hs-inplace -Iinclude -I../../ghc/includes -Icbits/regex -I.    System/Posix/Signals.hsc

this line is OK, i.e. correct path: System/Posix/Signals.hsc

Executing: c:/mingw/bin/gcc.exe -c -mno-cygwin -D__GLASGOW_HASKELL__=602 -Ic:/ghc/fptools/ghc/includes -Iinclude -I../../ghc/includes -Icbits/regex -I. System\Posix\Signals_hsc_make.c -o System\Posix\Signals_hsc_make.o

Executing: c:/mingw/bin/gcc.exe System\Posix\Signals_hsc_make.o -o System\Posix\Signals_hsc_make.exe                 ^^^    ^^^

but why are the gcc.exe lines wrong, i.e. wrong separator?

I thought that I find a culprit in Makefile, but obviously I'm missing
something.

Please, help!

My hsc2hs-inplace looks like:

#!/bin/sh
HSC2HS_BINDIR="/ghc/fptools/ghc/utils/hsc2hs";
HSC2HS_DIR="/ghc/fptools/ghc/utils/hsc2hs";
HS_PROG="hsc2hs.exe";
HSC2HS_EXTRA="--cc=c:/mingw/bin/gcc.exe --ld=c:/mingw/bin/gcc.exe --cflag=-mno-c
ygwin --cflag=-D__GLASGOW_HASKELL__=602 -I/ghc/fptools/ghc/includes";

tflag="--template=$HSC2HS_DIR/template-hsc.h"
for arg do
    case "$arg" in
        -c*)    HSC2HS_EXTRA=;;
        --cc=*) HSC2HS_EXTRA=;;
        -t*)    tflag=;;
        --template=*) tflag=;;
        --)     break;;
    esac
done

$HSC2HS_BINDIR/$HS_PROG -v $tflag $HSC2HS_EXTRA "$@"


../hsc2hs/Config.hs looks:

module Config where
cDEFAULT_TMPDIR       = "C:/temp"
cGCC                  = "c:/mingw/bin/gcc.exe"
progNameSuffix        = ".exe"
pathSep               = '/'


While inspecting Main.hs I see the following:

-----------------------------------------
--      Cut and pasted from ghc/compiler/SysTools
-- Convert paths foo/baz to foo\baz on Windows


#if defined(mingw32_HOST_OS)
subst a b ls = map (\ x -> if x == a then b else x) ls
unDosifyPath xs = subst '\\' '/' xs
dosifyPath xs = subst '/' '\\' xs

[...]

Is problem lying here or maybe in:

../compiler/main/SysTools.lhs:


translate str = '"' : snd (foldr escape (True,"\"") str)
  where escape '"'  (b,     str) = (True,  '\\' : '"'  : str)
        escape '\\' (True,  str) = (True,  '\\' : '\\' : str)
        escape '\\' (False, str) = (False, '\\' : str)
        escape c    (b,     str) = (False, c : str)

which somehow differs from the patch posted on mailing list earlier which just
removed: 

escape '\\' str = '\\' : '\\' : str 

line. 

Similar thing is with ../libraries/base/System/Cmd.hs

and this explains why I now have problems achieving the same stage of building
process (I was at stage 2) - before I just patched 6.2 sources with the simple
patch correcting (removing): escape '\\' str = '\\' : '\\' : str  line, while
now things are  different.

All in all, believe me, that maintaining cygwin port is really a pain for the
code. By using, MSYS shell, no problem with POSIX/Win32 paths - yesterday I
compiled latest wxWidgets 2.5.1 :-)  with simple: configure; make install.

Otherwise my 'patches' for MSYS build are really simple stuff:

*** aclocal.m4.org      2004-02-24 08:46:26.000000000 +0100
--- aclocal.m4  2004-02-24 12:40:29.000000000 +0100
***************
*** 448,454 ****
  rm -rf conftest*
  case $HostPlatform in
   *mingw32)
!         ArCmd="`cygpath -w ${ArCmdRaw} | sed -e 's@\\\\@/@g' ` ${ArCmdArgs}"
          ;;
   *) ArCmd="${ArCmdRaw} ${ArCmdArgs}"
      ;;
--- 448,459 ----
  rm -rf conftest*
  case $HostPlatform in
   *mingw32)
!         if test ${OSTYPE} == "msys"
!          then
!            ArCmd="${ArCmdRaw} ${ArCmdArgs}"
!          else
!            ArCmd="`cygpath -w ${ArCmdRaw} | sed -e 's@\\\\@/@g' ` ${ArCmdArgs}
"
!         fi
          ;;
   *) ArCmd="${ArCmdRaw} ${ArCmdArgs}"
      ;;

and something like that for configure.ac - just getting rid of cygpath 
translation not required under MSYS, and I configure with the script:

#!/bin/sh

./configure --with-gcc=c:/mingw/bin/gcc.exe \
            --with-ghc=c:/ghc/ghc-6.0.1/bin/ghc.exe \
            --enable-src-tree-happy

These brought me to the stage2, but by fixing "undefined reference to 
`saved_termios', now I'm degraded to the boot stage :-(

Any idea how to proceed?


Sincerely,
Gour

-- 
Gour
gour at mail.inet.hr
Registered Linux User #278493



More information about the Cvs-ghc mailing list