
Hi, I need to check if a couple of files have the same number of lines in them. So, I written a little Haskell program that counts the number of lines in a file. import System.Environment (getArgs) main :: IO () main = do [f] <- getArgs cs <- readFile f print $ length (lines cs) Now, when I invoke the program on my computer, it does what it should do: ~ $ ./count count.hs 7 However, when I run the program on a different computer, I get the following: ~ $ scp count count.hs thomas\@...:~ thomas@...'s password: count 100% 492KB 492.2KB/s 00:00 count.hs 100% 125 0.1KB/s 00:00 ~ $ ssh thomas@... [thomas@... ~] $ ./count count.hs count: timer_create: Invalid argument [thomas@... ~]$ What does this error message mean? And why does it occur? Other programs that I written and compiled on my computer worked just fine on the other. I run Arch Linux and I am using GHC 6.10.3, the other computer is a RedHat 3. Cheers, Thomas

Am Montag 08 Juni 2009 16:35:22 schrieb Thomas Friedrich:
Hi,
[thomas@... ~] $ ./count count.hs count: timer_create: Invalid argument [thomas@... ~]$
What does this error message mean? And why does it occur? Other programs that I written and compiled on my computer worked just fine on the other. I run Arch Linux and I am using GHC 6.10.3, the other computer is a RedHat 3.
Do other Haskell programmes compiled with ghc-6.10.3 on Arch run on Red Hat 3? I think the timer_create is called during initialisation of the run-time, for +RTS -sstderr and such, probably RH3 has an older timer_create which doesn't like the passed argument. Then no ghc-compiled programme from Arch should run on RH3, nor should C programmes using timer_create with like arguments.
Cheers, Thomas

Now, when I invoke the program on my computer, it does what it should do: (...) However, when I run the program on a different computer, I get the following: (...) [thomas@... ~] $ ./count count.hs count: timer_create: Invalid argument
I don't know where time_create is exactly used here, however, it seems like a linking problem. Have you tried rebuilding your program in the remote machine? Actually, the fact that other programs did succeed seems strange to me. You could show some program that did work on both machines if you want to know why it actually worked. If you don't want to rebuild, why not to use it as a script? You can do it by just adding this first line to your file: #!/usr/bin/runhaskell and allowing it to be used as a script: chmod a+x count.hs I usually add such scripts to ~/bin so I can run then anywhere (but check if your distribution do add ~/bin to path). Maurício

Hi Mauricio, yes it is a linking problem. When I compile the program on my computer with ghc --make A.hs -threaded the program will run on the Red Hat 3. If I compile it with ghc --make A.hs it won't. I don't know why though, and I don't think this is an expected behavior. Daniel suggested to file a bug report on this. I've never done that before. Where would I do this? Is there something I should know about filing a bug? I cannot compile the program on the Red Hat machine, as GHC is not installed there and I only have user rights. Cheers, Thomas Maurício wrote:
Now, when I invoke the program on my computer, it does what it should do: (...) However, when I run the program on a different computer, I get the following: (...) [thomas@... ~] $ ./count count.hs count: timer_create: Invalid argument
I don't know where time_create is exactly used here, however, it seems like a linking problem. Have you tried rebuilding your program in the remote machine? Actually, the fact that other programs did succeed seems strange to me. You could show some program that did work on both machines if you want to know why it actually worked.
If you don't want to rebuild, why not to use it as a script? You can do it by just adding this first line to your file:
#!/usr/bin/runhaskell
and allowing it to be used as a script:
chmod a+x count.hs
I usually add such scripts to ~/bin so I can run then anywhere (but check if your distribution do add ~/bin to path).
Maurício
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

It seems it's a know question: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/49337 One of the problems discussed in that thread is the timer_create issue, but it seems upgrading is the sugested solution. Did Daniel mean to open a bug report on Red Hat or GHC? If you ever want to report a bug on GHC: http://haskell.org/ghc The ReportABug link do have nice instructions. But maybe this is worth discussing in haskell-cafe first, so I posted a message there: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/59643 Best, Maurício
Hi Mauricio,
yes it is a linking problem. When I compile the program on my computer with
ghc --make A.hs -threaded
the program will run on the Red Hat 3. If I compile it with
ghc --make A.hs
it won't. I don't know why though, and I don't think this is an expected behavior. Daniel suggested to file a bug report on this. I've never done that before. Where would I do this? Is there something I should know about filing a bug?
I cannot compile the program on the Red Hat machine, as GHC is not installed there and I only have user rights.
Cheers, Thomas
Maurício wrote:
Now, when I invoke the program on my computer, it does what it should do: (...) However, when I run the program on a different computer, I get the following: (...) [thomas@... ~] $ ./count count.hs count: timer_create: Invalid argument
I don't know where time_create is exactly used here, however, it seems like a linking problem. Have you tried rebuilding your program in the remote machine? Actually, the fact that other programs did succeed seems strange to me. You could show some program that did work on both machines if you want to know why it actually worked.
If you don't want to rebuild, why not to use it as a script? You can do it by just adding this first line to your file:
#!/usr/bin/runhaskell
and allowing it to be used as a script:
chmod a+x count.hs
I usually add such scripts to ~/bin so I can run then anywhere (but check if your distribution do add ~/bin to path).
Maurício
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Jun 8, 2009, at 10:35 , Thomas Friedrich wrote:
However, when I run the program on a different computer, I get the following:
~ $ scp count count.hs thomas\@...:~ thomas@...'s password: count 100% 492KB 492.2KB/s 00:00 count.hs 100% 125 0.1KB/s 00:00 ~ $ ssh thomas@... [thomas@... ~] $ ./count count.hs count: timer_create: Invalid argument
Yep. This is due to differences between the installed glibc on the two systems; the Haskell runtime uses the appropriate timer_create code (necessary for threading) for the system it was built for, on other systems you can get the above error. I see this a lot with local supported ghc builds, especially when trying to bootstrap from an existing binary. All you can realistically do is relink the program on each system, which must have the appropriate compatible ghc runtime installed already. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (4)
-
Brandon S. Allbery KF8NH
-
Daniel Fischer
-
Maurício
-
Thomas Friedrich