ninja + clang + ccache on Mac?

1,344 views
Skip to first unread message

Jiang Jiang

unread,
Feb 11, 2013, 3:25:51 AM2/11/13
to chromi...@chromium.org
Hi,

I wonder if there is any guide for building chromium with ninja, clang and ccache on Mac?

The wiki page http://code.google.com/p/chromium/wiki/CCacheMac is about using it with Xcode build. This bug http://code.google.com/p/chromium/issues/detail?id=92793 is about using it with buildbot. This thread https://groups.google.com/a/chromium.org/d/topic/chromium-dev/LZsIg8XcS1s/discussion doesn't give many hints either.

Has anyone been using ccache on a relatively recent Mac (with sufficient large memory, say 16G, and SSD) can comment if it's possible or worthwhile?

If anyone can point me the directions to use distcc with ninja and clang on Mac, I will also appreciate.

- Jiang

Marc-Antoine Ruel

unread,
Feb 11, 2013, 9:31:31 AM2/11/13
to gzj...@gmail.com, chromium-dev
That's a good question.

I'm not 100% sure it using ccache with ninja is super useful but it's probably worth a try. The important thing to remember is that the CXX environment variable is read at "gclient runhooks" and not at "ninja -C out/Release foo" time. So you need to set your environment before build/gyp_chromium is called.

The page is 2½ years old so it's completely out of date; once you got it up and running, please update the wiki page.

Thanks,

M-A


2013/2/11 Jiang Jiang <gzj...@gmail.com>

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

Kinuko Yasuda

unread,
Feb 12, 2013, 9:25:11 AM2/12/13
to gzj...@gmail.com, chromium-dev
I have once tested ninja+ccache+clang to compile chromium on my MBA /w 8G ram sometime ago. I don't really remember how it was beneficial but it worked for me (i.e. I could compile with the setting).

As far as I remember (or my old build script says) I needed to give '-Qunused-arguments' parameter to clang (like: CC="ccache clang -Qunused-arguments") before running gclient runhooks, and also needed to export CCACHE_CPP2=yes and CCACHE_SLOPPINESS=time_macros when I run ninja.  You'll probably need to use the latest ccache (3.1.8 or 3.1.9) too.
This information could be also out of date, but hope this helps some.

Kinuko

Jiang Jiang

unread,
Feb 15, 2013, 5:36:26 AM2/15/13
to Kinuko Yasuda, chromium-dev
Hi,

