Search code examples
objective-cipadgcctoolchain

Compile ObjectiveC hello world on iPad 2


I'm trying to compile a ObjectiveC hello world on a jailbroken iPad 2.

The gcc already works for c/c++ on my iPad. I got OpenEXR built without problems. I copied framework headers/lib from iPhoneOS 4.2 SDK and installed "iPhone 2.0 Toolchain".

With the command:

gcc -I/private/var/include -framework Foundation hello.m

I got 2 kinds of errors:

ld warning: bad symbol version: $ld$add$os3.2$_OBJC_METACLASS_$_NSURL in dylib /System/Library/Frameworks//Foundation.framework/Foundation
ld: file not found: /usr/lib/libobjc.A.dylib

Where I can find the file "libobjc.A.dylib" or am I missing anything in the toolchain?


Solution

  • You have to find the missing lib from /var/sdk/usr/lib and copy or symlink it over the required path. Beware when you mix the "cydia" toolcahin and an SDK as you might not get what you expected (usually, a lot of warning and more libs to symlink). This is because the tools (mostly ld) think that you're using the 2.0 toolchain and warn for methods which have been introduced later.