[Haskell-cafe] Cross-compiling network package

Arie Peterson ariep at xs4all.nl
Thu Oct 6 16:27:51 UTC 2016


Can the network package be cross-compiled? I'm running into problems because
the preprocessor cannot handle some of the directives that network uses when
it's working in cross-compilation mode.

Specifically, this part gives trouble:
<https://github.com/haskell/network/blob/master/Network/Socket/Types.hsc#L1084>

> #if __GLASGOW_HASKELL__ < 800
> #let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
> #endif
> 
> instance Storable In6Addr where
> 
>     sizeOf _    = #const sizeof(struct in6_addr)
> 
> alignment _ = #alignment struct in6_addr


In my first attempt, with ghc-7.10, this failed because the "let" directive is
not supported when cross-compiling. Looking at the above code I thought I'd
try ghc-8.0, but as it turns out the "alignment" directive is also not
supported when cross-compiling...

Any ideas?

I'm compiling from x86_64 to arm-linux-gnueabihf BTW, to run my haskell
program on the raspberry pi (3).



More information about the Haskell-Cafe mailing list