Pepe Iborra | 1 Apr 2007 17:50
Picon

Re: [Haskell-cafe] ghc-6.7.20070330 on Mac OS X

(redirecting to glasgow-haskell-users)

It is well known that the readline lib that comes with OS X is no  
good, and you need to use a replacement. A nice post from the  
blogosphere explaining all this:

http://mult.ifario.us/articles/2006/10/17/ghc-6-6-and-mac-os-x- 
readline-quick-fix

If that doesn't help, please post the errors that you get when  
building the readline package.

Cheers
pepe

On 01/04/2007, at 16:33, Ruben Zilibowitz wrote:

> I am trying to build this version of GHC on Mac OS X. I'm currently  
> using GHC 6.6. The build is failing with the following error:
>
> ghci/InteractiveUI.hs:69:7:
>     Could not find module `System.Console.Readline':
>       Use -v to see a list of the files searched for.
> <<ghc: 310591992 bytes, 51 GCs, 4238510/9457140 avg/max bytes  
> residency (4 samples), 26M in use, 0.02 INIT (0.00 elapsed), 2.11  
> MUT (15.73 elapsed), 0.31 GC (0.36 elapsed) :ghc>>
> make[2]: *** [depend] Error 1
> make[1]: *** [stage2] Error 2
> make: *** [bootstrap2] Error 2
>
(Continue reading)

Gregory Wright | 1 Apr 2007 20:34
Picon

Re: [Haskell-cafe] ghc-6.7.20070330 on Mac OS X


Hi Ruben,

The GHC wiki also has information on this, and should be your first
stop if you are experiencing build problems:

http://hackage.haskell.org/trac/ghc/wiki/Building/MacOSX

At least under MacPorts, I have had no trouble building 6.7-20070330.
I will be releasing a new portfile for ghc-devel in a few days that will
build the latest from the darcs repository.

Best Wishes,
Greg

On Apr 1, 2007, at 11:50 AM, Pepe Iborra wrote:

> (redirecting to glasgow-haskell-users)
>
> It is well known that the readline lib that comes with OS X is no  
> good, and you need to use a replacement. A nice post from the  
> blogosphere explaining all this:
>
> http://mult.ifario.us/articles/2006/10/17/ghc-6-6-and-mac-os-x- 
> readline-quick-fix
>
> If that doesn't help, please post the errors that you get when  
> building the readline package.
>
> Cheers
(Continue reading)

Gregory Wright | 1 Apr 2007 21:40
Picon

Re: More on FreeBSD/amd64


Hi Ian,

On Mar 29, 2007, at 8:36 PM, Ian Lynagh wrote:

>
> Hmm, oh well.
>
> OK, so we know that the wrong value is being passed to
> newPinnedByteArray#, right? There aren't many calls to that:
>
>     libraries/base/Foreign/Marshal/Alloc.hs
>     libraries/base/GHC/ForeignPtr.hs (4 calls)
>     libraries/base/GHC/Handle.hs
>
> so the easiest way forward is probably to print something unique, and
> the size passed, in each one and try to work backwards towards the
> source. e.g.
>
>     mallocPlainForeignPtrBytes (I# size) = IO $ \s ->
>         case newPinnedByteArray# size s      of { (# s, mbarr# #) ->
>
>     =>
>
>     mallocPlainForeignPtrBytes i <at> (I# size) = do
>       print ('A', i)
>       IO $ \s ->
>         case newPinnedByteArray# size s      of { (# s, mbarr# #) ->
>
> (it might be worth printing something after the existing IO action as
(Continue reading)

Ian Lynagh | 1 Apr 2007 21:57
Picon
Gravatar

Re: More on FreeBSD/amd64


Hi Gregory,

On Sun, Apr 01, 2007 at 03:40:11PM -0400, Gregory Wright wrote:
> 
> >    mallocPlainForeignPtrBytes i <at> (I# size) = do
> >      print ('A', i)
> >      IO $ \s ->
> >        case newPinnedByteArray# size s      of { (# s, mbarr# #) ->
> >
> >(it might be worth printing something after the existing IO action as
> >well, just to avoid confusion as to what is happening.
> 
> Is there a version of "print" I can use for debugging these libraries?
> Just adding "print" causes a cycle in module dependencies.

Ah, remove the #if/#endif around the definition of "puts", its export,
and the GHC.Pack import in libraries/base/GHC/Handle.hs

Thanks
Ian
Gregory Wright | 2 Apr 2007 00:10
Picon

Re: More on FreeBSD/amd64


Hi Ian,

On Apr 1, 2007, at 3:57 PM, Ian Lynagh wrote:

>
> Hi Gregory,
>
>> Is there a version of "print" I can use for debugging these  
>> libraries?
>> Just adding "print" causes a cycle in module dependencies.
>
> Ah, remove the #if/#endif around the definition of "puts", its export,
> and the GHC.Pack import in libraries/base/GHC/Handle.hs
>
No such luck.  I even copied "puts" into libraries/base/GHC/ 
ForeignPtr.hs
but I still get I cycle because I need withCString to define "puts":

Module imports form a cycle for modules:
   GHC.ForeignPtr
     imports: GHC.Show GHC.Err GHC.Ptr GHC.IOBase GHC.Base GHC.List
              Foreign.Storable Foreign.Ptr Foreign.C Control.Monad
   Foreign.C imports: Foreign.C.Error Foreign.C.String Foreign.C.Types
   Foreign.C.Error
     imports: GHC.Base GHC.Num GHC.IOBase Data.Maybe
              Foreign.Marshal.Error Foreign.C.String Foreign.C.Types  
Foreign.Ptr
              Foreign.Storable GHC.IOBase
   Foreign.C.String
(Continue reading)

Ian Lynagh | 2 Apr 2007 00:22
Picon
Gravatar

Re: More on FreeBSD/amd64

On Sun, Apr 01, 2007 at 06:10:25PM -0400, Gregory Wright wrote:
> 
> >Ah, remove the #if/#endif around the definition of "puts", its export,
> >and the GHC.Pack import in libraries/base/GHC/Handle.hs
> >
> No such luck.  I even copied "puts" into libraries/base/GHC/ 
> ForeignPtr.hs
> but I still get I cycle because I need withCString to define "puts":

Oh, the 6.4.2 definition is different to the 6.6 definition.

Does the 6.6 one work with 6.4.2?:

puts :: String -> IO ()
puts s = do write_rawBuffer 1 (unsafeCoerce# (packCString# s))
                            0 (fromIntegral (length s))
            return ()

(packCString# come from GHC.Pack)

Thanks
Ian
Vivian McPhail | 2 Apr 2007 07:41
Picon
Favicon

ghci doesn't run FFi'd code which works under ghc on WinXP

Hi All,
 
I wrote a binding to matlab matrix.h and mat.h.  My test program works when I compile a binary, but when I try to use the code in ghci nothing happens.  There are no error messages, but all computations return a blank line.
 
Does this fall into a known class of error?
 
I can provide my source code, but because of licensing requirements I can't provide the .dll's against which the code is linked.
 
TIA
 
Vivian
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Simon Peyton-Jones | 2 Apr 2007 10:34
Picon
Favicon
Gravatar

RE: [Haskell-cafe] ghc-6.7.20070330 on Mac OS X

There is also a special page all about building GHC on MaxOSX
        http://hackage.haskell.org/trac/ghc/wiki/Building/MacOSX

If it doesn't explain enough about readline (e.g. does it include "the nice post from the blogosphere"?),
perhaps someone can enhance it?

In general, when building GHC, the place to look is
        http://hackage.haskell.org/trac/ghc/wiki/Building
and there are architecture-specific sub-pages.

Do please add painfully-learned information to these wiki pages! thanks

Simon

| -----Original Message-----
| From: glasgow-haskell-users-bounces <at> haskell.org
[mailto:glasgow-haskell-users-bounces <at> haskell.org] On
| Behalf Of Pepe Iborra
| Sent: 01 April 2007 16:50
| To: Ruben Zilibowitz
| Cc: glasgow-haskell-users <at> haskell.org Users
| Subject: Re: [Haskell-cafe] ghc-6.7.20070330 on Mac OS X
|
| (redirecting to glasgow-haskell-users)
|
| It is well known that the readline lib that comes with OS X is no
| good, and you need to use a replacement. A nice post from the
| blogosphere explaining all this:
|
| http://mult.ifario.us/articles/2006/10/17/ghc-6-6-and-mac-os-x-
| readline-quick-fix
|
| If that doesn't help, please post the errors that you get when
| building the readline package.
|
| Cheers
| pepe
|
| On 01/04/2007, at 16:33, Ruben Zilibowitz wrote:
|
| > I am trying to build this version of GHC on Mac OS X. I'm currently
| > using GHC 6.6. The build is failing with the following error:
| >
| > ghci/InteractiveUI.hs:69:7:
| >     Could not find module `System.Console.Readline':
| >       Use -v to see a list of the files searched for.
| > <<ghc: 310591992 bytes, 51 GCs, 4238510/9457140 avg/max bytes
| > residency (4 samples), 26M in use, 0.02 INIT (0.00 elapsed), 2.11
| > MUT (15.73 elapsed), 0.31 GC (0.36 elapsed) :ghc>>
| > make[2]: *** [depend] Error 1
| > make[1]: *** [stage2] Error 2
| > make: *** [bootstrap2] Error 2
| >
| > So it seems I need to install the Readline library. But building
| > the Readline library is also giving me errors on my system.
| >
| > Just wondering if someone else has managed to build ghc-6.7.x on
| > Mac OS X? If so, what did you need to do?
| >
| > Cheers,
| >
| > Ruben
| >
| > _______________________________________________
| > Haskell-Cafe mailing list
| > Haskell-Cafe <at> haskell.org
| > http://www.haskell.org/mailman/listinfo/haskell-cafe
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users <at> haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Gregory Wright | 2 Apr 2007 17:57
Picon

