Details
Description
As noted in the title, I'm unable to build qtwebengine when qtbase is built with linux-clang-libc++ target.
First issue I encounter is that qmake doesn't set necessary gyp defines, and chromium source gets improperly configured:
Project MESSAGE: Running gyp_qtwebengine "/home/armin/src/system-management/buildscripts/qtwebengine-opensource-src-5.7.0-rc/src/core" -D qt_cross_compile=0 -D qt_os="desktop_linux" -D use_qt=1 -D v8_use_external_startup_data=0 -D enable_basic_printing=1 -D enable_print_preview=0 -D enable_web_speech=0 -D enable_extensions=0 -D linux_use_bundled_gold=0 -D linux_use_bundled_binutils=0 -D linux_use_gold_flags=0 -D toolkit_uses_gtk=0 -D use_ash=0 -D use_aura=1 -D use_cairo=0 -D use_clipboard_aurax11=0 -D use_cups=0 -D use_gconf=0 -D use_gio=0 -D use_gnome_keyring=0 -D use_kerberos=0 -D use_pango=0 -D use_openssl=1 -D use_nss_certs=1 -D use_openssl_certs=0 -D use_system_zlib=1 -D use_system_libpng=1 -D use_system_libjpeg=1 -D use_system_harfbuzz=1 -D use_system_libevent=1 -D use_system_libwebp=1 -D use_system_libxml=1 -D use_system_opus=1 -D use_system_libvpx=1 -D use_system_icu=1 -D icu_use_data_file_flag=0 -D desktop_linux=1 -D enable_widevine=1 -D clang=0 -D host_clang=0 -D qtwe_process_name_debug=QtWebEngineProcess -D qtwe_process_name_release=QtWebEngineProcess -D disable_glibcxx_debug=1 -D remove_webcore_debug_symbols=1 -D remove_v8base_debug_symbols=1 -D disable_fatal_linker_warnings=1 -D sysroot="" -D target_arch=x64 -D proprietary_codecs=1 -D ffmpeg_branding=Chrome -D enable_spellcheck=0... using python: /usr/bin/python version: 2.7.11 Using extra options found in /home/armin/src/system-management/buildscripts/qtwebengine-opensource-src-5.7.0-rc/src/core/qtwebengine_extras.gypi Using extra options found in /home/armin/src/system-management/buildscripts/qtwebengine-opensource-src-5.7.0-rc/src/core/qmake_extras.gypi Using extra options found in /home/armin/src/system-management/buildscripts/qtwebengine-opensource-src-5.7.0-rc/src/core/qtwebengine_extras.gypi Using extra options found in /home/armin/src/system-management/buildscripts/qtwebengine-opensource-src-5.7.0-rc/src/core/qmake_extras.gypi Updating projects from gyp files... clang-3.9: error: unsupported argument '--version' to option 'Xassembler' compiler_version.py failed to execute: clang++ -Xassembler --version -x assembler -c /dev/null Command 'clang++ -Xassembler --version -x assembler -c /dev/null' returned non-zero exit status 1 Exception: Failed to extract compiler version for args: ['target', 'assembler']
I can work this around using a sed:
sed -i "/linux-clang/a linux-clang-libc++: GYP_CONFIG += clang=1 host_clang=1 clang_use_chrome_plugins=0 make_clang_dir=/usr use_libcpp=1 werror=" src/core/config/desktop_linux.pri
It's basically a redefine of linux-clang target, with addition of use_libcpp=1 (as it seems other platforms where libc++ is being used set this too, not sure if it would work without it), and addition of werror=, which disables compiler erroring out on a warning. My current clang 3.9.0 svn snapshot produces a couple of warnings (which also happen in qtwebengine 5.6.0), and if Werror is left on, the compile process will stop. The warnings are:
/home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium.h:321:45: warning: instantiation of variable 'v8::internal::LSubKindOperand<v8::internal::LOperand::Kind::REGISTER, 16>::cache' required here, but no definition is available [-Wundefined-var-template] if (index < kNumCachedOperands) return &cache[index]; ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium-allocator.cc:204:25: note: in instantiation of member function 'v8::internal::LSubKindOperand<v8::internal::LOperand::Kind::REGISTER, 16>::Create' requested here op = LRegister::Create(assigned_register(), zone); ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium.h:334:27: note: forward declaration of template entity is here static LSubKindOperand* cache; ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium.h:321:45: note: add an explicit instantiation declaration to suppress this warning if 'v8::internal::LSubKindOperand<v8::internal::LOperand::Kind::REGISTER, 16>::cache' is explicitly instantiated in another translation unit if (index < kNumCachedOperands) return &cache[index]; ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium.h:321:45: warning: instantiation of variable 'v8::internal::LSubKindOperand<v8::internal::LOperand::Kind::DOUBLE_REGISTER, 16>::cache' required here, but no definition is available [-Wundefined-var-template] if (index < kNumCachedOperands) return &cache[index]; ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium-allocator.cc:207:31: note: in instantiation of member function 'v8::internal::LSubKindOperand<v8::internal::LOperand::Kind::DOUBLE_REGISTER, 16>::Create' requested here op = LDoubleRegister::Create(assigned_register(), zone); ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium.h:334:27: note: forward declaration of template entity is here static LSubKindOperand* cache; ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/v8/src/crankshaft/lithium.h:321:45: note: add an explicit instantiation declaration to suppress this warning if 'v8::internal::LSubKindOperand<v8::internal::LOperand::Kind::DOUBLE_REGISTER, 16>::cache' is explicitly instantiated in another translation unit if (index < kNumCachedOperands) return &cache[index]; ^ 2 warnings generated.
But still, chromium build would fail as it uses a function without an explicit define, and while such code works on libstdc+, it doesnt' work on libc+. The error I'm getting is:
/home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/GCInfo.cpp:52:54: error: use of undeclared identifier 'realloc' s_gcInfoTable = reinterpret_cast<GCInfo const**>(realloc(s_gcInfoTable, newSize * sizeof(GCInfo))); ^ /home/armin/src/qtwebengine-opensource-src-5.7.0-rc/src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/GCInfo.cpp:66:5: error: use of undeclared identifier 'free' free(s_gcInfoTable); ^ 2 errors generated.
The last error is fixed by implicitly adding cstdlib include to the mentioned file:
sed -i "/config.h/i #include <cstdlib>" src/3rdparty/chromium/third_party/WebKit/Source/platform/heap/GCInfo.cpp