Xcode custom compiler which wraps and does a passthru to clang

ε祈祈猫儿з 提交于 2020-01-02 04:29:07

问题


I'm trying to implement a certain pre-compilation effect on objective-C code (explained here). I've managed to get a custom compiler in place in Xcode 5 following these helpful instructions. However my passthru attempt to clang results in an error:

My custom compiler's executable:

#!/bin/bash
clang "$@"

Error message:

While building module 'UIKit' imported from /Users/Club15CC/Google Drive/Code/Frogger/Frogger/Frogger-Prefix.pch:14:
...
In file included from  
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:13:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:33:1: 
error: use of empty enum
};
^
/Users/Club15CC/Google Drive/Code/Frogger/Frogger/Frogger-Prefix.pch:14:13: fatal error: could not build module 'UIKit'
    #import <UIKit/UIKit.h>
     ~~~~~~~^
2 errors generated.
Command /usr/bin/frogger failed with exit code 1

Note the executable is called frogger and the test Xcode project Frogger.

It builds fine with the default compiler. Does the enum error imply some flag isn't being passed through? Does bash have a limit to the size of $@? The compiler invoking string is rather long and perhaps is being truncated?

Thanks for any help...

---- UPDATE ----

It seems as though it's passing the wrong "minimum version" flag to the custom compiler: The normal LLVM compiler has this flag: -mios-simulator-version-min=7.0 while my custom one is getting this flag: -mmacosx-version-min=10.6 - which is the cause of the UIDevice error. The correct flags are handled inside of /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/Native Build System.xcspec and the equivalent one for iOS as opposed to simulator. It seems somehow my custom compilers not picking up these specs. I'm in over my head here!

来源:https://stackoverflow.com/questions/19516725/xcode-custom-compiler-which-wraps-and-does-a-passthru-to-clang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!