Re: More on FreeBSD/amd64


Hi Ian,

On Apr 1, 2007, at 6:22 PM, Ian Lynagh wrote:

> On Sun, Apr 01, 2007 at 06:10:25PM -0400, Gregory Wright wrote:
>>
>>> Ah, remove the #if/#endif around the definition of "puts", its  
>>> export,
>>> and the GHC.Pack import in libraries/base/GHC/Handle.hs
>>>
>> No such luck.  I even copied "puts" into libraries/base/GHC/
>> ForeignPtr.hs
>> but I still get I cycle because I need withCString to define "puts":
>
> Oh, the 6.4.2 definition is different to the 6.6 definition.
>
> Does the 6.6 one work with 6.4.2?:
>
> puts :: String -> IO ()
> puts s = do write_rawBuffer 1 (unsafeCoerce# (packCString# s))
>                             0 (fromIntegral (length s))
>             return ()
>
> (packCString# come from GHC.Pack)
>

Still doesn't work.  If I include the definition of write_rawBuffer just
above puts (I can't import GHC.Handle because of the dependency loop)
and dangerously change CInt to Int in the signature (can't import
Foreign.C.Types for the same reason) I still get an error message
saying that "fromInteger" is out of scope.

This is what I have added to libraries/base/GHC/ForeignPtr.hs:

import GHC.List         ( null )
import GHC.Base
import GHC.IOBase
import GHC.List         ( length )
import GHC.Pack				-- this is new
import GHC.Ptr          ( Ptr(..) )
import GHC.Err
import GHC.Show

foreign import ccall unsafe "__hscore_PrelHandle_write"
    write_rawBuffer :: Int -> RawBuffer -> Int -> Int -> IO Int

puts :: String -> IO ()
puts s = do
         write_rawBuffer 1 (unsafeCoerce# (packCString# s))
                 0 (length s)
         return ()

I'm wondering if I should just give up on trying to print anything
out from this deep in the libraries and go back to looking at the
debugger trace.  My guess is still that a FreeBSD libc function
is getting called and somehow storing a 32 bit value in a 64 bit
location, with junk in the high order word.

As always, hints and firm whacks on the side of the head will be
appreciated.

Best Wishes,
Greg
Bulat Ziganshin | 2 Apr 2007 18:13
Picon

Re[2]: More on FreeBSD/amd64

Hello Gregory,

Monday, April 2, 2007, 7:57:49 PM, you wrote:

>> puts :: String -> IO ()
>> puts s = do write_rawBuffer 1 (unsafeCoerce# (packCString# s))
>>                             0 (fromIntegral (length s))
>>             return ()
>>
>> (packCString# come from GHC.Pack)

you may try to call C function with a result of (packCString# s)

--

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin <at> gmail.com

Gmane