computing
iPhone Development on Windows & Linux with open source tools
by dreadpiratepj on Jul.21, 2009, under iphone, linux, open.source, windows
Yesterday I presented at OSCON 2009. I spoke about how to use Eclipse and the iPhone-dev team’s GCC cross-compiler to develop for iPhone on Windows & Linux. I also spoke about XMLVM, an open source project that lets you develop in Java for Android and deploy on iPhone or Palm WebOS.
You can download the slides and program examples here.
To get started with open source iPhone development, you can download the open source toolchain for Linux or for Windows/Cygwin.
Note: To use the toolchain, you need to obtain the iPhone OS headers, frameworks and libraries. You can jailbreak your device and extract the frameworks and libraries using SSH, or you can decrypt the firmware and extract the framework and libraries from the decrypted disk image. The binaries you need are /System/Library/Frameworks and /usr/lib .
You can download the headers from the iPhone-dev team’s Subversion repository with svn co http://iphone-dev.googlecode.com/svn/branches/include-1.2-sdk
To use the iPhone-dev team’s headers, you need headers for Mac OS X 10.4 SDK. Then you type this at the command line:
cd /path/to/iphone-dev/svn/branches/include-1.2-sdk
./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk
sudo bash install-headers.sh
Or you can extract them from the official iPhone SDK.
Once you get the binaries and headers, move them to /usr/local/iphone-sysroot/ . The headers go in /usr/local/iphone-sysroot/usr/include/ , frameworks go in /usr/local/iphone-sysroot/System/Library/Frameworks/ , and libraries in /usr/local/iphone-sysroot/usr/lib/ .
Then to compile and link, set CFLAGS and LDFLAGS like below :
export CFLAGS=-I/usr/local/lib/gcc/arm-apple-darwin9/4.2.1/include \
-isysroot /usr/local/iphone-sysroot
export LDFLAGS=-framework CoreFoundation -framework Foundation \
-framework UIKit -lobjc -bind_at_load -isysroot /usr/local/iphone-sysroot
Then use these compile and linker commands :
/usr/local/bin/arm-apple-darwin9-gcc -c $(CFLAGS) main.c HelloWorld.m
/usr/local/bin/arm-apple-darwin9-gcc $(LDFLAGS) HelloWorld.o main.o \
-o HelloWorld
The easiest way to set this up for each project is in a makefile. Look in the HelloWorld example in the zip file with the slides for an example.
My first book is finally a go! Woo hoo!
by dreadpiratepj on Jun.04, 2009, under game.development, iphone, life, software.development, writing
From February to April, I was working evenings and weekends fulfilling a dream I’ve had for many decades: writing a book about a subject I really care about: game development. On June 22 2009, Apress is publishing a book I collaborated on as lead author and tech reviewer : iPhone Games Projects.

