On Mar 30, 2006, at 8:17 PM, Chris Espinosa wrote:
On Mar 17, 2006, at 5:51 AM, Clark Cox wrote: I was wondering if anyone knows how to get Xcode to use ccache as it's compiler. I've installed ccache, and put appropriate links in my path. This works perfectly for things built via make, or by directly calling gcc from the commandline. However, seeing as Xcode calls the compiler with an absolute path "/usr/bin/gcc", distcc is never being called when building projects via xcodebuild or from the Xcode GUI.
Xcode uses the path to the compiler defined in the Rules tab of the Targets inspector, or by the value of the $(CC) build setting. Try setting those.
I sent an e-mail to the list regarding this a few days ago, but I have no idea if it actually made it though since my mail server decided to go down and lose several days of mail. I found that I was unable to actually use ccache with Xcode because Xcode seems to always use the -x flag.
I patched ccache to accept -x as well as more file extensions (.mm, .M, etc.). I never quite got it working with precompiled headers. I had it print out all of the arguments used to call gcc and when I called them myself it worked, when ccache exec'd those exact same arguments, it didn't work because the precompiled header doesn't actually exist at the path passed after -include. Still, the fact that it worked when calling gcc from the shell but not when execing confused me and I stopped there.
I also wrote a simple wrapper program with a simple Makefile that moves gcc (and a few others) to a specified location and adds symlinks to point to the wrapper program which calls ccache. The wrapper and my patch to ccache is at http://raoulhl.dyndns.org/~steve/gcc-wrapper-0.1.tar.gz
Check the Makefile to make sure the paths it chooses for the moved binaries and to ccache are okay before you use it. Also note that my patch dumps a bit more information to the ccache log than necessary.
If anyone can explain the bizarre precompiled header behavior, I'd be most grateful.
- Steve
|