ghc-iphone with recent OSX & XCode
Hello, I was wondering if anyone has been developing iOS 4.2 apps on Snow Leopard using a recent version of Xcode (3.2.5) The top-level issue for me is that the ghc-iphone binary I got from http://projects.haskell.org/ghc-iphone/ is trying to compile with i686-apple-darwin9-gcc-4.0.1 but the version on my machine is i686-apple-darwin10-gcc-4.0.1. Symlinking 10 to 9 throws a ton of errors about missing "Math.h" and many other headers, which may also be because things have been renamed and moved around a bit. I just thought I would ask first, has anyone already come across this problem? If you are familiar with this project enough to suggest a solution please do. Thanks, and kudos to all those working hard to make Haskell applications on iPad a possibility! Thomas Burt
Thomas, Good timing. I just sorted this out. The version I posted recently (namely ghc-iphone-binary-1.5-sdk-3.0.tar.bz2) was built with an old Xcode, against SDK 3.0. The symlink you describe is the correct thing to do. cd /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin sudo ln -s i686-apple-darwin10-gcc-4.0.1 i686-apple-darwin9-gcc-4.0.1 2. Inside the xcode_3.2.5_and_ios_sdk_4.2_final.dmg volume there's a directory called Packages, which the finder doesn't let you get to. Go in with the command line and copy the file iPhoneSDK3_0.pkg onto the desktop or somewhere you can get to it with the finder. Install that by double-clicking. SDK3.0 seems like the best choice for the AppStore now, since it's the lowest you can get away with. You may find that with SDK3.0 present, it will work if you set your project to iOS 4.2. The other option, if you want to use the new SDK, is to build GHC-iPhone from source, which should not be difficult, though when I switched from SDK 2.2.1 to SDK 3.0 I needed to make a minor change (I added this as a patch to the source code directory). Newer versions of GHC are on their way for Android, and we will probably end up porting back to iPhone. Keegan McAllister (kmc) is working on that. --- Having said all that, I'm now getting link errors, like this: Undefined symbols: "_OBJC_CLASS_$_NSAutoreleasePool", referenced from: objc-class-ref-to-NSAutoreleasePool in main.o objc-class-ref-to-NSAutoreleasePool in AppController.o "_OBJC_CLASS_$_NSTimer", referenced from: objc-class-ref-to-NSTimer in AppController.o "_OBJC_CLASS_$_NSValue", referenced from: objc-class-ref-to-NSValue in AppController.o "_OBJC_CLASS_$_NSBundle", referenced from: I tried changing from gcc 4.2 to gcc 4.0 like this: project top level in the tree view and selecting GetInfo, then Build tab, then C/C++ compiler version to 4.0. But that didn't work either. Now I'm getting this: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:13: error: syntax error before 'AT_NAME' token So, I'll see what I can do about this and post again. Steve On 20/12/10 1:21 PM, thomas burt wrote:
Hello,
I was wondering if anyone has been developing iOS 4.2 apps on Snow Leopard using a recent version of Xcode (3.2.5)
The top-level issue for me is that the ghc-iphone binary I got from http://projects.haskell.org/ghc-iphone/ is trying to compile with i686-apple-darwin9-gcc-4.0.1 but the version on my machine is i686-apple-darwin10-gcc-4.0.1.
Symlinking 10 to 9 throws a ton of errors about missing "Math.h" and many other headers, which may also be because things have been renamed and moved around a bit.
I just thought I would ask first, has anyone already come across this problem? If you are familiar with this project enough to suggest a solution please do.
Thanks, and kudos to all those working hard to make Haskell applications on iPad a possibility!
Thomas Burt
_______________________________________________ iPhone mailing list iPhone@haskell.org http://www.haskell.org/mailman/listinfo/iphone
Thomas, There were a number of problems, so it took a bit of persuading. I've got it working on the simulator only so far. One of the problems was to do with "UNIX2003 decorations". Apparently Xcode 3.2.5 only works for simulator builds if you use the latest SDK, namely 4.2. The error if you get this wrong is this at runtime: --- Detected an attempt to call a symbol in system libraries that is not present on the iPhone: munmap$UNIX2003 called from function gen_map_mblocks --- According to posts on the web, this isn't a problem for the device. So, I've posted a simulator-only version of GHC-iPhone for Xcode 3.2.5, so you can get developing, and once I get the remaining problems out, I'll post a complete version. (It's quite slow to try things and re-compile.) I'm trying to get some work done on the device this week if I can. The file is ghc-iphone-binary-1.5.1-sdk-4.2-simulator-only.tar.bz2 at the usual GHC-iPhone download location: http://dev.ipwnstudios.com/ghc-iphone/ (If it's not there when you read this, please wait a while - my network connection is behaving very badly.) Set your SDK to 4.2, and C compiler to GCC-4.2 (in the 'GetInfo' dialog at the top-level of your project tree on the left). Steve On 20/12/10 1:55 PM, Stephen Blackheath [to GHC-iPhone] wrote:
Thomas,
Good timing. I just sorted this out.
The version I posted recently (namely ghc-iphone-binary-1.5-sdk-3.0.tar.bz2) was built with an old Xcode, against SDK 3.0. The symlink you describe is the correct thing to do.
cd /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin sudo ln -s i686-apple-darwin10-gcc-4.0.1 i686-apple-darwin9-gcc-4.0.1
2. Inside the xcode_3.2.5_and_ios_sdk_4.2_final.dmg volume there's a directory called Packages, which the finder doesn't let you get to. Go in with the command line and copy the file iPhoneSDK3_0.pkg onto the desktop or somewhere you can get to it with the finder. Install that by double-clicking.
SDK3.0 seems like the best choice for the AppStore now, since it's the lowest you can get away with. You may find that with SDK3.0 present, it will work if you set your project to iOS 4.2. The other option, if you want to use the new SDK, is to build GHC-iPhone from source, which should not be difficult, though when I switched from SDK 2.2.1 to SDK 3.0 I needed to make a minor change (I added this as a patch to the source code directory).
Newer versions of GHC are on their way for Android, and we will probably end up porting back to iPhone. Keegan McAllister (kmc) is working on that.
---
Having said all that, I'm now getting link errors, like this:
Undefined symbols: "_OBJC_CLASS_$_NSAutoreleasePool", referenced from: objc-class-ref-to-NSAutoreleasePool in main.o objc-class-ref-to-NSAutoreleasePool in AppController.o "_OBJC_CLASS_$_NSTimer", referenced from: objc-class-ref-to-NSTimer in AppController.o "_OBJC_CLASS_$_NSValue", referenced from: objc-class-ref-to-NSValue in AppController.o "_OBJC_CLASS_$_NSBundle", referenced from:
I tried changing from gcc 4.2 to gcc 4.0 like this: project top level in the tree view and selecting GetInfo, then Build tab, then C/C++ compiler version to 4.0.
But that didn't work either. Now I'm getting this:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:13: error: syntax error before 'AT_NAME' token
So, I'll see what I can do about this and post again.
Steve
On 20/12/10 1:21 PM, thomas burt wrote:
Hello,
I was wondering if anyone has been developing iOS 4.2 apps on Snow Leopard using a recent version of Xcode (3.2.5)
The top-level issue for me is that the ghc-iphone binary I got from http://projects.haskell.org/ghc-iphone/ is trying to compile with i686-apple-darwin9-gcc-4.0.1 but the version on my machine is i686-apple-darwin10-gcc-4.0.1.
Symlinking 10 to 9 throws a ton of errors about missing "Math.h" and many other headers, which may also be because things have been renamed and moved around a bit.
I just thought I would ask first, has anyone already come across this problem? If you are familiar with this project enough to suggest a solution please do.
Thanks, and kudos to all those working hard to make Haskell applications on iPad a possibility!
Thomas Burt
_______________________________________________ iPhone mailing list iPhone@haskell.org http://www.haskell.org/mailman/listinfo/iphone
All, At http://projects.haskell.org/ghc-iphone/ there's a new GHC-iPhone binary, version 1.6. Direct URL is http://dev.ipwnstudios.com/ghc-iphone/ghc-iphone-binary-1.6-sdk-4.2.tar.bz2 The source code, in the form of patches is at http://projects.haskell.org/ghc-iphone/patches/sdk4.2-on-snowleopard/ This is just the old GHC-6.10.4 to iPhone cross compiler, built on Snow Leopard and updated to work with Xcode 3.2.5 and iOS SDK 4.2. Set your project SDK to 4.2. (Select top level of project tree at left and select Get Info, then go to the 'Build' tab and scroll down. Do this once for Simulator and once for Device.) Compiling to old SDKs - necessary for app store deployment: When I set SDK to iOS 4.2 and 'deployment target' to iOS 3.0, the code worked fine on my old iPod Touch with iOS 3.0 installed. Steve
participants (2)
-
Stephen Blackheath [to GHC-iPhone] -
thomas burt