title: How do I install dependencies when cross compiling haskell code?
body: <p>I've successfully created a ghc cross compiler, that allows me to compile haskell code for armv6h (raspberry pi in my case) from my x64 linux machine. 
  I've successfully run a hello world program on the raspberry.</p>
  
  <p>No I want to build my real app, which has a lot of dependencies on other haskell modules.
  When I compile for x64 I simply do</p>
  
  <pre><code>cabal install dependenciy1 depenency2 ...
  </code></pre>
  
  <p>I know I could make my own programm a cabal-project an automate this step. But that's not the point here. </p>
  
  <p>When I try to use the cross-compiler </p>
  
  <pre><code>arm-unknown-linux-gnueabi-ghc --make myapp.hs
  </code></pre>
  
  <p>It tells me about modules it could not find. Of course, they are not installed!</p>
  
  <p>I read <a href="https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling" rel="noreferrer">https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling</a>
  and according to that I tried</p>
  
  <pre><code>cabal --with-ghc=arm-unknown-linux-gnueabi-ghc --with-ghc-pkg=arm-unknown-linux-gnueabi-ghc-pkg --with-ld=arm-unknown-linux-gnueabi-ld install random
  </code></pre>
  
  <p>random is the depenency I'm trying to install here. I get the following error:</p>
  
  <pre><code>Resolving dependencies...
  Configuring random-1.0.1.3...
  Failed to install random-1.0.1.3
  Last 10 lines of the build log ( /home/daniel/.cabal/logs/random-1.0.1.3.log ):
  /home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804: /home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804:      cannot execute binary file
  cabal: Error: some packages failed to install:
  random-1.0.1.3 failed during the configure step. The exception was:
  ExitFailure 126
  </code></pre>
  
  <p>When I do </p>
  
  <pre><code>file /home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>/home/daniel/.cabal/setup-exe-cache/setup-Cabal-1.18.1.3-arm-linux-ghc-7.8.3.20140804: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.10.2, not stripped
  </code></pre>
  
  <p>No wonder it can't execute it. It's compiled for arm.</p>
  
  <p>Am I missing something here? 
  My goal is to pull in all dependencies, then create a statically linked app that I can deploy on my raspberry.</p>