Xcode 10 how to use new build system with obfuscator-llvm plugin

Viewed 870

I follow tutorial from integration-into-xcode, it worked for Xcode 9, In Xcode 10, Select File -> Project/Workspace Setting, there is a Build System option, the new build system is selected as default, with this default setting, the clang path is always set as /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang, the value of ExecPath from Obfuscator.xcspec file is not respected, how can I make it work with new build system?

2 Answers

It seems that XCode10 does not handle the ExecPath key anymore.

One possible solution is to override CC, LD, and AR to achieve a similar result. This can be done in two different ways:

  • within the plugin, for instance by creating a new compiler option named CC.
  • As a "User-Defined Setting" in the build settings window or your project/target. Just create a setting named CC and set it to the value you would have put in the ExecPath key.

Both solutions rely on the same mechanism. If defined, these variables are used in place of the selected toolchain. These are empty by default. However, according to my test, this was a bit different in previous versions of XCode where the variable were first resolved by XCode (I believe using whereis). e.g. defining CC=echo, XCode9 compiles with /bin/echo while XCode10 compiles with echo. If the executable cannot be found by XCode9, this may result in a freeze on an indexing task.

From Xcode7-ish onwards you could directly use a toolchain

Related