Re: nhc on MacOS X



About this list Date view Thread view Subject view Author view

Malcolm Wallace (malcolm-nhc@cs.york.ac.uk)
Thu, 26 Apr 2001 11:29:19 +0100


> Ok. To the main subject of the message. I put nhc 1.02, no patches to > compile from C sources on my Mac with MacOS X, using the cc (gcc > idiom) compiler. I've had some very small problems > like xlib_debug object code was not included in the Makefile to be > linked to the rest of libraries and produce nhc98comp, HInteractive > and hmake-PRAGMA. I also run into the problem of not locating the > malloc.h header, which in my settings is inside sys/malloc.h. I can > send you the changes, in the format you wish. Yes, please send me the changes (the output of 'diff -u', direct to me, rather than to the nhc-users list). It's great to hear you managed to get nhc98 (mostly) working on MacOS X. > I finally got something > to run. In my home directory and specifying complete paths, nhc > runs ok. The problem is when I install it in /usr/local. I get this > type of error: > > [localhost:~/Documents/Haskell/varios] pablo% nhc98 Hola.hs > User-defined IO error: Can't open any of: > ./Ratio.hi > /usr/local/include/nhc98/Ratio.hi > when trying to read Ratio. > > [localhost:~/Documents/Haskell/varios] pablo% hmake Hola > nhc98 -c -o Hola.o Hola.hs > User-defined IO error: Can't open any of: > ./Ratio.hi > /usr/local/include/nhc98/Ratio.hi > when trying to read Ratio. > > Location of the files: default, > > /usr/local/bin > /usr/local/include/nhc98 > /usr/local/lib/nhc98/powerpc-Darwin-1.3 > hmake/powerpc_Darwin-1.3 Can you check that /usr/local/include/nhc98 really does contain a file called Ratio.hi, and that it has read-permission for all users? If the answer is yes, then I guess you are probably suffering from the 'openFile' bug. Unfortunately, version 1.02 gets the permissions wrong for openFile in all modes - ReadMode, WriteMode, and ReadWriteMode. Apply the 'rdonly' patch listed on the status page: ftp://ftp.cs.york.ac.uk/pub/haskell/nhc98/patch-1.02-rdonly then 'make runtime' and 'make install'. I think that should fix it. > If I run it from my home directory (left as nhc finished compile): > > [localhost:~/Documents/Haskell/varios] pablo% > /Users/pablo/Documents/nhc98-1.02/script/nhc98 Hola.hs > /usr/bin/ld: Undefined symbols: > _xlib_debug I can't see any reason why xlib_debug.o should have been omitted from the Runtime archive file. However it is possible that the dependencies between the Prelude and Runtime archives are sufficiently complex that the MacOS linker doesn't realise it needs the _xlib_debug symbol until too late. Here is a suggestion. Near the end of the file script/nhc98.inst, about line 524, you will see: LDLIBS= ..." "$NHC98LIBDIR/$MACHINE/Prelude$CFG.a" "$NHC98LIBDIR/$MACHINE/Runtime$CFG.a (The Prelude and Runtime archives appear multiple times in this definition.) Add another " "$NHC98LIBDIR/$MACHINE/Prelude$CFG.a" "$NHC98LIBDIR/$MACHINE/Runtime$CFG.a directly to the end of this line. Then ./configure to regenerate script/nhc98, and try compiling your program again. > But: > > [localhost:~/Documents/Haskell/varios] pablo% > /Users/pablo/Documents/nhc98-1.02/script/nhc98 Hola.hs > /Users/pablo/Documents/nhc98-1.02/targets/powerpc- > Darwin-1.3/obj/runtime/Kernel/xlib_debug.o > [localhost:~/Documents/Haskell/varios] pablo% ls > Hola.hi Hola.hs Hola.o a.out > [localhost:~/Documents/Haskell/varios] pablo% ./a.out > hola > > Works! So basically I have a running compiler. > > I could even rebuild part of nhc (thus "make all" after configuring > and detecting nhc as compiler) but somewhere it stopped > and I was not been able to recover since I lost the original > installation. But I'm not worried for that at the moment. I first > want to have the compiler running Ok. > BTW, are existential and explicit universal quantification implemented in > nhc98? Where can I find docs for that? No, nhc98 does not have full existential and explicit universal quantification. However, it does permit local universal quantification in datatypes, which is sometimes mistakenly called existentials. We do not have any direct documentation ourselves, but the basic idea is that definitions like data T a = forall b . C a b data T a = forall b . Eq b => C a b are permitted. The same feature is available in Hugs, ghc, and hbc, so you should be able to refer to their documentation for more details. Regards, Malcolm


About this list Date view Thread view Subject view Author view