[darcs-devel] Re: [issue326] compiling from source

Dave Love fx at gnu.org
Mon Nov 20 09:22:47 PST 2006


I got a chance to look at this again.

It looks to me as though there is a problem with the C headers
generated for the ghc libraries somehow (see the comments), but I
don't have time to investigate that.  This patch isn't very clean, but
is tested on Solaris 10 and GNU/Linux.  I moved term.h out of the
ccall, partly because I noticed that would include "term.h" rather
than <term.h>, though it probably doesn't matter practically.

For what it's worth, if the head of the generated C is changed to look
like this, it works:

/* GHC_PACKAGES haskell98-1.0 util-1.0 posix-1.0 unix-1.0 readline-1.0 lang-1.0 mtl-1.0 QuickCheck-1.0 parsec-1.0 base-1.0 rts-1.0
*/
#include <curses.h>
#include <term.h>
#include "Stg.h"
#include "HsBase.h"
#include "HsLang.h"
#include "HsReadline.h"
#include "HsUnix.h"
#include "HsPosix.h"
#include "HsUtil.h"

The original, with curses.h and term.h at the end of that block,
failed due to SGTTY being undefined (I think).

-------------- next part --------------

New patches:

[Fix curses stuff, especially on Solaris 10.
Dave Love <fx at gnu.org>**20061120171211] {
hunk ./External.hs 2
+#ifdef HAVE_CURSES
+-- Grim hack for Solaris 10 (at least).  Without it, SGTTY isn't declared.
+-- Something in the ghc C headers which get included before term.h in the
+-- generated C is clobbering it.  (If you edit that C and put the curses.h
+-- and term.h first, the error goes away.)
+#ifdef HAVE_TERMIO_H
+{-# INCLUDE <termio.h> #-}
+#endif
+{-# INCLUDE <curses.h> #-}
+{-# INCLUDE <term.h> #-}
+#endif
hunk ./External.hs 604
-{-# INCLUDE <curses.h> #-}
hunk ./External.hs 605
-foreign import ccall "term.h tgetnum" c_tgetnum :: CString -> IO CInt
-foreign import ccall "term.h tgetent" c_tgetent :: Ptr CChar -> CString -> IO CInt
+foreign import ccall "tgetnum" c_tgetnum :: CString -> IO CInt
+foreign import ccall "tgetent" c_tgetent :: Ptr CChar -> CString -> IO CInt
hunk ./configure.ac 396
+  AC_CHECK_HEADERS([termio.h])	dnl see External.hs
}

Context:

[TAG 1.0.9rc2
Tommy Pettersson <ptp at lysator.liu.se>**20061116140351] 
Patch bundle hash:
85d6d729115272e5bc7a9b8bf38040ce68c2f3ff


More information about the darcs-devel mailing list