CCACHE in Chromium Build

2,106 views
Skip to first unread message

iotapi322

unread,
Nov 4, 2014, 8:54:49 AM11/4/14
to chromi...@chromium.org
Hi All,
I'm building chromium and working on a CDM solution for the EME working draft.  One thing that I have found that I'm not sure has been addressed or not is that CCACHE doesn't seem to work with the Chromium master tree any longer.  ( I'm building on Linux) When enabled, all the calls to CCACHE get logged in CCACHE as " unsupported compiler option".  Digging into the archives of CCACHE it seems that artifacts are logged as unsupported when the compile line has duplicate "arch" definitions.

I setup the Gyp files with setting the two environmental variables CC and CXX before running build/gyp_chromium:
export CC="ccache clang -Qunused-arguments"
export CXX="ccache clang++ -Qunused-arguments"
#export CCACHE_CPP2=yes
#export CCACHE_SLOPPINESS=time_macros

export GYP_DEFINES="clang_use_chrome_plugins=0 clang=1 component=shared_library" 

Is anyone successfully using CCACHE for the Chromium build on Linux?

Thanks,
Matt

Primiano Tucci

unread,
Nov 4, 2014, 12:22:40 PM11/4/14
to matt....@linaro.org, Chromium-dev
I never used CCACHE before and not sure whether it is still supported at all.
However, by looking at the code in common.gypi which handles goma (kind of a distcc), I think that you might get better luck by
setting CC_wrapper, CC.host_wrapper, CXX_wrapper, and CXX.host_wrapper.
The right syntax should be build/gyp_chromium -DCC_wrapper=distcc -DCXX_wrapper=distcc

Changing CC/CXX is very likely to produce wrong results, as we use different compilers depending on a wide variety of factors (build for host, build for target, use_clang, etc.).


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Thiago Farina

unread,
Nov 4, 2014, 2:26:26 PM11/4/14
to prim...@chromium.org, matt....@linaro.org, Chromium-dev
What is your use case for ccache? If it is to avoid unnecessary recompilation, ninja should be smart enough to avoid this. Are you having timing issues with it? What brought you to try to use ccache when building a chromium target, lets say 'chrome' which is a big one.

On other hand if you have enough machines, you could try to make a cluster with them and use distcc as Primiano suggested. Others have also used icecc/icecream instead though.

Please, don't get me wrong I'm just trying to understand your use case, to see if we can help with an existing solution for the problem you might be having.

Another point to consider if you are having problems with the compile time is to switch from static library build (which takes a lot to link) to shared library build (which is much faster).

Make sure you also have enough RAM, at least 4GB, but these days I'd say 8GB would be better. 

Hope that helps,

Regards.


--
Thiago Farina

iotapi322

unread,
Nov 4, 2014, 2:48:04 PM11/4/14
to chromi...@chromium.org, prim...@chromium.org, matt....@linaro.org
Hi All,
Thank you for taking the time to consider my bug.  Currently I'm doing a lot of switching between branches ( lkgb and master) everytime i do the switch and build "out/Debug chrome" the build reconstitutes itself from nothing, basically a recompile.  Some interesting facts:
  • I switch to using GCC version 4.8 from using clang
  • The RELEASE build target ccache works and I get ccache hits, however the DEBUG build target it's all listed as unsupported compiler options.

Reading up on google this specifically the release notes for ccache 3.0 it shows that this is because "
  • Errors when using multiple -arch compiler options are now noted as “unsupported compiler option”."

So somewhere in the DEBUG defines -arch is listed twice.  However when i dump the compile line to a text file I don't see that.

Lei Zhang

unread,
Nov 4, 2014, 3:07:46 PM11/4/14
to Thiago Farina, prim...@chromium.org, matt....@linaro.org, Chromium-dev
If you compile foo.cc and touch the file to change its timestamp, then
ninja will recompile it. Ccache can help avoid the recompilation.
Another use case would be a bot that clobbers on every build.
Depending on Matt's specific build needs, ccache may be a good tool to
speed up compilation.

Taiju Tsuiki

unread,
Nov 4, 2014, 10:27:53 PM11/4/14
to the...@chromium.org, Thiago Farina, prim...@chromium.org, matt....@linaro.org, Chromium-dev
I'm using ccache together with goma.
It speeds up my compilation when I switch my branch to older one, then switch back to newer one.
# Though it takes 50% more time on normal compilation.

When I set up my environment, I need to use latest one from github and build it myself to make cache hit.
Or, privously, I used to wrap my clang with a script to parse the argument and insert --ccache-skip for each unrecognized options.

Jiang Jiang

unread,
Nov 5, 2014, 1:23:30 AM11/5/14
to tz...@chromium.org, Lei Zhang, Thiago Farina, prim...@chromium.org, matt....@linaro.org, Chromium-dev
On Wed, Nov 5, 2014 at 4:27 AM, Taiju Tsuiki <tz...@chromium.org> wrote:
> I'm using ccache together with goma.
> It speeds up my compilation when I switch my branch to older one, then
> switch back to newer one.
> # Though it takes 50% more time on normal compilation.
>
> When I set up my environment, I need to use latest one from github and build
> it myself to make cache hit.
> Or, privously, I used to wrap my clang with a script to parse the argument
> and insert --ccache-skip for each unrecognized options.

That's what we do here at Opera as well. The latest ccache release
(3.1.10) [1] might just work, but the PCH support might not work with
latest clang still, at least not on POSIX systems. Currently we set
chromium_mac_pch=0 as a compromise.

- Jiang

[1] https://ccache.samba.org/releasenotes.html#_ccache_3_1_10
Reply all
Reply to author
Forward
0 new messages