[Haskell-cafe] Haskell on OpenWRT

Patrick Pelletier code at funwithsoftware.org
Fri Apr 15 17:53:13 UTC 2016

On 4/12/16 11:54 AM, Tomas Carnecky wrote:
> ncurses is the only library.
> Not sure how I managed to configure the crosscompiler to produce 
> static binaries, maybe it was an option which I had to pass to GHC. In 
> any case, here's a docker image which includes instructions how I 
> build the cross compiler: 
> https://github.com/wereHamster/onion-omega/tree/master/xt, and here's 
> a docker image which builds on top of that to compile a 
> cross-compiling GHC: 
> https://github.com/wereHamster/onion-omega/tree/master/ghc.

Thanks for all your help!  I now have my ghc cross-compiler working, and 
I can run simple programs on the OpenWRT box!

However, in order to build nontrivial programs, I need cabal.  The GHC 
cross-compiling page ( 
https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling ) recommends:

cabal --with-ghc=<cross-ghc> --with-ld=<ld> ...

So I expanded this approach to:

alias mcabal="cabal --with-ghc=x86_64-unknown-linux-musl-ghc 

Am I on the right track with that approach?

I'm able to install some packages with mcabal.  (For example, "mcabal 
install hourglass".)

But with cryptonite, I get:

ppelletier at patrick64:~/src/lifx/lifx-programs$ mcabal install 
--flags=-integer-gmp cryptonite
Resolving dependencies...
Configuring memory-0.12...
Building memory-0.12...
Preprocessing library memory-0.12...
failed (exit code 127)
command was: 
Failed to install memory-0.12
cabal: Error: some packages failed to install:
cryptonite-0.15 depends on memory-0.12 which failed to install.
memory-0.12 failed during the building phase. The exception was:
ExitFailure 1

I haven't been able to figure out exactly what's going on there.

Or, "mcabal install aeson" fails with:

Building aeson-
Preprocessing library aeson-
ghc: Data/Aeson/TH.hs:9:14-28: Template Haskell requires GHC with 
interpreter support
     Perhaps you are using a stage-1 compiler?
Usage: For basic information, try the `--help' option.
Failed to install aeson-
cabal: Error: some packages failed to install:
aeson- failed during the building phase. The exception was:
ExitFailure 1

Is there a way to get Template Haskell to work?  Or is that just 
impossible?  (And therefore, cross-compiling is impossible for many of 
the packages on Hackage?)  Is this a sign that I should have taken 
Lana's suggestion to use Marios's approach instead?


More information about the Haskell-Cafe mailing list