[cfe-dev] Using Clang plugins with release version of clang on OS X

Nikita Zhuk nikita at zhuk.fi
Mon Jun 30 02:41:20 PDT 2014


On 30.6.2014, at 9.51, Jonathan 'Rynn' Sauer <jonathan.sauer at gmx.de> wrote:

> Hello,
> 
>>> On 30 Jun 2014, at 04:04, Alp Toker <alp at nuanti.com> wrote:
>>> 
>>> clang plugins will in fact only load and run properly in the exact same build configuration and source tree version (SVN revision+patches) of LLVM and clang. The compiler used to build either also needs to match, so that's unlikely to ever work.
>> 
>> Thanks for this information, it would have saved me hours if I knew it earlier. Could this limitation be mentioned on the Clang Tooling page so that people know that plugins aren't suitable for use cases like mine?
>> 
>> I'll look into other options. Thanks again.
> 
> One of those options might be to replace Xcode's clang. For me the following works (after making a backup
> of the original files of course ;-):

Thanks for the suggestion, but it isn’t really an option since this plugin wouldn’t be just for my own personal use, so I would have to force other developers to use custom clang with their Xcode just to get this plugin, which isn’t very practical. I suspect this is the case for most plugin writers who want to distribute their plugins to other developers. 

- Nikita Zhuk



> Replace clang's executables/libraries (libclang must be replaced because recent clang versions changed
> the serialization scheme for error messages, so with Xcode's libclang Xcode cannot read clang's output
> anymore):
> 
> 	/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
> 	/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
> 
> Not sure if this one needs to be replaced:
> 
> 	/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib
> 
> 
> Optionally replace the libc++ headers:
> 
> 	/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1
> 
> 
> Copy clang's header and runtime support libraries to:
> 
> 	/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/<version>
> 
> 
> Please note that after doing this MacPorts will no longer work, as the version schemes of Xcode's clang and
> LLVM's clang differ, so MacPorts fails to recognize it. I just temporarily switch back to Xcode's original
> clang (executable is enough) to work around this.
> 
> 
> HTH,
> Jonathan
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev






More information about the cfe-dev mailing list