Building 1.8 for iOS, iPhone, iPad using cmake/command line

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Building 1.8 for iOS, iPhone, iPad using cmake/command line

Post by cheshirekow »

Recently I went through the painstaking process of building Ogre 1.8 and all of it's dependencies from source for iOS and the simulator. I'm new to Xcode, and I really don't like it. Perhaps it will grow on me, but in any case I feel like it hides what it's doing way to much, and I had a hard time debugging problems that arose. Consequently, I ended up building everything using command line tools.

I documented the entire process including the commands I used to build each of the libraries for both the simulator and an iOS device. In order to put this documentation in a more permenant place than my harddrive (selfish reasons) and for posterity (altruistic reasons), I'll post to this thread my notes for each of the libraries.

Relevant Compiler Flags:

Architecture
  • -arch i386 or i686 (seem to by synonymous) for simulator
  • -arch armv7 for newer iOS devices
  • -arch armv6 for some older iphones
Library (SDK) Search paths
  • -isysroot ${XCODE}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${IOS_TARGET}.sdk
  • ${XCODE} is /Applications/Xcode.app/Contents/Developer for Xcode 4.3
  • ${PLATFORM} is
    • iPhoneOS for devices
    • iPhoneSimulator for simulator
  • ${IOS_TARGET} is 5.1 for the latest SDK
Minimum Versions
  • -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 for iOS 4.0 (required by OGRE headers)
  • -miphoneos-version-min=${IOS_TARGET} for devices
  • -mmacosx-version-min=${OSX_TARGET} for simulator (use current OSX)
Executable
  • llvm-gcc executables are in ${XCODE}/Platforms/${PLATFORM}.platform/Developer/usr/bin
  • llvm-clang executables are in ${XCODE}/Developer/usr/bin

Objective C for the simulator
  • -fobjc-abi-version=2
    • uses version 2 of the objective-c ABI, which is the version of the SDK libraries. If you miss this one you'll undefined symbol link errors because symbol names are different
  • -fobjc-legacy-dispatch
    • uses version 1 of the objective c message dispatching (no rebinding or virtual tables or something like that) which is apparently also what is used by the simulator

Useful downloads for OSX Other
  • I put installed all my libraries in a development root using CMAKE_INSTALL_PREFIX or --prefix= for configure scripts instead of installing directly to the system SDK roots
  • I ended up writing perl scripts to call configure or cmake because I kept having to change things, I'll post those here so that the relavent things can be changed easily and reused for others
Last edited by cheshirekow on Fri Apr 20, 2012 10:39 pm, edited 1 time in total.
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

Post reserved for notes on freetype2
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

Post reserved for notes on freeimage
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

Post reserved for notes on zlib
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

Post reserved for notes on libOIS
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

post reserved for notes on boost
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

post reserved for notes on OGRE
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

post reserved for notes on CEGUI
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by masterfalcon »

Please do not ever do this again. Instead, write it up on the wiki.

While we're at it, what issues did you have and why didn't you use the ogredeps repository?
cheshirekow
Gnoblar
Posts: 21
Joined: Thu Dec 16, 2010 5:13 pm

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by cheshirekow »

masterfalcon wrote:Please do not ever do this again. Instead, write it up on the wiki.
Given my lack of confidence on this information, I wanted to open a discussion, and not take it for granted that this process is correct... hence my choice to use the forums instead.

At the same time I didn't want to overload a single post with notes for each library since it's only asking for trouble (site not responding, losing the ENTIRE post, etc). I've seen this strategy used to create large posts before, and thought it would be appropriate. Also it will help to contain information about each separate library.

But, I am new to this community, so if the wiki is prefered, that's where I'll put the info.
masterfalcon wrote:While we're at it, what issues did you have
That will be the topic for each of the above posts. Compiler flags, linker flags, library locations, corrupt SDK headers, cmake files that make incorrect assumptions about the system (i.e. things changed in Lion I guess).
masterfalcon wrote: and why didn't you use the ogredeps repository?
Never heard of it until now. Perhaps I missed references to it when digging through the wiki
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Building 1.8 for iOS, iPhone, iPad using cmake/command l

Post by masterfalcon »

Yes, the wiki is the correct place for this information. But, it may need to be altered if it may just confuse people. Which it may from the sounds of it.

Really, the best solution is not to provide a slew of directions for users to hack up their installations but to solve the issues. Many of whom are either new to ios, os x, Xcode, development in general or all of the above. Manipulating compiler setting can be more confusing than helpful.

I don't want to discourage what you're doing but maybe we can redirect some of it into bug fixes.