[Haskell-cafe] Announcing GHC iOS

Dominick Samperi djsamperi at gmail.com
Mon Sep 23 16:52:23 UTC 2013


I just tested the GHC support with Xcode 5 and iOS 7 (64-bit) and it
seems to work (using the simulator). But I wonder if an app built on
this framework would pass Apple's QA filtering process, given that
an external binary (.a) file with the Haskell code must be included?

Also, the iPhone 5S is the first with 64-bit support, and for best
performance all apps should be 64-bit (because then no 32-bit libs need
to be loaded, and there are more general purpose and floating point
registers in 64-bit mode). Are there any roadblocks preventing the
creation of 64-bit GHC/iOS7 apps?

Thanks,
Dominick



On Tue, Sep 3, 2013 at 9:45 PM, Luke Iannini <lukexi at me.com> wrote:

> That is awesome news : ). CC’ing back the list for posterity now that it’s
> sorted.
>
> I submitted a patch already that fixes the warnings you mentioned there:
> http://ghc.haskell.org/trac/ghc/ticket/8208
>
> Cheers
> Luke
>
> On Sep 3, 2013, at 6:18 PM, Dominick Samperi <djsamperi at gmail.com> wrote:
>
> Hi Luke,
>
> Thanks for your help!
>
> I managed to build (after checking out the snapshot that you
> mentioned), successfully generated haskell.a, and
> it worked on my simulator. There was a warning message at the end of
> the build (make)...I've appended it below. Your iOS Objective-C/Haskell
> integration sounds very interesting. I'll be watching ghc-devs for the
> latest news on these developments.
>
> Cheers,
> Dominick
>
> *** Warning issued at end of make ***
>
> "inplace/bin/ghc-stage1" -o
> utils/compare_sizes/dist-install/build/tmp/compareSizes.a -hisuf hi -osuf
> o -hcsuf hc -static  -H64m -O0 -fllvm    -hide-all-packages -i
> -iutils/compare_sizes/. -iutils/compare_sizes/dist-install/build
> -iutils/compare_sizes/dist-install/build/autogen
> -Iutils/compare_sizes/dist-install/build
> -Iutils/compare_sizes/dist-install/build/autogen     -optP-include
> -optPutils/compare_sizes/dist-install/build/autogen/cabal_macros.h -package
> base-4.7.0.0 -package directory-1.2.0.1 -package filepath-1.3.0.2
> -XHaskell98  -no-user-package-db -rtsopts      -odir
> utils/compare_sizes/dist-install/build -hidir
> utils/compare_sizes/dist-install/build -stubdir
> utils/compare_sizes/dist-install/build
> utils/compare_sizes/dist-install/build/Main.o
>
> <no location info>:
>     Warning: Couldn't figure out linker information!
>              Make sure you're using GNU ld, GNU gold or the built in OS X
> linker, etc.
> ld: warning: could not create compact unwind for .LFB3: non-standard
> register 5 being saved in prolog
> ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic)
> not allowed in code signed PIE, but used in _s1p4_entry from
> utils/compare_sizes/dist-install/build/Main.o. To fix this warning, don't
> compile with -mdynamic-no-pic or link with -Wl,-no_pie
>
>
>
> On Mon, Sep 2, 2013 at 11:46 PM, Luke Iannini <lukexi at me.com> wrote:
>
>> Hi Dominick, great!! Now you’re just hitting a normal GHC build failure
>> that apparently hasn’t been fixed yet in HEAD : )).
>>
>> Check out 98b0d05de35bd531102d832f3108050549fd781f from a few days ago
>> and you should be able to build to completion now…
>>
>> The build process will use a combo of clang and gcc, depending on whether
>> it’s building code to run on the host or the target. The core libraries
>> that get installed into /usr/local/ghc-ios-sim/lib at the end of the build
>> should be i386.
>>
>> The FFI does indeed only support C, but happily Objective-C is basically
>> just syntactic sugar for C and can be called from a completely C API —
>> https://github.com/jspahrsummers/ObjectiveHaskell/ is a project that
>> takes advantage of this and makes a nicer Objective-C/Haskell bridging
>> experience. I’ll have a version up very shortly that’s set up to work with
>> GHC iOS.
>>
>> There’s also some work to do a more native Objective-C FFI underway to
>> look forward to : )
>> Cheers
>> Luke
>>
>> On Sep 2, 2013, at 8:09 PM, Dominick Samperi <djsamperi at gmail.com> wrote:
>>
>> Hello Luke,
>>
>> Thanks for your patience. I configured build.mk with more care, using
>> BuildFlavour = quick-llvm, and adding options as needed, for example,
>> INTEGER_LIBRARY = integer-simple. I've attached my build.mk.
>>
>> This seems to have cleared up the terminfo issue, and the build
>> ran for a long time, but ultimately it failed with a ghc-stage1 panic
>> (the "impossible" happened). I've attached makelog.txt.
>>
>> I added the following directories at the beginning of PATH:
>> 1. ~/bin/ghc/ghc-ios-scripts-master
>> 2. ~/bin/clang+llvm-3.0-x86_64-apple-darwin11/bin
>>
>> The second directory is needed because locate does not find
>> lcc or opt on my system, it only finds /usr/bin/clang.
>>
>> I'm confused by a few things. I'm building for i386-apple-ios (a
>> 32 bit architecture), yet the libraries in (2) are for 64bit? Also, it
>> is not clear if the build process is using clang or gcc (or gcc-llvm?).
>>
>> Looking ahead to the time when I get this to work, I'm curious
>> about what has been accomplished. The FFI only supports interfaces
>> to C, not Objective-C or C++. Thus, it seems to me that to develop
>> an app using Haskell only the lowest common denominator
>> language can be used, namely C. Is this correct?
>>
>> Thanks again for your help!
>>
>> Dominick
>>
>>
>>
>> On Mon, Sep 2, 2013 at 6:51 PM, Luke Iannini <lukexi at me.com> wrote:
>>
>>> One more thing to try that might just get you going while we figure out
>>> the actual bug:
>>> Just go through ghc.mk and delete all the lines that include terminfo
>>> (just 394 and 443 I think), then perl boot again.
>>>
>>> On Sep 1, 2013, at 7:51 PM, Dominick Samperi <djsamperi at gmail.com>
>>> wrote:
>>>
>>> OK, I tried your "in the dark" suggestion but there was no
>>> change (same problem).
>>>
>>> I'm attaching configurelog.txt and makelog.txt...
>>>
>>>
>>> On Sun, Sep 1, 2013 at 10:12 PM, Luke Iannini <lukexipd at gmail.com>wrote:
>>>
>>>> Hi Dominick,
>>>>
>>>> Switching to private just to keep from spamming the list too much : )
>>>> (I'll post again when we figure it out) — could you also send me the output
>>>> of ./configure? (e.g. on http://gist.github.com or http://lpaste.net)
>>>>
>>>> Also, just poking in the dark here: what if you change
>>>> ifneq "$(HostOS_CPP)" "ios"
>>>> to
>>>> ifneq "$(TargetOS_CPP)" "ios"
>>>>
>>>> on line 393 of ghc.mk and then re-run perl boot/configure?
>>>>
>>>> Thanks!
>>>> Cheers
>>>> Luke
>>>>
>>>>
>>>> On Sun, Sep 1, 2013 at 4:58 PM, Dominick Samperi <djsamperi at gmail.com>wrote:
>>>>
>>>>> Hello Luke,
>>>>>
>>>>> Thanks for the note. I'm testing on OS X 10.8.4, Xcode 4.6.3, and
>>>>> llvm-gcc 4.2.1
>>>>> (I placed the scripts directory ghc-ios-scripts-master at the front of
>>>>> PATH).
>>>>> LVM Build is 2336.11.00.
>>>>>
>>>>> I fetched GHC sources and tried to build using:
>>>>>
>>>>> $ git clone git://git.haskell.org/ghc.git
>>>>> $ cd ghc
>>>>> $ ./sync-all --no-dph get
>>>>>
>>>>> $ perl boot # after creating mk/build.mk
>>>>> $ ./configure --target=i386-apple-darwin11 --prefix=/usr/local/ghc-ios-sim/
>>>>> $ make
>>>>>
>>>>> # Fails saying terminfo -any is not available
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Sep 1, 2013 at 7:39 PM, Luke Iannini <lukexipd at gmail.com>wrote:
>>>>>
>>>>>> Hi Dominick,
>>>>>> Hm, this should have been fixed by
>>>>>> http://ghc.haskell.org/trac/ghc/ticket/7700 .
>>>>>>
>>>>>> When you say you downloaded GHC, do you mean you cloned GHC HEAD
>>>>>> (e.g. git clone git://git.haskell.org/ghc.git ?) — the patches have
>>>>>> only just landed : ).
>>>>>>
>>>>>> Also can you give us an idea of what your build environment is? (OS
>>>>>> version, Xcode version etc)
>>>>>>
>>>>>> Cheers
>>>>>> Luke
>>>>>>
>>>>>>
>>>>>> On Sun, Sep 1, 2013 at 4:32 PM, Dominick Samperi <djsamperi at gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I followed the instructions on the link, downloaded ghc, created
>>>>>>> build.mk, etc.,
>>>>>>> and configured for ghc-ios-sim. But the make fails with the message
>>>>>>> below.
>>>>>>> Tried installing terminfo (cabal install terminfo) but this didn't
>>>>>>> help...
>>>>>>>
>>>>>>> ghc $ make
>>>>>>> ===--- building phase 0
>>>>>>> make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
>>>>>>> make[1]: Nothing to be done for `phase_0_builds'.
>>>>>>> ===--- building phase 1
>>>>>>> make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
>>>>>>> "inplace/bin/ghc-cabal" check utils/ghc-pkg
>>>>>>> A 'license-file' is not specified.
>>>>>>> "inplace/bin/ghc-cabal" configure utils/ghc-pkg dist-install ""
>>>>>>> --with-ghc="/Users/dsamperi/
>>>>>>> bin/ghc/ghc/inplace/bin/ghc-stage1"
>>>>>>> --with-ghc-pkg="/Users/dsamperi/bin/ghc/ghc/inplace/bin/ghc-pkg"
>>>>>>> --disable-library-for-ghci --disable-library-vanilla
>>>>>>> --disable-library-profiling --disable-shared --configure-option=CFLAGS="
>>>>>>> -U__i686 -fno-stack-protector   " --configure-option=LDFLAGS="   "
>>>>>>> --configure-option=CPPFLAGS="   "
>>>>>>> --configure-option=--host=i386-apple-darwin11
>>>>>>> --with-gcc="/Users/dsamperi/bin/ghc/ghc-ios-scripts-master/i386-apple-darwin11-gcc"
>>>>>>> --with-ld="/Users/dsamperi/bin/ghc/ghc-ios-scripts-master/i386-apple-darwin11-ld"
>>>>>>> --configure-option=--with-cc="/Users/dsamperi/bin/ghc/ghc-ios-scripts-master/i386-apple-darwin11-gcc"
>>>>>>> --with-ar="/opt/local/bin/ar" --with-ranlib="ranlib"
>>>>>>> --with-alex="/usr/bin/alex" --with-happy="/usr/bin/happy"
>>>>>>> Configuring ghc-pkg-6.9...
>>>>>>> ghc-cabal: At least the following dependencies are missing:
>>>>>>> terminfo -any
>>>>>>> make[1]: *** [utils/ghc-pkg/dist-install/package-data.mk] Error 1
>>>>>>> make: *** [all] Error 2
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Aug 30, 2013 at 5:04 AM, Simon Peyton-Jones <
>>>>>>> simonpj at microsoft.com> wrote:
>>>>>>>
>>>>>>>>  Great.  Please thank Stephen too.. I don’t have his email.****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> Just go ahead and modify ****
>>>>>>>>
>>>>>>>> http://ghc.haskell.org/trac/ghc/wiki/CodeOwners****
>>>>>>>>
>>>>>>>> http://ghc.haskell.org/trac/ghc/wiki/Platforms****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> I assume iOS will become a tier-2 platform?****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> Simon****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> *From:* Luke Iannini [mailto:lukexipd at gmail.com]
>>>>>>>> *Sent:* 30 August 2013 09:07
>>>>>>>> *To:* Simon Peyton-Jones
>>>>>>>> *Cc:* Austin Seipp
>>>>>>>> *Subject:* Re: [Haskell-cafe] Announcing GHC iOS****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> Certainly! And I'd be happy to take on maintainership of GHC iOS if
>>>>>>>> that's what you mean — I've committed to a very large project using it so
>>>>>>>> I'll be maintaining it anyway : ). I'd guess Stephen would feel the same.
>>>>>>>> ****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> And thanks so much for the kind words, it means the world! Thank
>>>>>>>> you infinitely for Haskell : ).****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> Cheers****
>>>>>>>>
>>>>>>>> Luke****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> On Fri, Aug 30, 2013 at 12:32 AM, Simon Peyton-Jones <
>>>>>>>> simonpj at microsoft.com> wrote:****
>>>>>>>>
>>>>>>>>  Should we update the “Platform maintainers” on
>>>>>>>> http://ghc.haskell.org/trac/ghc/wiki/TeamGHC****
>>>>>>>>
>>>>>>>> or the list of supported platforms on
>>>>>>>> http://ghc.haskell.org/trac/ghc/wiki/Platforms?****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> *From:* Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] *On
>>>>>>>> Behalf Of *Luke Iannini
>>>>>>>> *Sent:* 29 August 2013 21:56
>>>>>>>> *To:* Haskell Cafe
>>>>>>>> *Subject:* Re: [Haskell-cafe] Announcing GHC iOS****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> Stephen provided some more credits — thanks so much to all!****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> Three connected projects concerning cross-compilation:****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> *Registerised ARM support, added using David Terei's LLVM compiler
>>>>>>>> back end with Stephen Blackheath doing an initial ARMv5 version and LLVM
>>>>>>>> patch and Karel Gardas working on floating point support, ARMv7
>>>>>>>> compatibility and LLVM headaches. Ben Gamari did work on the runtime linker
>>>>>>>> for ARM.****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> *General cross-compiling, with much work by Stephen Blackheath and
>>>>>>>> Gabor Greif (though many others have worked on this).****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> *A cross-compiler for Apple iOS. iOS-specific parts were mostly
>>>>>>>> Stephen Blackheath with Luke Iannini on the Cabal patch, testing and
>>>>>>>> supporting infrastructure, also with assistance and testing by Miëtek Bak
>>>>>>>> and Jonathan Fischoff, and thanks to many others for testing; The iOS cross
>>>>>>>> compiler was started back in 2009 by Stephen Blackheath with funding from
>>>>>>>> Ryan Trinkle of iPwn Studios.****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> Thanks to Ian Lynagh for making it easy for us with integration,
>>>>>>>> makefile refactoring and patience, and to David Terei for LLVM assistance.
>>>>>>>> ****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> On Thu, Aug 29, 2013 at 1:43 PM, Luke Iannini <lukexipd at gmail.com>
>>>>>>>> wrote:****
>>>>>>>>
>>>>>>>>  Hi all!****
>>>>>>>>
>>>>>>>> (in case you don't read /r/haskell : ))****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> Stephen Blackheath and I are extremely happy to report that as of
>>>>>>>> today, GHC can natively build binaries for iOS devices and the iOS
>>>>>>>> Simulator.****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> You'll find everything you need here:
>>>>>>>> http://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS***
>>>>>>>> *
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> The short of it is you can use "ghc-ios myFiles.hs" to get a
>>>>>>>> universal ARMv7/ARMv7s/i386 static library to drop straight into an Xcode
>>>>>>>> project.****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> Stephen's already working on some wonderful FRP-powered games, I'm
>>>>>>>> working on a project called SpaceTime that I'll announce shortly, and you
>>>>>>>> may now all begin creating insanely great iOS software using the finest
>>>>>>>> language in the world : ).****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> Stephen deserves the lion's share of the credit for this project —
>>>>>>>> it's been over 3 years in the making! Many thanks to Maxwell Swadling for
>>>>>>>> generalizing static library builds into a -staticlib flag for GHC, Carter
>>>>>>>> Schonwald for compilation guidance, and the venerable Austin Seipp for
>>>>>>>> reviewing and merging our patches.****
>>>>>>>>
>>>>>>>>  ****
>>>>>>>>
>>>>>>>> ** **
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> ghc-devs mailing list
>>>>>>>> ghc-devs at haskell.org
>>>>>>>> http://www.haskell.org/mailman/listinfo/ghc-devs
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> ghc-devs mailing list
>>>>>>> ghc-devs at haskell.org
>>>>>>> http://www.haskell.org/mailman/listinfo/ghc-devs
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>> <configurelog.txt><makelog.txt>
>>>
>>>
>>>
>> <makelog.txt><build.mk>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130923/a53ef64d/attachment.htm>


More information about the ghc-devs mailing list