Bug 130009

Summary: [GTK] Cannot build with cmake+ninja and icecc
Product: WebKit Reporter: Alberto Garcia <berto>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs-noreply, clopez, pnormand
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Alberto Garcia 2014-03-10 01:55:23 PDT
$ CC="icecc clang" CXX="icecc clang++" Tools/Scripts/build-webkit --gtk --makeargs=-j16
[...]
FAILED: cd /home/devel/WebKit/WebKitBuild/Release/Source/WebCore && /usr/bin/perl -I/home/devel/WebKit/Source/WebCore/bindings/scripts /home/devel/WebKit/Source/WebCore/dom/make_names.pl --preprocessor "/usr/bin/icecc -E -x c++" --outputDir /home/devel/WebKit/WebKitBuild/Release/DerivedSources/WebCore --attrs /home/devel/WebKit/Source/WebCore/svg/svgattrs.in --tags /home/devel/WebKit/Source/WebCore/svg/svgtags.in --factory --wrapperFactory "--extraDefines= ENABLE_FILTERS=1 ENABLE_SVG_FONTS=1"

If you see, the --preprocessor option uses "icecc -E" instead of "icecc clang++ -E".

This is because in CMakeCache.txt:

   CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/icecc
   CMAKE_CXX_COMPILER_ARG1:STRING= clang++

And in Source/cmake/OptionsCommon.cmake:

   set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -P -x c++")
Comment 1 Carlos Alberto Lopez Perez 2015-02-12 02:52:57 PST
Can you try with the procedure I documented at https://trac.webkit.org/wiki/WebKitGTK/SpeedUpBuild#Usingiceccwithclang ?

It works fine for me (after r179943), using icecc+ccache+clang.
Comment 2 Alberto Garcia 2015-02-12 03:51:55 PST
Yes, there are workarounds. Also e.g.

$ ln -s /usr/bin/icecc /tmp/clang
$ ln -s /usr/bin/icecc /tmp/clang++
$ CC=/tmp/clang CXX=/tmp/clang++ Tools/Scripts/build-webkit ...

I opened the bug in case there was an easier way to do it, before we switched to cmake a simple CC="icecc clang" was enough.
Comment 3 Carlos Alberto Lopez Perez 2015-02-12 08:53:52 PST
(In reply to comment #2)
> Yes, there are workarounds. Also e.g.
> 
> $ ln -s /usr/bin/icecc /tmp/clang
> $ ln -s /usr/bin/icecc /tmp/clang++
> $ CC=/tmp/clang CXX=/tmp/clang++ Tools/Scripts/build-webkit ...
> 
> I opened the bug in case there was an easier way to do it, before we
> switched to cmake a simple CC="icecc clang" was enough.

I guess the problem is with invoking the CC compiler as a program with arguments (program=icecc, argument=clang) rather than just a program (by doing the trick of using symlinks and changing the PATH).

I don't know if this is a bug of WebKitGTK+ or is in CMake itself. I always used the symlink+path way.

Also, if you want to use icecc+ccache together, I don't see how that will work with the CC="icecc clang" method.
Comment 4 Alberto Garcia 2015-02-12 23:05:16 PST
(In reply to comment #3)
> I guess the problem is with invoking the CC compiler as a program
> with arguments (program=icecc, argument=clang) rather than just a
> program

Exactly.

> Also, if you want to use icecc+ccache together, I don't see how that
> will work with the CC="icecc clang" method.

I didn't want to use ccache myself, but it would be possible with the
same method using the CCACHE_PREFIX variable.