
I was able to compile Haskell for a mips-linux-musl target (
https://onion.io/omega). Most problems were due to the different
architecture (MIPS) than musl. Once you have a C cross-compiler (I used
http://crosstool-ng.org/ to built the cross-compiler toolchain), compiling
GHC as a cross compiler for that target and then a Haskell application
shouldn't be a problem.
If you have enough disk space on the target, I would suggest that you
compile your Haskell application into a static binary.
On Sat, Apr 9, 2016 at 10:47 AM Lana Black
You will probably have better luck using ghc with musl.
Check out this thread: https://mail.haskell.org/pipermail/haskell-cafe/2015-May/119843.html
Original Message From: Patrick Pelletier Sent: Saturday, April 9, 2016 7:54 AM To: haskell-cafe Subject: [Haskell-cafe] Haskell on OpenWRT
Has anyone had any success running Haskell programs on OpenWRT?
Specifically, I'm running OpenWRT on x86_64, so processor architecture shouldn't be an issue. However, by default OpenWRT uses musl as its C library, so binaries from a "normal" Linux system wouldn't be compatible with OpenWRT.
I attempted to get around this problem by building an OpenWRT image with glibc as the C library. In theory, that ought to solve the problem. In practice, my program (a simple hello-world type program, which runs fine on Ubuntu) hung, printing nothing, using nearly all of one core, and was unkillable by any signal other than SIGKILL. If left alone to run, it eventually used all available memory and then died.
I took a look at ldd, to see if there were any clues there. On my Ubuntu 12.04 machine, where I compiled the program (using ghc 7.4.1), I get:
ppelletier@patrick64:~/programming/haskell$ ldd contact linux-vdso.so.1 => (0x00007fff36f50000) libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f8d49cf8000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f8d49af0000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d497f3000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d495eb000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d493e7000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d49028000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8d48e0b000) /lib64/ld-linux-x86-64.so.2 (0x00007f8d49f8d000)
On my OpenWRT (trunk) box, I get:
root@OpenWrt:~# ldd /tmp/contact linux-vdso.so.1 (0x00007ffd2afcc000) libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27a057a000) libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f27a0373000) libm.so.6 => /lib/libm.so.6 (0x00007f27a0080000) librt.so.1 => /lib/librt.so.1 (0x00007f279fe79000) libdl.so.2 => /lib/libdl.so.2 (0x00007f279fc76000) libc.so.6 => /lib/libc.so.6 (0x00007f279f906000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f279f6f4000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f279f4d9000) /lib64/ld-linux-x86-64.so.2 (0x00007f27a07dc000)
This is almost the same, except it has "libgcc_s.so.1", while on the Ubuntu box it does not.
I'd welcome any ideas on how to solve (or at least diagnose) this problem. I'd also be interested in any thoughts on the broader question of running Haskell programs on OpenWRT.
Thanks,
--Patrick
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe