Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Portability of a Haskell program (Ond?ej Garncarz)
   2.  Named Pipes Et Cetera (matthew coolbeth)
   3. Re:  Named Pipes Et Cetera (Patrick LeBoutillier)
   4. Re:  Named Pipes Et Cetera (matthew coolbeth)
   5. Re:  Named Pipes Et Cetera (Magnus Therning)
   6. Re:  Named Pipes Et Cetera (Magnus Therning)
   7. Re:  Named Pipes Et Cetera (Daniel Fischer)
   8. Re:  Named Pipes Et Cetera (Patrick LeBoutillier)


----------------------------------------------------------------------

Message: 1
Date: Mon, 22 Nov 2010 21:42:17 +0100
From: Ond?ej Garncarz <[email protected]>
Subject: [Haskell-beginners] Portability of a Haskell program
To: [email protected]
Message-ID: <20101122204217.ga23...@ondra-laptop>
Content-Type: text/plain; charset=utf-8

I want to run my Haskell program which I've compiled on other computer, so I 
try:

$ ./eternitypar 
./eternitypar: error while loading shared libraries: libgmp.so.10: cannot open 
shared object file: No such file or directory
$ LD_PRELOAD=./libgmp.so.10 ./eternitypar 
./eternitypar: /lib/libc.so.6: version `GLIBC_2.7' not found (required by 
./libgmp.so.10)
$ LD_PRELOAD=./libc.so:./libgmp.so.10 ./eternitypar 
ERROR: ld.so: object './libc.so' from LD_PRELOAD cannot be preloaded: ignored.
./eternitypar: /lib/libc.so.6: version `GLIBC_2.7' not found (required by 
./libgmp.so.10)
$ LD_PRELOAD=./ld-linux.so.2:./libc.so:./libgmp.so.10 ./eternitypar 
ERROR: ld.so: object './ld-linux.so.2' from LD_PRELOAD cannot be preloaded: 
ignored.
ERROR: ld.so: object './libc.so' from LD_PRELOAD cannot be preloaded: ignored.
./eternitypar: /lib/libc.so.6: version `GLIBC_2.7' not found (required by 
./libgmp.so.10)

So I download a package from 
http://new-www.haskell.org/ghc/download_ghc_7_0_1#x86_64linux and I try:

$ ./configure
checking for path to top of build tree... utils/ghc-pwd/ghc-pwd: error while 
loading shared libraries: libgmp.so.3: cannot open shared object file: No such 
file or directory
configure: error: cannot determine current directory

Why is it looking for such an old version, when 7.0.1 should be up-to-date? But 
fine, I can replace ghc-pwd with symlinked /bin/pwd, but I have a problem with 
some pgcc installed on the machine, so I run ./configure 
--with-gcc=/usr/bin/gcc: (/usr/bin/gcc exists and works)

checking for path to top of build tree... /u/gar061/tmp/ghc-7.0.1
checking for perl... /usr/bin/perl
checking if your perl works in shell scripts... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for ar... /usr/bin/ar
checking whether /usr/bin/ar is GNU ar... yes
checking for ar arguments... q
checking for gcc... /tools/pgi725/linux86-64/7.2-5/bin/pgcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... no
checking whether /tools/pgi725/linux86-64/7.2-5/bin/pgcc accepts -g... yes
checking for /tools/pgi725/linux86-64/7.2-5/bin/pgcc option to accept ISO 
C89... none needed
checking whether ranlib is needed... no
checking for sed... /bin/sed
configure: error: gcc is required

It's ignoring my choice of GCC. Installation of 6.12.3 runs the same way. Then 
I move to compilation from source codes, but here - 
http://new-www.haskell.org/ghc/download_ghc_7_0_1#sources - I read:

"The source distribution needs an installed GHC (version 6.10 at least)."

Oh, so I need the application to build the application? What's the reason?

Is there any other way to make it work?

Thanks,
Ondřej Garncarz


------------------------------

Message: 2
Date: Tue, 23 Nov 2010 07:55:17 -0500
From: matthew coolbeth <[email protected]>
Subject: [Haskell-beginners] Named Pipes Et Cetera
To: <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="UTF-8"

Hello, all.

Three questions:

1> What, if anything, can I do in a Haskell program to do blocking
reads from a Linux FIFO?  For the curious, there is a small program
below that doesn't block, but immediately terminates because of an EOF

2> How could I have found the answer to this question on my own? (The
documentation that Google found for me was not completely adequate)

3> Is this sort of question generally regarded as too unixy or not
haskelly enough to be appropriate for this mailing list?

Thanks.

--BEGIN PROGRAM--
module Main () where

import Control.Monad
import System.IO
import System.Posix.Files

pipeString = "/tmp/dld.fifo"

main :: IO ()
main = do
        createNamedPipe pipeString $ unionFileModes ownerReadMode ownerWriteMode
        pipe <- openFile pipeString ReadMode
        forever (hGetLine pipe >>= putStrLn)


-- 
mac


------------------------------

Message: 3
Date: Tue, 23 Nov 2010 09:09:57 -0500
From: Patrick LeBoutillier <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: matthew coolbeth <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Matthew,

Does it return immediately when you start it or only when you try to
write to the pipe with some client?

Here's what I get on my Linux box:

$ rm /tmp/dld.fifo && ./pipe &
[1] 8603
$ echo -e "1\n2\n3" > /tmp/dld.fifo
1
2
3
pipe: /tmp/dld.fifo: hGetLine: end of file


Patrick


On Tue, Nov 23, 2010 at 7:55 AM, matthew coolbeth
<[email protected]> wrote:
> Hello, all.
>
> Three questions:
>
> 1> What, if anything, can I do in a Haskell program to do blocking
> reads from a Linux FIFO?  For the curious, there is a small program
> below that doesn't block, but immediately terminates because of an EOF
>
> 2> How could I have found the answer to this question on my own? (The
> documentation that Google found for me was not completely adequate)
>
> 3> Is this sort of question generally regarded as too unixy or not
> haskelly enough to be appropriate for this mailing list?
>
> Thanks.
>
> --BEGIN PROGRAM--
> module Main () where
>
> import Control.Monad
> import System.IO
> import System.Posix.Files
>
> pipeString = "/tmp/dld.fifo"
>
> main :: IO ()
> main = do
>        createNamedPipe pipeString $ unionFileModes ownerReadMode 
> ownerWriteMode
>        pipe <- openFile pipeString ReadMode
>        forever (hGetLine pipe >>= putStrLn)
>
>
> --
> mac
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada


------------------------------

Message: 4
Date: Tue, 23 Nov 2010 09:13:54 -0500
From: matthew coolbeth <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: Patrick LeBoutillier <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="UTF-8"

That's interesting.  This was using my source code?
On mine (also a Linux box), it exited immediately, giving me no
opportunity to write to the pipe.

On 2010-11-23, Patrick LeBoutillier <[email protected]> wrote:
> Matthew,
>
> Does it return immediately when you start it or only when you try to
> write to the pipe with some client?
>
> Here's what I get on my Linux box:
>
> $ rm /tmp/dld.fifo && ./pipe &
> [1] 8603
> $ echo -e "1\n2\n3" > /tmp/dld.fifo
> 1
> 2
> 3
> pipe: /tmp/dld.fifo: hGetLine: end of file
>
>
> Patrick
>
>
> On Tue, Nov 23, 2010 at 7:55 AM, matthew coolbeth
> <[email protected]> wrote:
>> Hello, all.
>>
>> Three questions:
>>
>> 1> What, if anything, can I do in a Haskell program to do blocking
>> reads from a Linux FIFO?  For the curious, there is a small program
>> below that doesn't block, but immediately terminates because of an EOF
>>
>> 2> How could I have found the answer to this question on my own? (The
>> documentation that Google found for me was not completely adequate)
>>
>> 3> Is this sort of question generally regarded as too unixy or not
>> haskelly enough to be appropriate for this mailing list?
>>
>> Thanks.
>>
>> --BEGIN PROGRAM--
>> module Main () where
>>
>> import Control.Monad
>> import System.IO
>> import System.Posix.Files
>>
>> pipeString = "/tmp/dld.fifo"
>>
>> main :: IO ()
>> main = do
>>        createNamedPipe pipeString $ unionFileModes ownerReadMode
>> ownerWriteMode
>>        pipe <- openFile pipeString ReadMode
>>        forever (hGetLine pipe >>= putStrLn)
>>
>>
>> --
>> mac
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
>
> --
> =====================
> Patrick LeBoutillier
> Rosemère, Québec, Canada
>


-- 
mac


------------------------------

Message: 5
Date: Tue, 23 Nov 2010 14:14:41 +0000
From: Magnus Therning <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: matthew coolbeth <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

On Tue, Nov 23, 2010 at 12:55, matthew coolbeth <[email protected]> wrote:
> Hello, all.
>
> Three questions:
>
> 1> What, if anything, can I do in a Haskell program to do blocking
> reads from a Linux FIFO?  For the curious, there is a small program
> below that doesn't block, but immediately terminates because of an EOF
>
> 2> How could I have found the answer to this question on my own? (The
> documentation that Google found for me was not completely adequate)
>
> 3> Is this sort of question generally regarded as too unixy or not
> haskelly enough to be appropriate for this mailing list?

The behaviour is as expected from reading the documentation on
hGetLine 
(http://hackage.haskell.org/packages/archive/haskell98/latest/doc/html/IO.html#v:hGetLine).
 The same seems to be true for all functions in IO, so I suspect
you'll have to go down to a lower level where you have more control
over this behaviour, e.g. by using th fd* functions in
System.Posix.IO.

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: [email protected]   jabber: [email protected]
twitter: magthe               http://therning.org/magnus


------------------------------

Message: 6
Date: Tue, 23 Nov 2010 14:16:59 +0000
From: Magnus Therning <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: Patrick LeBoutillier <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

On Tue, Nov 23, 2010 at 14:09, Patrick LeBoutillier
<[email protected]> wrote:
> Matthew,
>
> Does it return immediately when you start it or only when you try to
> write to the pipe with some client?
>
> Here's what I get on my Linux box:
>
> $ rm /tmp/dld.fifo && ./pipe &
> [1] 8603
> $ echo -e "1\n2\n3" > /tmp/dld.fifo
> 1
> 2
> 3
> pipe: /tmp/dld.fifo: hGetLine: end of file

Would you run 'uname -a' and 'ghc --version'?

I don't see that behaviour here

% uname -a
Linux bryma 2.6.35-ARCH #1 SMP PREEMPT Sat Oct 30 21:22:26 CEST 2010
x86_64 Intel(R) Core(TM)2 Quad CPU Q9450 @ 2.66GHz GenuineIntel
GNU/Linux
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3

% rm /tmp/dld.fifo && ./pipe&
[1] 30762
% pipe: /tmp/dld.fifo: hGetLine: end of file

[1]  + exit 1     ./pipe


/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: [email protected]   jabber: [email protected]
twitter: magthe               http://therning.org/magnus


------------------------------

Message: 7
Date: Tue, 23 Nov 2010 15:43:39 +0100
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: [email protected]
Cc: Magnus Therning <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain;  charset="utf-8"

On Tuesday 23 November 2010 15:16:59, Magnus Therning wrote:
> On Tue, Nov 23, 2010 at 14:09, Patrick LeBoutillier
>
> <[email protected]> wrote:
> > Matthew,
> >
> > Does it return immediately when you start it or only when you try to
> > write to the pipe with some client?
> >
> > Here's what I get on my Linux box:
> >
> > $ rm /tmp/dld.fifo && ./pipe &
> > [1] 8603
> > $ echo -e "1\n2\n3" > /tmp/dld.fifo
> > 1
> > 2
> > 3
> > pipe: /tmp/dld.fifo: hGetLine: end of file
>
> Would you run 'uname -a' and 'ghc --version'?
>
> I don't see that behaviour here
>
> % uname -a
> Linux bryma 2.6.35-ARCH #1 SMP PREEMPT Sat Oct 30 21:22:26 CEST 2010
> x86_64 Intel(R) Core(TM)2 Quad CPU Q9450 @ 2.66GHz GenuineIntel
> GNU/Linux
> % ghc --version
> The Glorious Glasgow Haskell Compilation System, version 6.12.3
>
> % rm /tmp/dld.fifo && ./pipe&
> [1] 30762
> % pipe: /tmp/dld.fifo: hGetLine: end of file
>
> [1]  + exit 1     ./pipe

I get the same with 6.12.3 and 7.0.1.

$ uname -a
Linux linux-mkk1 2.6.27.54-0.1-pae #1 SMP 2010-10-19 18:40:07 +0200 i686 
i686 i386 GNU/Linux

>
>
> /M



------------------------------

Message: 8
Date: Tue, 23 Nov 2010 10:36:40 -0500
From: Patrick LeBoutillier <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: matthew coolbeth <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Nov 23, 2010 at 9:13 AM, matthew coolbeth
<[email protected]> wrote:
> That's interesting.  This was using my source code?

Yes, as is. I compiled it with "ghc --make pipe.hs".

I'm running Fedora 10 x64 with:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.10.1

Patrick

> On mine (also a Linux box), it exited immediately, giving me no
> opportunity to write to the pipe.
>
> On 2010-11-23, Patrick LeBoutillier <[email protected]> wrote:
>> Matthew,
>>
>> Does it return immediately when you start it or only when you try to
>> write to the pipe with some client?
>>
>> Here's what I get on my Linux box:
>>
>> $ rm /tmp/dld.fifo && ./pipe &
>> [1] 8603
>> $ echo -e "1\n2\n3" > /tmp/dld.fifo
>> 1
>> 2
>> 3
>> pipe: /tmp/dld.fifo: hGetLine: end of file
>>
>>
>> Patrick
>>
>>
>> On Tue, Nov 23, 2010 at 7:55 AM, matthew coolbeth
>> <[email protected]> wrote:
>>> Hello, all.
>>>
>>> Three questions:
>>>
>>> 1> What, if anything, can I do in a Haskell program to do blocking
>>> reads from a Linux FIFO?  For the curious, there is a small program
>>> below that doesn't block, but immediately terminates because of an EOF
>>>
>>> 2> How could I have found the answer to this question on my own? (The
>>> documentation that Google found for me was not completely adequate)
>>>
>>> 3> Is this sort of question generally regarded as too unixy or not
>>> haskelly enough to be appropriate for this mailing list?
>>>
>>> Thanks.
>>>
>>> --BEGIN PROGRAM--
>>> module Main () where
>>>
>>> import Control.Monad
>>> import System.IO
>>> import System.Posix.Files
>>>
>>> pipeString = "/tmp/dld.fifo"
>>>
>>> main :: IO ()
>>> main = do
>>>        createNamedPipe pipeString $ unionFileModes ownerReadMode
>>> ownerWriteMode
>>>        pipe <- openFile pipeString ReadMode
>>>        forever (hGetLine pipe >>= putStrLn)
>>>
>>>
>>> --
>>> mac
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://www.haskell.org/mailman/listinfo/beginners
>>>
>>
>>
>>
>> --
>> =====================
>> Patrick LeBoutillier
>> Rosemère, Québec, Canada
>>
>
>
> --
> mac
>



-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada


------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 29, Issue 32
*****************************************

Reply via email to