ghc-ios / ghc-ios-scripts

Scripts for building GHC and Haskell programs for iOS
166 stars 27 forks source link

Define $TARGET_LD variable in the i386 ld script to avoid exec errors #16

Closed chriskilding closed 9 years ago

chriskilding commented 9 years ago

When I run cabal-ios install [foo], I get the same error on every sub-dependency of [foo] that cabal tries to compile:

Downloading random-1.1...
Configuring random-1.1...
Building random-1.1...
Preprocessing library random-1.1...
[1 of 1] Compiling System.Random    ( System/Random.hs, dist/i386/build/System/Random.o )
/Users/[me]/src/ghc-ios-scripts/i386-apple-darwin11-ld: line 7: exec: -L: invalid option
exec: usage: exec [-cl] [-a name] file [redirection ...]
Failed to install random-1.1

This seems to be because $TARGET_LD is not defined anywhere in the i386-apple-darwin11-ld script. But it is defined in the aarch64 equivalent script. If we copypasta the TARGET_LD definition from the aarch64 script to the i386 one, this exec error goes away, and cabal-ios can get further towards successfully cross-compiling a given package for the iOS simulator.

Note: I am not super familiar with ghc or cross-compilation, so there may be better solutions than what I've done. I'm largely playing whack-a-mole here as I run through the process of trying to cross-compile an existing Haskell library for iOS.

chriskilding commented 9 years ago

My bad, this is a dupe of a PR that found and fixed exactly the same problem back in last October - someone should really merge that thing!

schell commented 9 years ago

I just ran into this as well.