There are chapters by :
- Olivier Hennessy & Clayton Kane, of Posimotion, developers of Bikini Hunt and Apache Lander
- Joachim Bondo, of Cocoa Stuff; developer of Deep Green, a beautiful chess game for iPhone
- Richard Zito & Matthew Aitken, of Swipe Interactive, developers of QuickDraw and Pole2Pole
- Aaron Fothergill, of Strange Flavour, developer of Flick Sport Fishing, one of the top 20 best selling apps on the App Store
- Brian Greenstone, of Pangea Software, developer of Enigmo and Cro-Mag Rally, two of the top 5 best selling apps on the App Store
- Mike Kasprzak, of Sykhronics Entertainment; his game Smiles was one of the finalists for Best Mobile Game on the IGF Mobile 2009 competition
- Mike Lee, co-founder of Tapulous, now at Apple, lead developer of Tap Tap Revenge, the most downloaded game on the history of the App Store
- And a bonus free chapter by Jamie Gotch, of Subatomic Studios, developers of Fieldrunners, winner of Best Mobile Game on the IGF Mobile 2009 competition
As tech reviewer for the book, I checked everyone’s writing for technical accuracy. That was really a great experience. I learned a lot and had fun running everyone’s sample code and checking their tips and tricks for myself.
I also wrote one chapter for the book, on how to implement RESTful web services for high score leaderboards and achievements on iPhone. There’s code in the chapter for a simple Rails web service, and native code for the iPhone as well. It’s a rather deep look at the subject.
I also collaborated with Jamie Gotch on a bonus free chapter. In the chapter we discussed getting started with programming for iPhone, a few tips and tricks, and the A* path finding algorithm. I also developed a Puyo clone and explained the most important parts of the code.
Full source code for the Puyo game will be provided. There is also source code for 3 other sample apps. All the sample code will be made available the same day as the book release at the book’s support page and at apress.com
This was a very neat experience for me. I’ve wanted to have my name on a computer book, and I’ve enjoyed programming games in my spare time, since before I was a teenager (more than 30 years ago, yo! Where has time gone?)
The iPhone gives me, and everyone with the interest, a chance to develop games for others, in a very cool platform with lots of traction. This book, coupled with Beginning iPhone Development, can give you the tools to reach for the stars with your own creations! Enjoy!
Obligatory Wordpress upgrade post #10101010 and other rumblings at Chez PJ
by dreadpiratepj on Nov.28, 2008, under android, gadgets, iphone, linux, open.source, pjtrix.site, software.development, upgrades, wordpress
So today I updated WordPress to 2.6.5. And like every other time, it was a cinch, all over and done in less than five minutes. Thanks, WordPress guys!
In other news, I have been geeking out with both the iPhone SDK and the Android SDK, and I believe I have a little something special going here. I hope to have it ready for release, on both platforms, sometime in January. Development continues.
I will need beta testers soon. Any T-Mobile G1 users interested in helping out, you can email me at dreadpiratepj [at] gmail [dot] com
Speaking of Android, I started playing with it now that the source code to the whole thing has been released. I managed to get Android booting on a Palm TX, but it still needs a lot of work. It boots, but it doesn’t do crap once it boots.
I get all the way to the “Press the MENU key to unlock” screen, but none of the keys do anything. Neither does touching the screen. It’s an issue with the Linux kernel drivers and device configuration. It just wasn’t made to run on a Palm TX without proper tweaking of the source. I just don’t know what the proper tweaking is.
I need to look in my bag of loot for a Palm serial cable (I’m sure I have one somewhere) and hopefully I can get a serial console from which to poke around inside Android.
I do have Android running successfully on my Sprint Touch (my parents, my sister and I have a family plan on Sprint.) Credit for that goes to Dr. Martin Johnson in New Zeland. I just use his release on my phone (before you ask, no, his release doesn’t work on the Palm TX. It’s the first thing I tried.
Can You Hear The Wind Blow
by dreadpiratepj on Oct.24, 2008, under gadgets, hacks, life, open.source, software.development, technology
Photo by liferfe.
The mobile software market is becoming very exciting, and I’ve been watching with interest. I’ve been learning iPhone development for the last ten months, first with the jailbreak toolchain, and in the last six months with the official SDK. Likewise, I’ve been dabbling with the Android SDK.
Many people have compared the growth of mobile software in the last year to the amazing growth of the early PC era.
One difference from those years, is that mobile software is already mainstream. The “personal computer” took about 20 years to “catch on,” from the introduction of the Apple I in 1977, to the Windows boom of the mid-90s. In contrast, Apple has sold over 10 million iPhones in the last 11 months alone. There are few consumers that aren’t at least aware of the iPhone’s existence. T-Mobile sold about a million Android-powered G1 phones in only one month of pre-sale orders from existing T-Mobile customers. The device can now be ordered online for new and existing accounts, although demand is expected to be very high, causing possible shortages. They claim they can sell another million G1 phones between now and the end of the year.
Another difference is the barrier to entry. Computers cost thousands of dollars in the 1980s, and were not as easy to use and develop for at the beginning. To be a developer back then, you had to be a computer engineer or someone with previous software development experience on mainframes or minicomputers, which at the time was not as widespread knowledge as in these dime-a-dozen-MCSD days. The barrier to entry was very high, economically and educationally. The barrier to entry for iPhone and Android development is very low, with devices available for less than $200 USD. If you already develop software, be it for the web, intranets, or desktops, you already have most of the skills, and a computer with which to develop. So the cost of development tools and training for these platforms is very low, especially for Android. How come it is lower for Android development, you ask?
To develop for the iPhone App Store, you need to already own a Mac with Leopard 10.5.4. So if you don’t have a Mac, that’s an extra expense. With Android, you can use the computer you already have. To put your application on the iPhone App Store, you need to pay $99 USD + tax to Apple and submit your application and say please and cross your eyes and dot your tease (double pun intended, if perhaps lame.) You can sell Android apps from the trunk of your car at a flea market if you want, but to sell them on the Android Market you need to pay $25 USD, although there is no validation or approval process. For either iPhone or Android, you need to buy a device to test on real hardware and make sure things run well.
Of course, you can always develop iPhone software for the iPhone jailbreak community, using the computer you already own, without having to pay anyone a cent, nor having to seek permission. You will still need a device on which to test on, which brings you up to par with Android in terms of barrier to entry. But then you’d be limiting your market to the 20 to 30 % of iPhone users who jailbreak their device. 200,000 – 300,000 and growing is not a bad number of potential users, though. Many of today’s software giants were founded when PC user numbers were much lower.
Anyhow, I digress. My point is that just like I heard the call of the wild and left full-time employment in a Java consulting shop for freelance web work in Rails nearly three years ago, I hear the winds of change and opportunity roaring by. And I want to get my kite out and test the wind.
As you can see, I’ve researched the market. I’m going to cut back on freelance web projects, to start dedicating time to developing a growing stable of ad-supported and for pay mobile apps, for both iPhone and Android. I can bootstrap this effort and support myself for two years on only a small portion of my savings. I believe there is enough growth in the mobile apps market to make back my investment and grow it a little bit. The monetary barrier to entry is so low, the only risk is time and effort lost if things don’t work out. If that happens, I can always go back to what I did before. But I’m not going to forgive myself if I don’t try this.
There will be other related news soon.
Meanwhile, enjoy the breeeeezeeeee. Ha ha!
Song “Can You Hear The Wind Blow”, by Whitesnake
WordPress upgraded; loot awarded
by dreadpiratepj on May.05, 2008, under upgrades, wordpress
When WordPress 2.5 was announced, I decided to stay on 2.3.x for a while. I finally upgraded to 2.5.1, and I’m glad. My Bad Behavior plugin was outdated, and WP offered to upgrade for me. It happened without a glitch. From reading the upgrade information, it seems that when 2.5.2 comes out, I’ll be able to update by just clicking a self-update button on the administrative interface.
The new WordPress administrative interface is a lot less cluttered, and more useful information is shown on the main page. The look is cleaner while remaining usable. It looks like a lot of time and effort was spent improving it.
Rather than tip my hat at the WordPress folks one more time (it’s getting old to do that every few months) I’m just going to give them Dread Pirate PJ’s Hoard of Loot lifetime award.

The image is from playrough’s photostream on Flickr.
Really excited about WordPress 2.5 upgrade
by dreadpiratepj on Mar.28, 2008, under upgrades, weblog.engines, wordpress
Over on the WordPress Development Blog, they’re pimping the upcoming WordPress 2.5 and the release candidates process before final release, and it sounds awesome. It includes a boatload of new features, but my favorite has got to be one-click plugin upgrades.
Upgrading WordPress itself is fairly easy, but upgrading your plugins can be an annoying manual process. You have to disable the plugin on the admin dashboard, download the new version, move the old files out of the way and put the new ones in place, then re-enable the plugin on the dashboard. You typically do this one plugin at a time, to check for problems and rollback as needed. Take my word, it’s annoying doing this for more than two plugins at a time, even though it is still a fairly easy process.
In 2.5, the WordPress developers have now made plugin updates as easy as in desktop applications like Firefox. That makes the whole management of the weblog much easier and more hassle-free than it ever was.
I am probably going to wait a few weeks once 2.5 is out, to let any bugs and issues shake out. But it sounds like a really worthwhile upgrade. I’m really glad to run WordPress here. Hats off once again to the WordPress developers.
Technorati Tags:
weblog.engines, upgrades, wordpress
Another article fresh out of the oven
by dreadpiratepj on Mar.15, 2008, under facebook, software.development, web.development, web.technologies
I just got word from my editor at Developer.com that my latest article was published yesterday.
The article is called “Writing Facebook Applications with Java EE” and you can find it here.
The amount of information out there on writing Facebook apps with Java is scarce, and what is out there for Java Facebook applications, is often incomplete. I hope the article helps Java Facebook developers start on the right foot.
It was interesting returning to work with Java, even if only for the few weekends during which I wrote this article. I hadn’t developed in Java at all in almost two years. I was surprised I hadn’t forgotten any important details.
I have another article for Amazon Web Services submitted and in the editing pipeline. It should be coming out in the next few weeks
Obligatory WordPress upgrade post
by dreadpiratepj on Feb.06, 2008, under personal.media, weblogs, wordpress
Hiya, folks!
As is tradition in most blogging circles, I’m posting to let you know I’ve upgraded WordPress to the latest version. My buddy Ken already beat me to it, as always.
I upgraded the Bad Behavior plugin while I was at it. One of my pet theories regarding why I have fewer akismet spam caught than other sites, like Ken’s, is that Bad Behavior blocks most malicious spam bot-like behavior. That leaves akismet with less spam getting through and being caught.
I like my pet theories, they help me sleep at night.
Starting the new year right, three weeks late
by dreadpiratepj on Jan.20, 2008, under life, software.development, weblogs, wordpress
I wanted to write this post before 2008 started, but better late than never, huh?
–
I’ve been working with Ruby on Rails for over 18 months now, and it continues to be a lot of fun. There are still challenges, as projects are never a total walk in the park. There is also new stuff to learn almost every week. The Rails team keeps improving the framework, and the community keeps authoring more plugins. Keeping up is a demanding part of the job, but it adds to the fun factor.
One activity I’ve been doing lately on my own time is learning different programming languages, development environments, and frameworks. The move to Rails from Java seems to have been a good choice career-wise, and I did it by trying to keep current on technology. I want to be ready for the next shift, whatever that may happen to be and whenever it comes into prominence.
–
After many attempts, I finally had published not just one IT-related article, but three, at IBM DeveloperWorks and Amazon Web Services Developer Portal. The articles were published between late October and late December 2007. They are:
Display Google Calendar events on your PHP Web site with XPath
Don’t Get Caught with Your Instance Down
Using Parameterized Launches to Customize Your AMIs
These articles are just the start of a shift from developing software as one of the faceless multitude of IT geeks, to being somewhat more known among my peers. I hope to turn these and other articles into presentations at software development conferences in 2008. Hopefully this enhanced exposure and networking will lead to great new things in 2008 and beyond.
–
Just before beginning this post, I updated Wordpress to the latest stable version. I am always amazed by how easy Wordpress upgrades are. Considering how easy it is to write unmaintainable crap in PHP, the Wordpress team deserves a big standing ovation for doing software right in PHP.
The theme I had up for the last year was not compatible with the change to Wordpress 2.3.x, so I picked out a totally different theme this once. It’s really simple and unobtrusive. If I get creative, I may tweak it or pick another theme altogether.
–
That’s it for now. I’ll try to post more often. Feel free to give me a nudge in the comments if I let posting to the weblog slide again.
Technorati Tags:
life, weblogs, software.development, wordpress
Much Railing Lately
by dreadpiratepj on May.15, 2007, under hacks, open.source, rails, ruby, web.architecture, web.technologies
I’ve been at my new job only four weeks, and my first project is nearly finished. My task these past four weeks has been the re-implementation of the company’s website in Rails. I was to do this from scratch, while keeping the site’s design and existing link structure. Among my requirements is adding support for multiple languages, as the company wants to show it knows how to make websites for a diverse, multi-ethnic audience. Another requirement was, that I was to do this re-implementation by myself. The company only has one other experienced Rails developer, and he is busy doing maintenance work on older non-Rails projects for company customers.
It’s been a pleasure working on this project, and I am very pleased in the progress I’ve made in such a short time. I look forward to going live in another two to three weeks, once the site has been through QA and any changes required.
—
This coming Wednesday, May 16, I am off to RailsConf 2007, in the lovely city of Portland, Oregon. Portland is great, I have been there twice and I’ve had a great time each trip. I look forward to the visit very much.
Two of my coworkers from the Williams F1 project, Kyle Drake and Nick Wright, are going to be attending RailsConf as well. It’s gonna be great to meet them face-to-face. Daniel Browning, one of my fellow coworkers at my new job, lives just north of Portland. My college buddy Ken Williams lives in the Portland area too. I plan to meet with them at some time during this, my third visit to Portland.
There are so many sessions I want to attend at RailsConf. But interestingly enough, I feel I won’t get any value out of the tutorial sessions, so I didn’t sign up for any of them. That means I’m out of the tutorial-attending n00b league, yeah!
We’ll see whether I can hang on to that thought in the other, more advanced sessions.
A few of the sessions sound downright dull. I guess some of the n00bs will find them interesting, since they’re looking for ‘insight’ and whatnot. Whatever.
What am I looking for from RailsConf? I’m looking for some nitty-gritty I can sink my teeth into, some new tech I can experiment with and learn more from. I’m looking forward to have my brain blown by something cool but complicated that I can learn over the next few months. I want to learn about some new-to-me techniques and plugins or gems that I can master and take my Ruby and Rails to a higher level.
I also look forward to meeting some people face to face. Tim Bray is going to be delivering the keynote on Saturday morning. If you’ve been reading my blog for the last year, you already know what I think of him: he’s the d00d!
The JRuby guys will be presenting one session, and I think their work is of importance for the growth of Rails outside the leading edge. I think JRuby will be the thing to help Rails cross the chasm and be adopted by mainstream.
At OSCON 2005, DHH signed my Agile Web Development With Rails 1st Edition, so I will try to get Robert Martin, Dave Thomas, and Andy Hunt to sign some of my other books that they wrote.
Anyway, I’ll talk to you all later!
Technorati Tags:
rails, ruby, hacks, open.source, web.architecture, web.technologies, railsconf
