Compile one static Haskell binary for all x86_64 Linux distributions, is it possible?

Hi, I've written a program that converts an XML file from a database into another XML compatible with another database. Quite standard. I'm using the mtl library for State and HaXml for XML parsing. Is it possible to compile this program into a single static binary that works on all Linux computers that run x86_64. My development box is an Arch Linux x86_64 running GHC 7.0.3. I tried with: ghc --make -static -rtsopts=all -optl-pthread -optl-static Program.hs When I copy the binary created over to my x86_64 Ubuntu 11.10 desktop and run it I get: Program: mkTextEncoding: invalid argument (Invalid argument) I've googled around and found out this has to do with iconv, but I've never compiled anything to run on another pc than the development machine, so I've got no experience in fixing these kinds of problems. Any help appreciated. -- Morten

I've got the same problem on Debian 6 with a program compiled on Debian 7.
Apparantly problem arises from differencies between libc versions: the
newer one uses file /usr/lib/x86_64-linux-gnu/gconv/gconv-modules,
which isn't available on the older. You can see it with strace.
On Fri, Feb 10, 2012 at 9:21 PM, Morten Olsen lysgaard
Hi, I've written a program that converts an XML file from a database into another XML compatible with another database. Quite standard. I'm using the mtl library for State and HaXml for XML parsing.
Is it possible to compile this program into a single static binary that works on all Linux computers that run x86_64. My development box is an Arch Linux x86_64 running GHC 7.0.3.
I tried with: ghc --make -static -rtsopts=all -optl-pthread -optl-static Program.hs
When I copy the binary created over to my x86_64 Ubuntu 11.10 desktop and run it I get: Program: mkTextEncoding: invalid argument (Invalid argument)
I've googled around and found out this has to do with iconv, but I've never compiled anything to run on another pc than the development machine, so I've got no experience in fixing these kinds of problems. Any help appreciated.
-- Morten
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi, Am Freitag, den 10.02.2012, 18:21 +0100 schrieb Morten Olsen lysgaard:
I tried with: ghc --make -static -rtsopts=all -optl-pthread -optl-static Program.hs
When I copy the binary created over to my x86_64 Ubuntu 11.10 desktop and run it I get: Program: mkTextEncoding: invalid argument (Invalid argument)
this is how I deploy some of my Debian related programs on Debian stable machines. After setting export GCONV_PATH=/usr/lib64/gconv this binary will work fine. (Your path might need adjustment, just find the path that contains gconv-modules and a lot of <encoding>.so files.) Greetings, Joachim -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/
participants (3)
-
Alexander Morozov
-
Joachim Breitner
-
Morten Olsen lysgaard