Changes between Version 36 and Version 37 of Building/CrossCompiling/iOS


Ignore:
Timestamp:
Oct 14, 2013 4:32:20 PM (6 months ago)
Author:
lukexi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Building/CrossCompiling/iOS

    v36 v37  
    11= Building a GHC cross-compiler for Apple iOS targets = 
    22 
    3 Note: If you use ghc-7.6.3 on OS X as your bootstrap compiler and you are using Xcode version 5 or higher, you'll need to pass certain options to clang to work around some problems. A wrapper for this, written in Haskell, can be found at [https://github.com/ghc-ios/ghc-ios-scripts] (The problem is that 1. GHC tries to run a C pre-processor over Haskell code, and 2. Xcode versions >= 5 use clang instead of gcc, and 3. clang doesn't like Haskell code.) 
     3Note: If you use ghc-7.6.3 on OS X as your bootstrap compiler and you are using Xcode version 5 or higher, you'll need to pass certain options to clang to work around some problems. A wrapper for this, written in Haskell, can be found at [https://github.com/ghc-ios/ghc-ios-scripts] (The problem is that 1. GHC tries to run a C pre-processor over Haskell code, and 2. Xcode versions >= 5 use clang instead of gcc, and 3. clang doesn't like Haskell code.). To use it, compile clang-xcode5-wrapper.hs, add it to your path, then edit /usr/local/lib/ghc-7.6.3/settings and change "C compiler command"'s value to "clang-xcode5-wrapper". 
    44 
    55== Steps == 
    66 
    7 === 0. Acquire Xcode 4.6.3 === 
    8  
    9 We haven't quite finished updating GHC-iOS for Xcode 5 yet, so you'll need version 4.6.3. It contains gcc-based ARM/i386 compilers that were removed in version 5. 
    10  
    11 Happily, it will live politely next to Xcode 5 if you give it a different name. You can get it easily from Apple here: 
    12 [https://developer.apple.com/downloads/index.action?name=Xcode#] 
    13  
    14 You'll have to update the scripts in step 2 to point to the location that you copy the Xcode 4.6.3 app to. 
    15  
    167=== 1. Read ARM-specific notes === 
    178 
    18 You must use LLVM 3.0 — there seem to be issues with other versions. It's easiest to just download the binaries and put them in your path: 
     9You must use LLVM 3.0's versions of opt and llc — there seem to be issues with other versions. It's easiest to just download the binaries and put them in your path: 
    1910[http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz] 
    2011 
     
    2415 
    2516You will need to check out the scripts at [https://github.com/ghc-ios/ghc-ios-scripts] and add the checked out directory to your PATH. You may need to edit these scripts if you are using a different iOS / iOS simulator platform version than the one the scripts are pointed at. 
     17 
     18If you're using Xcode 5, do "git checkout xcode5" after cloning. Also see the note at the top of this page regarding clang-xcode5-wrapper. 
    2619 
    2720=== 3. Check out GHC === 
     
    3932 
    4033{{{ 
     34GhcStage1HcOpts    = -O -fllvm 
    4135HADDOCK_DOCS         = NO 
    4236BUILD_DOCBOOK_HTML   = NO 
     
    4842DYNAMIC_GHC_PROGRAMS = NO 
    4943GhcLibWays           = v 
    50 }}} 
    51  
    52 The iOS simulator build also requires: 
    53 {{{ 
    54 GhcStage1HcOpts    = -O -fllvm 
    5544}}} 
    5645 
     
    7463sudo make install 
    7564}}} 
     65 
     66For Xcode 5, change {{{--with-gcc=arm-apple-darwin10-gcc}}} / {{{--with-gcc=i386-apple-darwin11-gcc}}} to {{{--with-gcc=arm-apple-darwin10-clang}}} / {{{--with-gcc=i386-apple-darwin11-clang}}} , respectively. 
    7667 
    7768=== 6. Make sure your Cabal and cabal-install are new enough ===