[gambit-list] Building Gambit for recent iOS

mikel evins mevins at me.com
Thu Dec 23 02:16:33 EST 2010


On Dec 22, 2010, at 10:45 AM, Raffael Cavallaro wrote:

> I'd like to ask, on behalf of myself and the many lurking here, that once you get this working you put up a blog post or a message here detailing all that's necessary to get a working gambit iOS 4.2 project under Xcode. I'm sure there are many in the scheme/lisp community who would welcome the opportunity to develop iOS apps using gambit  - I know that some people at Clozure have already expressed interest for example.

In respect of your request, and also just to provide context for my own future reference, as well as for anyone else who's interested in this subject, let me just summarize where I'm at in this process.

I have a version of Delectus 1.0 that builds with no trouble at all under the latest Apple dev tools and the stock Gambit 4.6.0. That version of Delectus is about 4,000 lines of Scheme code and about 1,000 lines of Objective-C code. 

The difference between the working version of Delectus and what I've been trying to accomplish in these conversations is that the working version is a full Cocoa app written mainly in Scheme, including its main program, and compiled using gsc, bypassing XCode entirely. What I'm trying to do now is build the non-GUI portion of Delectus (which I'll call the "delectus engine") as a library that I can link is a normal fashion in an ordinary XCode application.

If I have a working Delectus build, why would I try to build it a different way?

One reason is that I and my colleagues have some plans in mind for the delectus engine on platforms other than Mac OS X. To make those plans easier to achieve, it would be nice to build the delectus engine as a library. That would make it convenient to package the engine so that it can be used in various contexts while presenting an identical API and using an identical file format for the data it manages.

A special case is iOS. We have plans to use it for an iPad app. It would be most convenient if we could present the delectus engine as a static library (the only kind supported by XCode for iOS development). It may be that I can build an iOS app in the same way that I have been building a Mac OS app: with a Scheme main, running Apple's dev tools from the command line driven by a Makefile, but there are some additional considerations. iOS apps for the app store need several additional resources, including code-signing resources that are normally built and attached automatically by XCode. For simplicity's sake, I'd rather just build apps the normal way that Apple expects, rather than trying to figure out how to build and attach all the needed resources without XCode's help.

Moreover, I'd like to offer Delectus through the new Mac App Store, and the process for submitting apps to the Mac App Store is much the same as submitting them through the iOS App Store.

For these reasons, it makes more sense to me to figure out how to build the delectus engine as a library and link to it in regular XCode projects, than to continue my past practice of building apps without XCode, by using a makefile to drive gsc. Unfortunately, I am so far unable to get an XCode project to link successfully to a library built by gsc. Using what Marc's given me so far I can build such a library, and I can add it to an XCode project and tell XCode to link to it, but when I add code that tries to call entry points exposed by c-define, or when I try to call the SCHEME_LIBRARY_LINKER routine as given in the tests/client.c example, XCode's linker complains that those symbols are not found.

I'll keep poking at it. Running "make test8" in the modified Gambit I'm using seems to complete without incident (at least, no error output is produced). Looking at the code and the makefiles, it looks like that's what should happen if everything works right. I may try something like harvesting that code and trying to turn it into a simple XCode project, to see what, if anything, goes wrong.

--me




More information about the Gambit-list mailing list