Hi,
When I try to compile GHC 5.00 under FreeBSD 4.2-STABLE I get the
following error:
PWD = /usr/local/sw/src/ghc-5.00/hslibs/util
------------------------------------------------------------------------
rm -f Readline.o; if [ ! -d Readline ]; then mkdir Readline; else
/usr/bin/find Readline -name '*.o' | xargs rm -f __rm_food; fi;
../../ghc/compiler/ghc-inplace -recomp -cpp -fglasgow-exts -fvia-C -icheck
-O -Rghc-timing -package lang -package concurrent -package posix
-package-name util -I../lang/cbits -I../concurrent/cbits
-I../posix/cbits -split-objs -c Readline.hs -o Readline.o -osuf o
/tmp/ghc47671.hc: In function `Readline_c17_fast1':
/tmp/ghc47671.hc:3127: warning: dereferencing `void *' pointer
/tmp/ghc47671.hc:3127: request for member `_file' in something not a structure or union
/tmp/ghc47671.hc: In function `Readline_c18_fast1':
/tmp/ghc47671.hc:3164: warning: dereferencing `void *' pointer
/tmp/ghc47671.hc:3164: request for member `_file' in something not a structure or union
/tmp/ghc47671.hc: In function `sdiZ_1_alt':
/tmp/ghc47671.hc:5311: warning: assignment from incompatible pointer type
gmake: *** [Readline.o] Error 1
The reason is that Readline contains two calls to fileno() with a StgAddr
argument which should be typecast to FILE * but isn't, and under FreeBSD
fileno() is defined as a macro, like this:
#define fileno(p) ((p)->_file)
A possible fix:
diff -cr ghc-5.00-pristine/hslibs/util/Readline.hsc
ghc-5.00-hacked/hslibs/util/Readline.hsc
*** ghc-5.00-pristine/hslibs/util/Readline.hsc Fri Mar 30 07:02:32 2001
--- ghc-5.00-hacked/hslibs/util/Readline.hsc Wed Apr 18 14:41:33 2001
***************
*** 358,371 ****
foreign label rl_readline_name :: Ptr (Ptr CChar)
getInStream :: IO Handle
! getInStream = peek rl_instream >>= fileno >>= fdToHandle
foreign label rl_instream :: Ptr (Ptr CFile)
getOutStream :: IO Handle
! getOutStream = peek rl_outstream >>= fileno >>= fdToHandle
foreign label rl_outstream :: Ptr (Ptr CFile)
! foreign import unsafe fileno :: Ptr CFile -> IO Fd
setStartupHook :: Maybe (IO ()) -> IO ()
setStartupHook hook = setFunPtr rl_startup_hook hook exportHookUnit
--- 358,372 ----
foreign label rl_readline_name :: Ptr (Ptr CChar)
getInStream :: IO Handle
! getInStream = peek rl_instream >>= getFileNo >>= fdToHandle
foreign label rl_instream :: Ptr (Ptr CFile)
getOutStream :: IO Handle
! getOutStream = peek rl_outstream >>= getFileNo >>= fdToHandle
foreign label rl_outstream :: Ptr (Ptr CFile)
! foreign import unsafe getFileNo :: Ptr CFile -> IO Fd
! #def inline int getFileNo (void *file) {return fileno((FILE *) file);}
setStartupHook :: Maybe (IO ()) -> IO ()
setStartupHook hook = setFunPtr rl_startup_hook hook exportHookUnit
And to answer Alastair Reid's question: RTLD_GLOBAL does exist on FreeBSD
4.x.
Regards,
Eelco.
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs