Bug 141481

Summary: [CMake] Don't set flag fuse-ld on the C/C++ compiler flags, but on the linker flags.
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: Tools / TestsAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, gyuyoung.kim, jfernandez, ossy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Carlos Alberto Lopez Perez 2015-02-11 11:20:37 PST
Revision r176442 <http://trac.webkit.org/r176442> added support for the automatic detection and usage of the gold linker.

However, setting the flag fuse-ld on the C/C++ compiler flags causes trouble with the Clang compiler when this is used in combination with icecc https://trac.webkit.org/wiki/WebKitGTK/SpeedUpBuild#Usingiceccwithclang

It seem that the proper place to set this flag is on the linker flags.

For reference, Chromium developers also faced the same problem https://codereview.chromium.org/265263002
Comment 1 Carlos Alberto Lopez Perez 2015-02-11 11:23:57 PST
Created attachment 246399 [details]
Patch
Comment 2 Carlos Alberto Lopez Perez 2015-02-11 11:25:07 PST
I tested the attached patch by setting both fuse-ld=bfd and fuse-ld=gold and checking what linker was used when compiling, it works fine with both GCC and Clang.
Comment 3 Csaba Osztrogonác 2015-02-11 11:28:13 PST
Comment on attachment 246399 [details]
Patch

LGTM, r=me.

Just out of curiosity, what kind of problem have you seen with clang/icecc combo?
I built WebKit EFL many times nowadays without any problem with clang and icecc.
Comment 4 Carlos Alberto Lopez Perez 2015-02-11 12:09:27 PST
(In reply to comment #3)
> Comment on attachment 246399 [details]
> Patch
> 
> LGTM, r=me.
> 
> Just out of curiosity, what kind of problem have you seen with clang/icecc
> combo?
> I built WebKit EFL many times nowadays without any problem with clang and
> icecc.

Some hosts where refusing to build with that flag, don't know why.

Example:

Run Build Command:"/usr/bin/ninja" "cmTryCompileExec3670415570"
[1/2] Building C object CMakeFiles/cmTryCompileExec3670415570.dir/CheckIncludeFiles.c.o
FAILED: /usr/lib/ccache/clang   -fuse-ld=gold -Qunused-arguments -o CMakeFiles/cmTryCompileExec3670415570.dir/CheckIncludeFiles.c.o   -c CheckIncludeFiles.c
clang: error: invalid linker name in argument '-fuse-ld=gold'
ICECC[1871] 21:07:56: Compiled on 192.168.1.108
ninja: build stopped: subcommand failed.
Comment 5 WebKit Commit Bot 2015-02-11 12:12:38 PST
Comment on attachment 246399 [details]
Patch

Clearing flags on attachment: 246399

Committed r179943: <http://trac.webkit.org/changeset/179943>
Comment 6 WebKit Commit Bot 2015-02-11 12:12:42 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Carlos Alberto Lopez Perez 2015-02-11 12:13:21 PST
More examples:

[32/5568] Building CXX object Source/WebCore/CMakeFiles/ANGLESupport.dir/__/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp.o
FAILED: /usr/lib/ccache/clang++   -DBUILDING_GTK__=1 -DBUILDING_WEBKIT -DBUILDING_WITH_CMAKE=1 -DDATA_DIR=\"share\" -DENABLE_3D_RENDERING=1 -DENABLE_PLUGIN_PROCESS_GTK2=1 -DGETTEXT_PACKAGE=\"WebKit2GTK-4.0\" -DHAVE_CONFIG_H=1 -DMOZ_X11=1 -DUSER_AGENT_GTK_MAJOR_VERSION=601 -DUSER_AGENT_GTK_MINOR_VERSION=1 -DWEBKITGTK_API_VERSION_STRING=\"4.0\" -DWEBKIT_DOM_USE_UNSTABLE_API -DWTF_PLATFORM_X11=1 -DWTF_USE_3D_GRAPHICS=1 -DWTF_USE_EGL=1 -DWTF_USE_GLX=1 -DWTF_USE_GSTREAMER -DWTF_USE_GSTREAMER_MPEGTS -DWTF_USE_LIBNOTIFY=1 -DWTF_USE_OPENGL=1 -DWTF_USE_TEXTURE_MAPPER=1 -DWTF_USE_TEXTURE_MAPPER_GL=1 -DWTF_USE_WEBAUDIO_GSTREAMER -DXP_UNIX -std=c++11 -fuse-ld=gold -Qunused-arguments -O3 -DNDEBUG -fno-exceptions -fno-strict-aliasing -fno-rtti -I../../Source/WebCore -I../../Source/WebCore/Modules/airplay -I../../Source/WebCore/Modules/battery -I../../Source/WebCore/Modules/encryptedmedia -I../../Source/WebCore/Modules/gamepad -I../../Source/WebCore/Modules/gamepad/deprecated -I../../Source/WebCore/Modules/geolocation -I../../Source/WebCore/Modules/indexeddb -I../../Source/WebCore/Modules/indieui -I../../Source/WebCore/Modules/mediacontrols -I../../Source/WebCore/Modules/mediasource -I../../Source/WebCore/Modules/mediastream -I../../Source/WebCore/Modules/navigatorcontentutils -I../../Source/WebCore/Modules/notifications -I../../Source/WebCore/Modules/plugins -I../../Source/WebCore/Modules/proximity -I../../Source/WebCore/Modules/quota -I../../Source/WebCore/Modules/speech -I../../Source/WebCore/Modules/streams -I../../Source/WebCore/Modules/vibration -I../../Source/WebCore/Modules/webaudio -I../../Source/WebCore/Modules/webdatabase -I../../Source/WebCore/Modules/websockets -I../../Source/WebCore/accessibility -I../../Source/WebCore/bindings -I../../Source/WebCore/bindings/generic -I../../Source/WebCore/bindings/js -I../../Source/WebCore/bridge -I../../Source/WebCore/bridge/c -I../../Source/WebCore/bridge/jsc -I../../Source/WebCore/crypto -I../../Source/WebCore/crypto/algorithms -I../../Source/WebCore/crypto/keys -I../../Source/WebCore/crypto/parameters -I../../Source/WebCore/css -I../../Source/WebCore/cssjit -I../../Source/WebCore/dom -I../../Source/WebCore/dom/default -I../../Source/WebCore/editing -I../../Source/WebCore/fileapi -I../../Source/WebCore/history -I../../Source/WebCore/html -I../../Source/WebCore/html/canvas -I../../Source/WebCore/html/forms -I../../Source/WebCore/html/parser -I../../Source/WebCore/html/shadow -I../../Source/WebCore/html/track -I../../Source/WebCore/inspector -I../../Source/WebCore/loader -I../../Source/WebCore/loader/appcache -I../../Source/WebCore/loader/archive -I../../Source/WebCore/loader/archive/mhtml -I../../Source/WebCore/loader/cache -I../../Source/WebCore/loader/icon -I../../Source/WebCore/mathml -I../../Source/WebCore/page -I../../Source/WebCore/page/animation -I../../Source/WebCore/page/scrolling -I../../Source/WebCore/platform -I../../Source/WebCore/platform/animation -I../../Source/WebCore/platform/audio -I../../Source/WebCore/platform/graphics -I../../Source/WebCore/platform/graphics/cpu/arm -I../../Source/WebCore/platform/graphics/cpu/arm/filters -I../../Source/WebCore/platform/graphics/filters -I../../Source/WebCore/platform/graphics/filters/texmap -I../../Source/WebCore/platform/graphics/harfbuzz -I../../Source/WebCore/platform/graphics/harfbuzz/ng -I../../Source/WebCore/platform/graphics/opentype -I../../Source/WebCore/platform/graphics/texmap -I../../Source/WebCore/platform/graphics/transforms -I../../Source/WebCore/platform/image-decoders -I../../Source/WebCore/platform/image-decoders/bmp -I../../Source/WebCore/platform/image-decoders/gif -I../../Source/WebCore/platform/image-decoders/ico -I../../Source/WebCore/platform/image-decoders/jpeg -I../../Source/WebCore/platform/image-decoders/png -I../../Source/WebCore/platform/image-decoders/webp -I../../Source/WebCore/platform/mediastream -I../../Source/WebCore/platform/mock -I../../Source/WebCore/platform/network -I../../Source/WebCore/platform/sql -I../../Source/WebCore/platform/text -I../../Source/WebCore/platform/text/icu -I../../Source/WebCore/plugins -I../../Source/WebCore/rendering -I../../Source/WebCore/rendering/line -I../../Source/WebCore/rendering/mathml -I../../Source/WebCore/rendering/shapes -I../../Source/WebCore/rendering/style -I../../Source/WebCore/rendering/svg -I../../Source/WebCore/replay -I../../Source/WebCore/storage -I../../Source/WebCore/style -I../../Source/WebCore/svg -I../../Source/WebCore/svg/animation -I../../Source/WebCore/svg/graphics -I../../Source/WebCore/svg/graphics/filters -I../../Source/WebCore/svg/properties -I../../Source/WebCore/websockets -I../../Source/WebCore/workers -I../../Source/WebCore/xml -I../../Source/WebCore/xml/parser -I../../Source/JavaScriptCore -I../../Source/JavaScriptCore/ForwardingHeaders -I../../Source/JavaScriptCore/API -I../../Source/JavaScriptCore/assembler -I../../Source/JavaScriptCore/bytecode -I../../Source/JavaScriptCore/bytecompiler -I../../Source/JavaScriptCore/dfg -I../../Source/JavaScriptCore/disassembler -I../../Source/JavaScriptCore/heap -I../../Source/JavaScriptCore/debugger -I../../Source/JavaScriptCore/interpreter -I../../Source/JavaScriptCore/jit -I../../Source/JavaScriptCore/llint -I../../Source/JavaScriptCore/parser -I../../Source/JavaScriptCore/profiler -I../../Source/JavaScriptCore/runtime -I../../Source/JavaScriptCore/yarr -I../../Source/WTF -IDerivedSources -IDerivedSources/ForwardingHeaders -IDerivedSources/JavaScriptCore -IDerivedSources/JavaScriptCore/inspector -IDerivedSources/WebCore -I../../Source -I. -I/usr/include/x86_64-linux-gnu -I../../Source/ThirdParty/ANGLE/src -I../../Source/ThirdParty/ANGLE/include -I../../Source/ThirdParty/ANGLE/include/KHR -I../../Source/ThirdParty/ANGLE/include/GLSLANG -I../../Source/WebCore/platform/graphics/gpu -I../../Source/WebCore/accessibility/atk -I../../Source/WebCore/editing/atk -I../../Source/WebCore/page/gtk -I../../Source/WebCore/platform/cairo -I../../Source/WebCore/platform/geoclue -I../../Source/WebCore/platform/gtk -I../../Source/WebCore/platform/graphics/cairo -I../../Source/WebCore/platform/graphics/egl -I../../Source/WebCore/platform/graphics/glx -I../../Source/WebCore/platform/graphics/gtk -I../../Source/WebCore/platform/graphics/freetype -I../../Source/WebCore/platform/graphics/opengl -I../../Source/WebCore/platform/graphics/wayland -I../../Source/WebCore/platform/linux -I../../Source/WebCore/platform/mediastream/gstreamer -I../../Source/WebCore/platform/mock/mediasource -I../../Source/WebCore/platform/network/gtk -I../../Source/WebCore/platform/network/soup -I../../Source/WebCore/platform/text/gtk -I../DependenciesGTK/Root/include/atk-1.0 -I../DependenciesGTK/Root/include/cairo -I/usr/include/enchant -I../DependenciesGTK/Root/include/freetype2/freetype -I../DependenciesGTK/Root/include/freetype2 -I../DependenciesGTK/Root/include/gio-unix-2.0 -I../DependenciesGTK/Root/include/glib-2.0 -I../DependenciesGTK/Root/lib64/glib-2.0/include -I../DependenciesGTK/Root/include/harfbuzz -I/usr/include/libsecret-1 -I../DependenciesGTK/Root/include/libsoup-2.4 -I../DependenciesGTK/Root/include/libxml2 -I../../Source/WebCore/platform/graphics/gstreamer -I../DependenciesGTK/Root/include/gstreamer-1.0 -I../../Source/WebCore/platform/audio/gstreamer -I../../Source/WebCore/bindings/gobject -IDerivedSources/webkitdom -I../../Source/WebCore/testing    -fPIC -MMD -MT Source/WebCore/CMakeFiles/ANGLESupport.dir/__/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp.o -MF Source/WebCore/CMakeFiles/ANGLESupport.dir/__/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp.o.d -o Source/WebCore/CMakeFiles/ANGLESupport.dir/__/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp.o -c ../../Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp
ICECC[7177] 21:11:35: write of source chunk to host 192.168.1.35
ICECC[7177] 21:11:35: failed  Connection reset by peer
ICECC[7177] 21:11:35: got exception 15 (192.168.1.35) 
clang: error: unable to execute command: Error waiting for child process: Inappropriate ioctl for device
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Debian clang version 3.5.0-9 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://bugs.debian.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
ninja: build stopped: subcommand failed.



This errors are gone once this flag is removed from the C/C++ compiler flags.