[Haskell-cafe] Haskell on OpenWRT

Patrick Pelletier code at funwithsoftware.org
Sat Apr 9 07:54:28 UTC 2016


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 at 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 at 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



More information about the Haskell-Cafe mailing list