On Tue, Feb 12, 2013 at 3:25 PM, Kinuko Yasuda <kin...@google.com> wrote:
> I have once tested ninja+ccache+clang to compile chromium on my MBA /w 8G
> ram sometime ago. I don't really remember how it was beneficial but it
> worked for me (i.e. I could compile with the setting).
>
> As far as I remember (or my old build script says) I needed to give
> '-Qunused-arguments' parameter to clang (like: CC="ccache clang
> -Qunused-arguments") before running gclient runhooks, and also needed to
> export CCACHE_CPP2=yes and CCACHE_SLOPPINESS=time_macros when I run ninja.
> You'll probably need to use the latest ccache (3.1.8 or 3.1.9) too.
> This information could be also out of date, but hope this helps some.

I haven't had much luck with this, for a few reasons.

1. when "clang==1", build/common.gypi will completely override the CC
variable so I don't know how setting CC before running gclient runhooks
worked for you. I did a quick hack like this:
https://gist.github.com/jjgod/4959581 it works.

2. But ccache doesn't seemed to be happy with ninja calling in parallel,
when running ninja with the default option, I got:

$ ccache -s
cache directory /Users/jjgod/.ccache
cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 0
called for link 24
called for preprocessing 1730
multiple source files 3417
compile failed 6
unsupported source language 6
no input file 8
files in cache 0
cache size 0 Kbytes
max cache size 40.0 Gbytes

So I don't see anything being cached but "multiple source files" count
keeps growing.

3. Even if I tried ninja -j1 (which is of course very slow), the files
in cache size still stays at 0, I don't know what's missing at this
point...

Any further hint?

- Jiang

Kinuko Yasuda

unread,
Feb 15, 2013, 7:01:32 AM2/15/13
to Jiang Jiang, chromium-dev
(I think ccache or clang related list would give you better answer)

I believe you're using old ccache which doesn't work well with clang + precompiled header.  I vaguely remember I had similar problem before I use CCACHE_SLOPPINESS option with latest ccache.

I just did following and it works for me (with ccache 3.1.8):

Setup:
  export CC="ccache clang -Qunused-arguments"
  export CXX="ccache clang++ -Qunused-arguments"
  GYP_GENERATORS=ninja GYP_DEFINES="mac_sdk=10.6,fastbuild=1" ./build/gyp_chromium

Build:
  export PATH=CHROME_SRC_ROOT/third_party/llvm-build/Release+Asserts/bin:$PATH
  export CCACHE_CPP2=yes
  export CCACHE_SLOPPINESS=time_macros
  ninja -j 16 -C out/Release chrome

$ ccache --version
ccache version 3.1.8
...

<build some files>

$ ccache -s 
...
cache hit (direct)                  5687
cache hit (preprocessed)             446
cache miss                         40356
...

<build same files again>

$ ccache -s
...
cache hit (direct)                  8529
cache hit (preprocessed)             469
cache miss                         42702
...


- Jiang

Jiang Jiang

unread,
Feb 15, 2013, 8:17:24 AM2/15/13
to Taiju Tsuiki, chromium-dev
(CCed to the list)

On Fri, Feb 15, 2013 at 12:35 PM, Taiju Tsuiki <tz...@google.com> wrote:
> 1.
> The compiler can be overridden by setting CC and CXX environment
> variable on gclient runhooks. Didn't you forget CXX?

I'm not sure if that's the case on Mac as well. I tried setting both
but doesn't work. Also, I don't understand how it is supposed to work,
from build/common.gypi, we have the following block for Mac:

['clang==1', {
'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',

Doesn't it mean it will override the environment variables and always
use the value set here?

> 2.
> The "multiple source files" cases are caused by plugins. ccache can't
> handle arguments like "-Xclang find-bad-constructs -Xclang -load
> -Xclang /path/to/libFindBadConstructs.so".
> I needed to wrap ccache and insert --ccache-skip for each of such
> arguments like "-Xclang --ccache-skip find-bad-constructs -Xclang
> --ccache-skip /path/to/libFindBadConstructs.so".

That seemed to be the problem, if I use clang_use_chrome_plugins=0
then ccache works. Can you describe exactly how you wrap ccache?
I would like to use ccache but don't want to lose the plugin.

- Jiang

Jiang Jiang

unread,
Feb 15, 2013, 8:20:28 AM2/15/13
to Kinuko Yasuda, chromium-dev
On Fri, Feb 15, 2013 at 1:01 PM, Kinuko Yasuda <kin...@chromium.org> wrote:
> (I think ccache or clang related list would give you better answer)
>
> I believe you're using old ccache which doesn't work well with clang +
> precompiled header. I vaguely remember I had similar problem before I use
> CCACHE_SLOPPINESS option with latest ccache.

Actually I had ccache 3.1.8 and I upgraded to 3.1.9 just for this.

$ ccache --version
ccache version 3.1.9

> I just did following and it works for me (with ccache 3.1.8):
>
> Setup:
> export CC="ccache clang -Qunused-arguments"
> export CXX="ccache clang++ -Qunused-arguments"
> GYP_GENERATORS=ninja GYP_DEFINES="mac_sdk=10.6,fastbuild=1"
> ./build/gyp_chromium

I don't know why this worked for you but from build/common.gypi
I can't see how CC environment variable could possibly be passed
here on Mac.

Thanks to Taiju Tsuiki's response, I managed to get ccache
working by disabling the chrome plugin.

- Jiang

Kinuko Yasuda

unread,
Feb 16, 2013, 4:19:06 AM2/16/13
to Jiang Jiang, Taiju Tsuiki, chromium-dev
I thought this was fixed by this patch, which is also integrated into latest ccache:

(I'm using ccache built from the source code on github so something might differ from the official released version)

Kinuko Yasuda

unread,
Feb 16, 2013, 4:22:29 AM2/16/13
to Jiang Jiang, Taiju Tsuiki, chromium-dev
Well--- and now I remember from my old note that this patch wasn't included in 3.1.8.

Jiang Jiang

unread,
Feb 16, 2013, 5:02:38 AM2/16/13
to Kinuko Yasuda, Taiju Tsuiki, chromium-dev
On Sat, Feb 16, 2013 at 10:19 AM, Kinuko Yasuda <kin...@chromium.org> wrote:
> I thought this was fixed by this patch, which is also integrated into latest
> ccache:
> https://github.com/jrosdahl/ccache/pull/4
>
> (I'm using ccache built from the source code on github so something might
> differ from the official released version)

Right, and the patch was merged to master after 3.1.9 release. That explains.

I now remember that http://code.google.com/p/chromium/issues/detail?id=92793
mentioned about this patch.

- Jiang

Jiang Jiang

unread,
Feb 16, 2013, 7:16:40 AM2/16/13
to Kinuko Yasuda, mar...@chromium.org, Taiju Tsuiki, chromium-dev
Also, I was wrong about setting CC/CXX environment variables doesn't work,
it actually works fine, just I didn't check the correct output file, I only
checked some of the .ninja files generated and saw lines like
export CC="$${SOURCE_ROOT}/../third_party/llvm-build/Release+Asserts/bin/clang"
and assumed it's not working. But ninja -v output proofed that I was wrong.

Marc-Antoine, I'd like to update the wiki page
http://code.google.com/p/chromium/wiki/CCacheMac but I don't have
access to.
So I have put up this gist: https://gist.github.com/jjgod/4966579 feel free
to update the original page or create a new one on chromium wiki base on this
if you want.

- Jiang

Jiang Jiang

unread,
Mar 12, 2013, 6:43:01 AM3/12/13
to Kinuko Yasuda, tha...@chromium.org, Taiju Tsuiki, chromium-dev
Hi again,

With this setup in use for me locally and for our Mac buildbot servers
for a few weeks, everything seemed well except that we recently hit
the following issue:

ccache clang++ ... -include
obj/third_party/WebKit/Source/WebCore/webcore_platform.WebCorePrefix.h-cc
-c ../../third_party/WebKit/Source/WebCore/platform/Clock.cpp -o
obj/third_party/webkit/source/webcore/platform/webcore_platform.clock.o

fatal error: file
'/Users/buildbot/buildbot/slave/workdir/mac/build/chromium/src/out/Release/../../third_party/WebKit/Source/WTF/wtf/Platform.h'
has been modified since the precompiled header was built
1 error generated.

And a bunch of similar errors.

The situation is that our buildbot always do clean builds (git clean
-dfx), but it still happens consistently, I suspect that's because:

1. One of the precompiled headers was generated in the build process.
2. Platform.h or some other files included by that precompiled header
has been touched but it didn't get any actual update, so ccache still
return the same cached file.
3. When we are trying to build a C++ file together with that
precompiled header, clang found out the in consistency between
Platform.h modification time and precompiled header modification time
and gives up.

But I can't really understand exactly what triggered it and what's the
remedy. I wonder if it happened to any of you using ccache or on
Chromium's Mac buildbot if it's using ccache.

This is happening on my local machine and our buildbot server, the
only solution we have found in this case is clearing all ccache (I
don't know if it's possible to selectively clear the cache for one
file).

Full command line as following:

FAILED: ccache /Users/buildbot/buildbot/slave/workdir/desktop-mac-64/build/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++
-MMD -MF obj/third_party/webkit/source/webcore/platform/webcore_platform.clock.o.d
-DDISABLE_NACL -DUSE_FONTCONFIG -DCHROMIUM_BUILD -DUSE_LIBJPEG_TURBO=1
-DENABLE_ONE_CLICK_SIGNIN -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1
-DENABLE_PEPPER_THREADING -DENABLE_CONFIGURATION_POLICY
-DENABLE_INPUT_SPEECH -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1
-DENABLE_GPU=1 -DENABLE_EGLIMAGE=1 -DUSE_SKIA=1
-DUSE_SYSTEM_PYTHON_IN_TESTS=1 -DENABLE_TASK_MANAGER=1
-DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1
-DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1
-DENABLE_BACKGROUND=1 -DENABLE_AUTOMATION=1 -DENABLE_GOOGLE_NOW=1
-DENABLE_LANGUAGE_DETECTION=1 -DENABLE_PRINTING=1
-DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1
-DENABLE_MANAGED_USERS=1 -DWEBKIT_IMPLEMENTATION=1
'-DWEBCORE_NAVIGATOR_PLATFORM="MacIntel"'
-DWebCascadeList=ChromiumWebCoreObjCWebCascadeList
-DWebCoreFlippedView=ChromiumWebCoreObjCWebCoreFlippedView
-DWebCoreTextFieldCell=ChromiumWebCoreObjCWebCoreTextFieldCell
-DWebScrollbarPrefsObserver=ChromiumWebCoreObjCWebScrollbarPrefsObserver
-DWebCoreRenderThemeNotificationObserver=ChromiumWebCoreObjCWebCoreRenderThemeNotificationObserver
-DWebFontCache=ChromiumWebCoreObjCWebFontCache
-DWebScrollAnimationHelperDelegate=ChromiumWebCoreObjCWebScrollAnimationHelperDelegate
-DWebScrollbarPainterControllerDelegate=ChromiumWebCoreObjCWebScrollbarPainterControllerDelegate
-DWebScrollbarPainterDelegate=ChromiumWebCoreObjCWebScrollbarPainterDelegate
-DWebScrollbarPartAnimation=ChromiumWebCoreObjCWebScrollbarPartAnimation
-DENABLE_3D_PLUGIN=1 -DENABLE_BATTERY_STATUS=0 -DENABLE_BLOB=1
-DENABLE_BLOB_SLICE=1 -DENABLE_CANVAS_PATH=0 -DENABLE_CANVAS_PROXY=1
-DENABLE_CHANNEL_MESSAGING=1 -DENABLE_CSP_NEXT=1
-DENABLE_CSS3_CONDITIONAL_RULES=1 -DENABLE_CSS3_TEXT=0
-DENABLE_CSS_BOX_DECORATION_BREAK=1 -DENABLE_CSS_COMPOSITING=0
-DENABLE_CSS_EXCLUSIONS=1 -DENABLE_CSS_FILTERS=1
-DENABLE_CSS_IMAGE_SET=1 -DENABLE_CSS_IMAGE_RESOLUTION=0
-DENABLE_CSS_REGIONS=1 -DENABLE_CSS_SHADERS=1
-DENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED=0
-DENABLE_CSS_VARIABLES=1 -DENABLE_CSS_STICKY_POSITION=1
-DENABLE_CUSTOM_SCHEME_HANDLER=0 -DENABLE_DASHBOARD_SUPPORT=0
-DENABLE_DATA_TRANSFER_ITEMS=1 -DENABLE_DETAILS_ELEMENT=1
-DENABLE_DEVICE_ORIENTATION=1 -DENABLE_DIALOG_ELEMENT=1
-DENABLE_DIRECTORY_UPLOAD=1 -DENABLE_DOM4_EVENTS_CONSTRUCTOR=1
-DENABLE_DOWNLOAD_ATTRIBUTE=1 -DENABLE_DRAGGABLE_REGION=1
-DENABLE_ENCRYPTED_MEDIA=1 -DENABLE_FILE_SYSTEM=1 -DENABLE_FILTERS=1
-DENABLE_FULLSCREEN_API=1 -DENABLE_GAMEPAD=1 -DENABLE_GEOLOCATION=1
-DENABLE_GESTURE_EVENTS=1 -DENABLE_ICONDATABASE=0
-DENABLE_IFRAME_SEAMLESS=1 -DENABLE_INDEXED_DATABASE=1
-DENABLE_INPUT_TYPE_COLOR=1 -DENABLE_INPUT_TYPE_DATE=1
-DENABLE_INPUT_TYPE_DATETIMELOCAL=1 -DENABLE_INPUT_TYPE_MONTH=1
-DENABLE_INPUT_TYPE_TIME=1 -DENABLE_JAVASCRIPT_DEBUGGER=1
-DENABLE_JAVASCRIPT_I18N_API=1 -DENABLE_LEGACY_CSS_VENDOR_PREFIXES=0
-DENABLE_LEGACY_VIEWPORT_ADAPTION=1 -DENABLE_LEGACY_VENDOR_PREFIXES=0
-DENABLE_LEGACY_WEB_AUDIO=1 -DENABLE_LINK_PREFETCH=1
-DENABLE_LINK_PRERENDER=1 -DENABLE_MATHML=0 -DENABLE_MEDIA_SOURCE=1
-DENABLE_MEDIA_STATISTICS=1 -DENABLE_MEDIA_STREAM=1
-DENABLE_METER_ELEMENT=1 -DENABLE_MHTML=1
-DENABLE_MOUSE_CURSOR_SCALE=1 -DENABLE_NAVIGATOR_CONTENT_UTILS=1
-DENABLE_NOSNIFF=1 -DENABLE_PAGE_VISIBILITY_API=1
-DENABLE_PERFORMANCE_TIMELINE=1 -DENABLE_POINTER_LOCK=1
-DENABLE_PROGRESS_ELEMENT=1 -DENABLE_PROXIMITY_EVENTS=0
-DENABLE_QUOTA=1 -DENABLE_REQUEST_ANIMATION_FRAME=1
-DENABLE_REQUEST_AUTOCOMPLETE=1 -DENABLE_RESOLUTION_MEDIA_QUERY=0
-DENABLE_RESOURCE_TIMING=1 -DENABLE_RUBY=1 -DENABLE_SANDBOX=1
-DENABLE_SCRIPTED_SPEECH=1 -DENABLE_SHADOW_DOM=1
-DENABLE_SMOOTH_SCROLLING=1 -DENABLE_SPEECH_SYNTHESIS=0
-DENABLE_SQL_DATABASE=1 -DENABLE_STYLE_SCOPED=1 -DENABLE_SVG=1
-DENABLE_SVG_FONTS=1 -DENABLE_TEMPLATE_ELEMENT=1
-DENABLE_TEXT_AUTOSIZING=1 -DENABLE_THREADED_HTML_PARSER=1
-DENABLE_TOUCH_ADJUSTMENT=1 -DENABLE_TOUCH_EVENTS=1
-DENABLE_TOUCH_EVENT_TRACKING=1 -DENABLE_TOUCH_ICON_LOADING=0
-DENABLE_TOUCH_SLIDER=1 -DENABLE_USER_TIMING=1
-DENABLE_V8_SCRIPT_DEBUG_SERVER=1 -DENABLE_VIDEO=1
-DENABLE_VIDEO_TRACK=1 -DENABLE_VIEWPORT=1 -DENABLE_WEBGL=1
-DENABLE_WEB_SOCKETS=1 -DENABLE_WEB_TIMING=1 -DENABLE_WORKERS=1
-DENABLE_XHR_RESPONSE_BLOB=1 -DENABLE_XHR_TIMEOUT=0 -DENABLE_XSLT=1
-DWTF_USE_LEVELDB=1 -DWTF_USE_BUILTIN_UTF8_CODEC=1
-DWTF_USE_OPENTYPE_SANITIZER=1 -DWTF_USE_RTL_SCROLLBAR=1
-DWTF_USE_SKIA_TEXT=1 -DWTF_USE_WEBP=1
-DWTF_USE_WEBKIT_IMAGE_DECODERS=1 -DENABLE_CALENDAR_PICKER=1
-DENABLE_CSS_DEVICE_ADAPTATION=0 -DENABLE_DATALIST_ELEMENT=1
-DENABLE_INPUT_SPEECH=1 -DENABLE_INPUT_TYPE_WEEK=1
-DENABLE_INPUT_MULTIPLE_FIELDS_UI=1 -DENABLE_LEGACY_NOTIFICATIONS=1
-DENABLE_MEDIA_CAPTURE=0 -DENABLE_MICRODATA=0 -DENABLE_NOTIFICATIONS=1
-DENABLE_ORIENTATION_EVENTS=0 -DENABLE_PAGE_POPUP=1
-DENABLE_SHARED_WORKERS=1 -DENABLE_WEB_AUDIO=1
-DENABLE_BINDING_INTEGRITY=1 -DENABLE_3D_RENDERING=1
-DENABLE_ACCELERATED_2D_CANVAS=1 -DWTF_USE_ACCELERATED_COMPOSITING=1
-DENABLE_RUBBER_BANDING=1 -DWTF_USE_SKIA_ON_MAC_CHROMIUM=1
-DBUILDING_CHROMIUM__=1 -DWTF_USE_NEW_THEME=1
-DU_USING_ICU_NAMESPACE=0 -DU_STATIC_IMPLEMENTATION
-DSK_BUILD_NO_IMAGE_ENCODE -DSK_DEFERRED_CANVAS_USES_GPIPE=1
'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"'
-DGR_AGGRESSIVE_SHADER_OPTS=1 -DSK_ENABLE_INST_COUNT=0
-DSK_USE_POSIX_THREADS -DCHROME_PNG_WRITE_SUPPORT -DPNG_USER_CONFIG
-DLIBXML_STATIC -DLIBXSLT_STATIC -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND
-DDYNAMIC_ANNOTATIONS_ENABLED=0 -D_FORTIFY_SOURCE=2
-I../../third_party/icu/public/common
-I../../third_party/icu/public/i18n -I../../third_party/apple_webkit
-I../../third_party/khronos -I../../gpu -I../..
-I../../third_party/WebKit/Source/Platform/chromium
-Iobj/third_party/WebKit/Source/WebCore/WebCore.gyp/webcore_platform.gen
-I../../third_party/WebKit/Source/WebCore
-I../../third_party/WebKit/Source
-I../../third_party/WebKit/Source/WebCore/Modules/battery
-I../../third_party/WebKit/Source/WebCore/Modules/filesystem
-I../../third_party/WebKit/Source/WebCore/Modules/filesystem/chromium
-I../../third_party/WebKit/Source/WebCore/Modules/gamepad
-I../../third_party/WebKit/Source/WebCore/Modules/geolocation
-I../../third_party/WebKit/Source/WebCore/Modules/intents
-I../../third_party/WebKit/Source/WebCore/Modules/indexeddb
-I../../third_party/WebKit/Source/WebCore/Modules/indexeddb/chromium
-I../../third_party/WebKit/Source/WebCore/Modules/mediasource
-I../../third_party/WebKit/Source/WebCore/Modules/mediastream
-I../../third_party/WebKit/Source/WebCore/Modules/navigatorcontentutils
-I../../third_party/WebKit/Source/WebCore/Modules/notifications
-I../../third_party/WebKit/Source/WebCore/Modules/proximity
-I../../third_party/WebKit/Source/WebCore/Modules/quota
-I../../third_party/WebKit/Source/WebCore/Modules/speech
-I../../third_party/WebKit/Source/WebCore/Modules/webaudio
-I../../third_party/WebKit/Source/WebCore/Modules/webdatabase
-I../../third_party/WebKit/Source/WebCore/Modules/webdatabase/chromium
-I../../third_party/WebKit/Source/WebCore/Modules/websockets
-I../../third_party/WebKit/Source/WebCore/accessibility
-I../../third_party/WebKit/Source/WebCore/accessibility/chromium
-I../../third_party/WebKit/Source/WebCore/bindings
-I../../third_party/WebKit/Source/WebCore/bindings/generic
-I../../third_party/WebKit/Source/WebCore/bindings/v8
-I../../third_party/WebKit/Source/WebCore/bindings/v8/custom
-I../../third_party/WebKit/Source/WebCore/bridge
-I../../third_party/WebKit/Source/WebCore/bridge/jni
-I../../third_party/WebKit/Source/WebCore/bridge/jni/v8
-I../../third_party/WebKit/Source/WebCore/css
-I../../third_party/WebKit/Source/WebCore/dom
-I../../third_party/WebKit/Source/WebCore/dom/default
-I../../third_party/WebKit/Source/WebCore/editing
-I../../third_party/WebKit/Source/WebCore/fileapi
-I../../third_party/WebKit/Source/WebCore/history
-I../../third_party/WebKit/Source/WebCore/html
-I../../third_party/WebKit/Source/WebCore/html/canvas
-I../../third_party/WebKit/Source/WebCore/html/parser
-I../../third_party/WebKit/Source/WebCore/html/shadow
-I../../third_party/WebKit/Source/WebCore/html/track
-I../../third_party/WebKit/Source/WebCore/inspector
-I../../third_party/WebKit/Source/WebCore/loader
-I../../third_party/WebKit/Source/WebCore/loader/appcache
-I../../third_party/WebKit/Source/WebCore/loader/archive
-I../../third_party/WebKit/Source/WebCore/loader/archive/cf
-I../../third_party/WebKit/Source/WebCore/loader/archive/mhtml
-I../../third_party/WebKit/Source/WebCore/loader/cache
-I../../third_party/WebKit/Source/WebCore/loader/icon
-I../../third_party/WebKit/Source/WebCore/mathml
-I../../third_party/WebKit/Source/WebCore/page
-I../../third_party/WebKit/Source/WebCore/page/animation
-I../../third_party/WebKit/Source/WebCore/page/chromium
-I../../third_party/WebKit/Source/WebCore/page/scrolling
-I../../third_party/WebKit/Source/WebCore/page/scrolling/chromium
-I../../third_party/WebKit/Source/WebCore/platform
-I../../third_party/WebKit/Source/WebCore/platform/animation
-I../../third_party/WebKit/Source/WebCore/platform/audio
-I../../third_party/WebKit/Source/WebCore/platform/audio/chromium
-I../../third_party/WebKit/Source/WebCore/platform/chromium
-I../../third_party/WebKit/Source/WebCore/platform/chromium/support
-I../../third_party/WebKit/Source/WebCore/platform/graphics
-I../../third_party/WebKit/Source/WebCore/platform/graphics/chromium
-I../../third_party/WebKit/Source/WebCore/platform/graphics/chromium/cc
-I../../third_party/WebKit/Source/WebCore/platform/graphics/cpu/arm
-I../../third_party/WebKit/Source/WebCore/platform/graphics/cpu/arm/filters
-I../../third_party/WebKit/Source/WebCore/platform/graphics/filters
-I../../third_party/WebKit/Source/WebCore/platform/graphics/filters/skia
-I../../third_party/WebKit/Source/WebCore/platform/graphics/gpu
-I../../third_party/WebKit/Source/WebCore/platform/graphics/opentype
-I../../third_party/WebKit/Source/WebCore/platform/graphics/skia
-I../../third_party/WebKit/Source/WebCore/platform/graphics/transforms
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/bmp
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/gif
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/ico
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/jpeg
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/png
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/skia
-I../../third_party/WebKit/Source/WebCore/platform/image-decoders/webp
-I../../third_party/WebKit/Source/WebCore/platform/image-encoders/skia
-I../../third_party/WebKit/Source/WebCore/platform/leveldb
-I../../third_party/WebKit/Source/WebCore/platform/mediastream
-I../../third_party/WebKit/Source/WebCore/platform/mediastream/chromium
-I../../third_party/WebKit/Source/WebCore/platform/mock
-I../../third_party/WebKit/Source/WebCore/platform/network
-I../../third_party/WebKit/Source/WebCore/platform/network/chromium
-I../../third_party/WebKit/Source/WebCore/platform/sql
-I../../third_party/WebKit/Source/WebCore/platform/text
-I../../third_party/WebKit/Source/WebCore/platform/text/transcoder
-I../../third_party/WebKit/Source/WebCore/plugins
-I../../third_party/WebKit/Source/WebCore/plugins/chromium
-I../../third_party/WebKit/Source/WebCore/rendering
-I../../third_party/WebKit/Source/WebCore/rendering/mathml
-I../../third_party/WebKit/Source/WebCore/rendering/style
-I../../third_party/WebKit/Source/WebCore/rendering/svg
-I../../third_party/WebKit/Source/WebCore/storage
-I../../third_party/WebKit/Source/WebCore/svg
-I../../third_party/WebKit/Source/WebCore/svg/animation
-I../../third_party/WebKit/Source/WebCore/svg/graphics
-I../../third_party/WebKit/Source/WebCore/svg/graphics/filters
-I../../third_party/WebKit/Source/WebCore/svg/properties
-I../../third_party/WebKit/Source/ThirdParty/glu
-I../../third_party/WebKit/Source/WebCore/workers
-I../../third_party/WebKit/Source/WebCore/workers/chromium
-I../../third_party/WebKit/Source/WebCore/xml
-I../../third_party/WebKit/Source/WebCore/xml/parser
-I../../third_party/WebKit/Source/WebCore/platform/audio/mac
-I../../third_party/WebKit/Source/WebCore/platform/cocoa
-I../../third_party/WebKit/Source/WebCore/platform/graphics/cg
-I../../third_party/WebKit/Source/WebCore/platform/graphics/cocoa
-I../../third_party/WebKit/Source/WebCore/platform/graphics/mac
-I../../third_party/WebKit/Source/WebCore/platform/mac
-I../../third_party/WebKit/Source/WebCore/platform/text/mac
-I../../third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz
-I../../third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz/ng
-I../../third_party/angle/include/GLSLANG -Igen/webkit
-Igen/webkit/bindings -I../../third_party/WebKit/Source/WTF
-I../../third_party/WebKit/Source/JavaScriptCore -I../../skia/config
-I../../third_party/skia/src/core
-I../../third_party/skia/include/config
-I../../third_party/skia/include/core
-I../../third_party/skia/include/effects
-I../../third_party/skia/include/pdf
-I../../third_party/skia/include/gpu
-I../../third_party/skia/include/gpu/gl
-I../../third_party/skia/include/pipe
-I../../third_party/skia/include/ports
-I../../third_party/skia/include/utils -I../../skia/ext
-I../../third_party/skia/include/utils/mac -I../../third_party/iccjpeg
-I../../third_party/libwebp -I../../third_party/libpng
-I../../third_party/libxml/mac/include
-I../../third_party/libxml/src/include -I../../third_party/libxslt
-I../../third_party/npapi -I../../third_party/npapi/bindings
-I../../third_party/ots/include -I../../third_party/qcms/src
-I../../third_party/sqlite -I../../third_party/zlib -I../../v8/include
-I../../third_party/libjpeg_turbo
-I../../third_party/leveldatabase/src/include
-I../../third_party/leveldatabase/src
-I../../third_party/leveldatabase -I../../third_party/harfbuzz-ng/src
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-O3 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof
-mmacosx-version-min=10.6 -arch i386 -Wglobal-constructors
-Wunused-parameter -Wall -Wendif-labels -Wextra -Wno-unused-parameter
-Wno-missing-field-initializers -Wheader-hygiene -Wno-c++11-narrowing
-Wno-reserved-user-defined-literal -Wno-char-subscripts
-Wno-unused-function -Wno-covered-switch-default
-Wexit-time-destructors -fno-rtti -fno-exceptions
-fvisibility-inlines-hidden -fno-threadsafe-statics -Xclang -load
-Xclang /Users/buildbot/buildbot/slave/workdir/desktop-mac-64/build/chromium/src/tools/clang/scripts/../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang
-plugin-arg-find-bad-constructs -Xclang
skip-virtuals-in-implementations -fcolor-diagnostics
-fno-strict-aliasing -std=gnu++11 -include
obj/third_party/WebKit/Source/WebCore/webcore_platform.WebCorePrefix.h-cc
-c ../../third_party/WebKit/Source/WebCore/platform/Clock.cpp -o
obj/third_party/webkit/source/webcore/platform/webcore_platform.clock.o

- Jiang

Jiang Jiang

unread,
Mar 12, 2013, 8:12:29 AM3/12/13
to Kinuko Yasuda, tha...@chromium.org, Taiju Tsuiki, chromium-dev
On Tue, Mar 12, 2013 at 11:43 AM, Jiang Jiang <gzj...@gmail.com> wrote:
> Hi again,
>
> With this setup in use for me locally and for our Mac buildbot servers
> for a few weeks, everything seemed well except that we recently hit
> the following issue:
>
> ccache clang++ ... -include
> obj/third_party/WebKit/Source/WebCore/webcore_platform.WebCorePrefix.h-cc
> -c ../../third_party/WebKit/Source/WebCore/platform/Clock.cpp -o
> obj/third_party/webkit/source/webcore/platform/webcore_platform.clock.o
>
> fatal error: file
> '/Users/buildbot/buildbot/slave/workdir/mac/build/chromium/src/out/Release/../../third_party/WebKit/Source/WTF/wtf/Platform.h'
> has been modified since the precompiled header was built
> 1 error generated.

https://github.com/llvm-mirror/clang/blob/master/lib/Serialization/ASTReader.cpp#L1596

shows that either file size change or StoredTime !=
File->getModificationTime() can trigger this.

- Jiang

Jiang Jiang

unread,
Apr 16, 2013, 10:53:16 AM4/16/13
to Kinuko Yasuda, Nico Weber, Taiju Tsuiki, chromium-dev
On Tue, Mar 12, 2013 at 11:43 AM, Jiang Jiang <gzj...@gmail.com> wrote:
It has been a month and I decided to take a closer look again, and I
seemed to understand it a little better.

The precompiled headers in trouble are:

$ ls -lh out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_*.gch
-rw-r--r-- 1 jjgod staff 7.6M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_dom.WebCorePrefix.h-cc.gch
-rw-r--r-- 1 jjgod staff 7.6M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_html.WebCorePrefix.h-cc.gch
-rw-r--r-- 1 jjgod staff 7.6M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_platform.WebCorePrefix.h-cc.gch
-rw-r--r-- 1 jjgod staff 15M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_platform.WebCorePrefix.h-mm.gch
-rw-r--r-- 1 jjgod staff 7.6M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_platform_geometry.WebCorePrefix.h-cc.gch
-rw-r--r-- 1 jjgod staff 7.6M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_remaining.WebCorePrefix.h-cc.gch
-rw-r--r-- 1 jjgod staff 7.6M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_rendering.WebCorePrefix.h-cc.gch
-rw-r--r-- 1 jjgod staff 15M Apr 16 16:28
out/Debug/obj/third_party/WebKit/Source/WebCore/webcore_rendering.WebCorePrefix.h-mm.gch

which are all generated from third_party/WebKit/Source/WebCore/WebCorePrefix.h.

Let's say if I built in current branch, ccache will cache the gch
files. Then I switched to another branch that has modified
third_party/WebKit/Source/WebCore/WebCorePrefix.h, so the mtime of
this file will change. When I switch back to the old branch, since the
contents of third_party/WebKit/Source/WebCore/WebCorePrefix.h still
matches what's cached, so ccache returns the old precompiled header,
however clang thinks it's out of date by comparing modification time:

// For an overridden file, there is nothing to validate.
if (!Overridden && (StoredSize != File->getSize()
#if !defined(LLVM_ON_WIN32)
// In our regression testing, the Windows file system seems to
// have inconsistent modification times that sometimes
// erroneously trigger this error-handling path.
|| StoredTime != File->getModificationTime()
#endif
)) {
if (Complain) {
Error(diag::err_fe_pch_file_modified, Filename, F.FileName);
}

IsOutOfDate = true;
}

Thus we got the errors like:

fatal error: file
'/Users/jjgod/work/chromium/src/out/Debug/../../third_party/WebKit/Source/WebCore/WebCorePrefix.h'
has been modified since the precompiled header was built.

A potential fix I can think of is to force ccache always recache the
PCHs: https://gist.github.com/jjgod/5396544

Do you guys think it's feasible to accept this patch or is there any
better way to solve this? Of course it sounds like the wrong place to
fix this problem as it's not a ninja problem at all, nor it should
affect building with any other compilers than clang (and not on
Windows either).

- Jiang

Nico Weber

unread,
Apr 16, 2013, 1:49:49 PM4/16/13
to Jiang Jiang, Kinuko Yasuda, Taiju Tsuiki, chromium-dev
Do you know why this isn't a problem with gcc? Do you think it's possible to fix this in clang instead? (clang fixes make it into chromium's clang relatively quickly.)

I think there were a few threads on clang's cfe-dev list a while ago.
 

- Jiang

Jiang Jiang

unread,
Apr 16, 2013, 5:58:57 PM4/16/13
to Nico Weber, Kinuko Yasuda, Taiju Tsuiki, chromium-dev
On Tue, Apr 16, 2013 at 7:49 PM, Nico Weber <tha...@chromium.org> wrote:
> Do you know why this isn't a problem with gcc? Do you think it's possible to
> fix this in clang instead? (clang fixes make it into chromium's clang
> relatively quickly.)

Perhaps gcc doesn't have that sorts of logic for PCHs? I could only
guess as I'm not familiar with either. I can try to fix it in clang or
it's interaction with ccache, but I'm not entirely sure how to
approach it yet. I will have to familiarize myself with the PCH layout
in clang first.

Speaking of PCH, any particular reason for gyp's ninja generator not
producing clang -include-pch but rather use gcc style -include when
the compiler is clang (also the target file name is gch instead of
pch)? clang might treat them equally but I was just wondering if there
is any difference. It's not a very widely discussed topic and the only
thing I have found so far is this
https://lists.samba.org/archive/ccache/2012q3/000932.html on adding
clang PCH support to ccache.

> I think there were a few threads on clang's cfe-dev list a while ago.

Would be nice if you can point out some keywords to search for.

- Jiang

vchi...@yandex-team.ru

unread,
Apr 17, 2013, 4:45:18 AM4/17/13
to chromi...@chromium.org, Nico Weber, Kinuko Yasuda, Taiju Tsuiki
Not sure whether it is what you are looking for, but here is our approach. To overcome this problem we just set chromium_mac_pch=0 in GYP_DEFNIES, that disabled precompiled headers and errors during build gone.

Hope this helps,
Slava
Reply all
Reply to author
Forward
0 new messages