It's not often two things I love so much come together to cause me so much annoyance (besides my kids). I've written a Haskell program at work that uses libraries like text, xml-enumerator, attoparsec-text, etc. I have it working properly on my Windows machine at work, my Ubuntu virtual machine at work (32-bit), my Ubuntu desktop (32-bit again) and an EC2 instance running Ubuntu (64-bit).
Our client is running CentOS 5.3, 64-bit. I can't for the life of me get this executable to run properly. I tried creating a static executable using:
ghc --make myprog.hs -optl-static -optl-pthread
But when I try to run that executable on the CentOS server, I get an error message:
openFile: invalid argument (Invalid argument)
I'm assuming this is related to the bug described here. I've tried compiling from both 32 and 64 bit Ubuntu, tried static and shared builds, nothing works (though I occasionally get segfaults instead of the above error message). I can try downloading CentOS 5.3 and creating a virtual machine for it, but it will take a while to download, and I'm not sure which version of GHC will work on it (I tried getting GHC 7 on their server, but I ran into a libc issue).
At this point, I've come up with a few possible approaches, but I'd like to avoid these if at all possible:
As a total aside, these are the situations where I really wish we had a JVM backend for GHC. I suppose I could try out LambdaVM as well. But I'd love to hear community advice on what to do here.
This simple example "works for me":
$ cat A.hs main = print "yes" $ ghc -O2 --make -static -optc-static -optl-static A.hs -fvia-C -optl-pthread $ ldd A not a dynamic executable $ ./A "yes"
(and I've used this process, via .cabal, to ship executables for clients in the past couple of years).
I think the best bet is to file bugs, and get this working. The IHG can also fund work like this, but I'm fairly sure the GHC team would consider this a high priority, if you're trying to ship products.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With