[Gtkhs] installing gtk+hs on debian

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sun Oct 19 21:20:54 EDT 2003


Jens Petersen <petersen at haskell.org> wrote,

> >>>>> "ECM" == Eric Chi-Liang Mak <ecma808 at cse.unsw.EDU.AU> writes:
> 
>     ECM> On Thu, 9 Oct 2003, Jens Petersen wrote:
> 
>     >> >>>>> "ECM" == Eric Chi-Liang Mak
>     >> >>>>> <ecma808 at cse.unsw.EDU.AU> writes:
>     >>
>     ECM> Hi all, I'm trying to install gtk+hs 0.15.2 on a
>     ECM> debian testing box (ghc 5.04.3 deb package, c2hs
>     ECM> 0.10.17 compiled from source), and am having
>     ECM> problems. configure works fine, but when I run
>     ECM> make, c2hs chokes on my glib header files as
>     ECM> follows:
>     >>
>     ECM> Daedalus:~/gtk+hs-0.15.2$ make Entering preparation
>     ECM> phase...  make[1]: Entering directory
>     ECM> `/home/aesthiri/gtk+hs-0.15.2/glib'
>     ECM> /usr/local/bin/c2hs
>     ECM> --cppopts="-I/usr/include/gtk-1.2
>     ECM> -I/usr/include/glib-1.2 -I/usr/lib/glib/include
>     ECM> -D_REENTRANT" glib.h GList.chs c2hs: Error limit of
>     ECM> 20 errors has been reached.
>     ECM> /usr/include/bits/local_lim.h:36: (column 0)
>     ECM> [ERROR]
>     >> >>>> Lexical error!
>     ECM> The character '#' does not fit here; skipping it.
>     ECM> /usr/include/bits/local_lim.h:37: (column 1)
>     ECM> [ERROR]
>     >> >>>> Lexical error!
>     ECM> The character '#' does not fit here; skipping it.
>     ECM> /usr/include/bits/local_lim.h:38: (column 1)
>     ECM> [ERROR]
>     >> >>>> Lexical error!
>     ECM> The character '#' does not fit here; skipping it.
> 
> You're right I reproduced this too here with ghc-6.0.1.
> 
> Manuel do you have any ideas?

It is a problem with a GCC CPP extension of the #line
directive, which isn't properly documented in the manual.
(Hence, all attempts to replicate it in c2hs are based on
guess work.)  The appended patch fixes the problem.

Manuel

-=-

Index: c2hs/c/CLexer.hs
===================================================================
RCS file: /home/chakcvs/hipar/c2hs/c/CLexer.hs,v
retrieving revision 1.19
diff -u -r1.19 CLexer.hs
--- c2hs/c/CLexer.hs	12 Jul 2002 06:29:39 -0000	1.19
+++ c2hs/c/CLexer.hs	19 Oct 2003 08:31:55 -0000
@@ -457,11 +457,12 @@
 
 -- #line directive (K&R A12.6)
 --
--- * allows further numbers to follow the file name a la GCC
+-- * allows further ints after the file name a la GCC; as the GCC CPP docu
+--   doesn't say how many ints there can be, we allow an unbound number
 --
 linedir :: CLexer
 linedir  = char '#' +> ppwhite +> int +> ppwhite +> (fname +> ppwhite)`quest`
-	   ((int +> ppwhite +> (int +> ppwhite)`quest`epsilon)`quest` 
+	   ((int +> ppwhite)`star` 
 	    char '\n')
 	   `lexmeta` \str pos ns -> (Nothing, adjustPos str pos, ns, Nothing)
 	   where


More information about the Gtkhs mailing list