I'm coming up against a problem in the creation of an Xcode compiler plugin that appears to be the result of a problem in the way compile lines are generated by Xcode and how some of these options are overridden by the platform SDK.

Upon creating a custom compiler plugin that functions perfectly when building applications for MacOSX. I noticed a problem when building applications for iPhoneOS. The SDK continually complains about an invalid value in the min-iphoneos-version variable, the reason being that this isn't set on the compile command-line. Looking at the iPhoneOS platform SDK for Xcode5 you notice that the setting is defined in the 'Native Build System.xcspec' file (Applications/Xcode.app/Contents/Developer/Platforms/iPhone*.platform/Developer/Library/Xcode/Specifications/). Essentially, from what I can gather, this file is consulted and the -mmin-macosx-version flag is overwritten with this command-line option which results in a valid build for Apple compilers. However, create your own compiler plugin and problem ensue since your new compiler will not be matched by any of the 'Compiler' definitions in the 'Native Build System.xcspec' file.

I can only think of a couple of solutions to this,

  • rewrite/patch the 'Native Build System.xcspec' file upon installation, resulting in an horrendous solution requiring making unsupportable patches to Apple's build system.
  • another technique that allows a custom compiler plugin to define options specific for a platform SDK via some matching technique,
  • if a new .xcspec file is added to a Plugin in the PrivatePlugIns directory as a Resource, do all of these files get parsed upon build-time? if so then it may be possible to add these settings to a file such as, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneSimulator Build System Support.xcplugin/Contents/Resources/MyPlugin.xcspec

Has anyone else come up against this 'road-block' (ahem, design problem)?

Related posts

Recent Viewed