Changes between Version 45 and Version 46 of Building/CrossCompiling/iOS


Ignore:
Timestamp:
Nov 13, 2013 10:13:42 PM (22 months ago)
Author:
lukexi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Building/CrossCompiling/iOS

    v45 v46  
    22
    33== Xcode 5 Notes ==
    4 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].
     4These instructions are for Xcode 5, which is now what we're aiming to support as Xcode 4 is no longer available.
     5
     6If you use ghc-7.6.3 on OS X as your bootstrap compiler, 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].
    57
    68To 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"}}}.
     
    911
    1012GHC 7.8 already includes a fix for this, but until that's released you'll have to use this.
    11 
    12 Also see the '''Xcode 5''' notes interspersed through these steps.
    1313
    1414== Steps ==
     
    2525You 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.
    2626
    27 > **Xcode 5**
    28 >
    29 > Do "git checkout xcode5" after cloning. Also see the note at the top of this page regarding clang-xcode5-wrapper.
    30 
    3127=== 3. Check out GHC ===
    3228
     
    3834}}}
    3935
    40 > **Xcode 5**
    41 >
    42 > You need to replace the version of libffi in libffi-tarballs with this one:
    43 > [https://github.com/ghc-ios/libffi-tarballs/blob/master/libffi-3.0.13z.tar.gz?raw=true]
    44 > It will be automatically picked up by the build system, so just deleting the old one and dropping the new one in is all you need to do.
     36You need to replace the version of libffi in libffi-tarballs with this one:
     37[https://github.com/ghc-ios/libffi-tarballs/blob/master/libffi-3.0.13z.tar.gz?raw=true]
     38It will be automatically picked up by the build system, so just deleting the old one and dropping the new one in is all you need to do.
    4539
    4640=== 4. Create a build.mk file ===
     
    5650
    5751{{{
    58 ./configure --target=arm-apple-darwin10  --with-gcc=arm-apple-darwin10-gcc
     52./configure --target=arm-apple-darwin10 --with-gcc=arm-apple-darwin10-clang
    5953make
    6054sudo make install
     
    6458
    6559{{{
    66 ./configure --target=i386-apple-darwin11 --with-gcc=i386-apple-darwin11-gcc
     60./configure --target=i386-apple-darwin11 --with-gcc=i386-apple-darwin11-clang
    6761make
    6862sudo make install
     
    7165GHC is smart enough to prefix the binaries and libraries with the target name, e.g. arm-apple-darwin10-ghc, so this will install alongside your native GHC without overwriting anything.
    7266
    73 > **Xcode 5**
    74 >
    75 > 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.
    76 
    77 
    78 
    7967=== 6. Make sure your Cabal and cabal-install are new enough ===
    8068
    81 You need a recent change,...
    82 
    83 {{{
    84 commit 9f374ab45e62924506b992db9157c970c7259a03
    85 Author: Stephen Blackheath <[email protected]>
    86 Date:   Thu Aug 29 13:09:18 2013 +1200
    87 
    88     Give the xxx_HOST_OS and xxx_HOST_ARCH options that were probed from ghc's target
    89     platform, rather than assuming HOST == BUILD. This fixes things for cross compiling.
    90 }}}
    91 
    92 ...so the best thing would be to check out the latest from [https://github.com/haskell/cabal/], and build both Cabal and cabal-install.
     69Check out the latest version of Cabal from [https://github.com/haskell/cabal/], and build both Cabal and cabal-install.
    9370
    9471The ghc-ios-scripts directory you checked out earlier contains two wrappers called {{{arm-apple-darwin10-cabal}}} and {{{i386-apple-darwin11-cabal}}}. These will pass the right arguments to cabal, so you can do, for example: