From 754d6f5226a532ed086afa276b48e89ffafe0484 Mon Sep 17 00:00:00 2001 From: Ionen Wolkens Date: Thu, 9 May 2024 04:19:17 -0400 Subject: dev-qt/qtwebengine: improve clang-18 workaround w/ -mevex512 (qt6) Hoping it will be a short-lived and that this will be improved/fixed in clang itself. (have not tried nor looked at qtwebengine:5) For some rough explanation from the little I get from this: clang-18 added -mevex512 (missing from 17), and then -march=native is a bit quirky in that unlike -march=exact it goes out of its way to disable it resulting in e.g. -march=skylake -mavx512f = -mevex512 is auto-enabled -march=skylake -mevex512 = not "enabled" but can be used -march=native(skylake) -mavx512f = forced off(!) And then units that use avx512 / pass -mavx512f (for use with runtime cpu detection) end in build failure without evex512. Always passing -mevex512 on a machine without avx512 "seems" safe, it does not even set __EVEX512__ and believe won't use any avx512 instructions on a whim (__EVEX512__ does get set if add -mavx512f). Or at least my skylake (not skylake-x) passes test + can use the qtwebengine built that way. Considered passing only for files that need it at first with a patch (sounded safer), but chromium's Gn files don't have a variable to test clang version that I could see (or at least not in old qtwebengine) and didn't want this to become more involved nor use conditional patching. The !avx512 check may not be super necessary, but have not dug into the implications of forcing it when avx512 is actually enabled (sounds there are cases where it needs to be off, leaving it to compiler). Bug: https://bugs.gentoo.org/931623 Signed-off-by: Ionen Wolkens --- dev-qt/qtwebengine/qtwebengine-6.7.0.ebuild | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'dev-qt/qtwebengine/qtwebengine-6.7.0.ebuild') diff --git a/dev-qt/qtwebengine/qtwebengine-6.7.0.ebuild b/dev-qt/qtwebengine/qtwebengine-6.7.0.ebuild index 0829dcfa3b22..cccffedf5380 100644 --- a/dev-qt/qtwebengine/qtwebengine-6.7.0.ebuild +++ b/dev-qt/qtwebengine/qtwebengine-6.7.0.ebuild @@ -239,19 +239,15 @@ src_configure() { # for simplicity. Override with USE=custom-cflags if wanted, please # report if above -march works again so can cleanup. use arm64 && tc-is-gcc && filter-flags '-march=*' '-mcpu=*' - - # skia and xnnpack fail with clang-18 + some(?) -march=native while - # can't reproduce with seemingly equivalent =skylake), needs more - # looking into as there may be something odd going on (clang bug?). - # Note that upstream Qt disallows custom *FLAGS on qtwebengine meaning - # we are not supposed to pass -march=native in the first place. - # TODO: try dropping this on major Qt and clang bumps - # See also: https://groups.google.com/g/skia-discuss/c/DNW4oq3W2fI - # (Transform_inl.h:769:21: error: AVX vector without 'evex512') - use amd64 && tc-is-clang && [[ $(clang-major-version) -ge 18 ]] && - filter-flags -march=native fi + # Workaround for build failure with clang-18 and -march=native without + # avx512. Does not affect e.g. -march=skylake, only native (bug #931623). + use amd64 && tc-is-clang && is-flagq -march=native && + [[ $(clang-major-version) -ge 18 ]] && + tc-cpp-is-true "!defined(__AVX512F__)" ${CXXFLAGS} && + append-flags -mevex512 + export NINJA NINJAFLAGS=$(get_NINJAOPTS) [[ ${NINJA_VERBOSE^^} == OFF ]] || NINJAFLAGS+=" -v" -- cgit v1.2.3