From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5F981158089 for ; Tue, 5 Sep 2023 13:05:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5277A2BC040; Tue, 5 Sep 2023 13:05:51 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 567082BC03B for ; Tue, 5 Sep 2023 13:05:50 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 45F70335CB7 for ; Tue, 5 Sep 2023 13:05:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B5F3C1134 for ; Tue, 5 Sep 2023 13:05:47 +0000 (UTC) From: "Ionen Wolkens" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ionen Wolkens" Message-ID: <1693918871.aa6feab907d063181e5bebeb052c3bd72843449b.ionen@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtbase/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-qt/qtbase/qtbase-6.5.2-r1.ebuild dev-qt/qtbase/qtbase-6.5.9999.ebuild dev-qt/qtbase/qtbase-6.9999.ebuild X-VCS-Directories: dev-qt/qtbase/ X-VCS-Committer: ionen X-VCS-Committer-Name: Ionen Wolkens X-VCS-Revision: aa6feab907d063181e5bebeb052c3bd72843449b X-VCS-Branch: master Date: Tue, 5 Sep 2023 13:05:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b8cfb6ba-056a-4e39-ab2e-343470b9262f X-Archives-Hash: 9a1be44e9732caf33be482204a0dd49b commit: aa6feab907d063181e5bebeb052c3bd72843449b Author: Ionen Wolkens gentoo org> AuthorDate: Sat Sep 2 06:09:58 2023 +0000 Commit: Ionen Wolkens gentoo org> CommitDate: Tue Sep 5 13:01:11 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa6feab9 dev-qt/qtbase: workaround x86intrin test and feature selection qtbase does a single "big" test for all basic cpu features, and if CXXFLAGS have any matching -mno-* then they will override Qt's flags and the test fails. Surprised by this, Qt aborts unless explicitly disable the feature. Test can be bypassed, but then it does not perform per-flags tests and will fail to build as-is. Like bug #913400, debated a few options: 1. cpu_flags_x86_* to enable each feature, but given this is tied to compiler flags we'd still need to test them to avoid failures and not much better off, not to mention bug #913400 may have added its own -mno-* that go against these. 2. Patching cmake files so it always pass its e.g. -mavx2 after the user's flags (when needed), and does not rely on -march=haswell given that does not override. But fwiw these files do get installed and will alter expected behavior, and handling -march is more annoying. 3. Patch out the bit that makes the x86intrin test prevent building unless explicitly disabled, and let it auto-disable x86intrin entirely if tests fail (subpar for performance if ignored). 4. Do self-tests and disable features that will fail, this has the advantage that revdeps will not try to use these either. 5. One option to bug #913400 was to force simpler flags, which would also solve this. Picked #4 for now, not that particularly like it given it feels like automagic. Hoping will be more temporary than qsimd_p.h workarounds. Better than doing nothing either way, is a no-op for non-affected users. Bug: https://bugs.gentoo.org/908420 Closes: https://bugs.gentoo.org/913400 Signed-off-by: Ionen Wolkens gentoo.org> dev-qt/qtbase/qtbase-6.5.2-r1.ebuild | 36 +++++++++++++++++++++++++++++++++++- dev-qt/qtbase/qtbase-6.5.9999.ebuild | 36 +++++++++++++++++++++++++++++++++++- dev-qt/qtbase/qtbase-6.9999.ebuild | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 105 insertions(+), 3 deletions(-) diff --git a/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild b/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild index 5fa82d9c7db0..57694adc046b 100644 --- a/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild +++ b/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit qt6-build +inherit flag-o-matic qt6-build toolchain-funcs DESCRIPTION="Cross-platform application development framework" @@ -222,6 +222,40 @@ src_configure() { -DQT_FEATURE_sql_tds=OFF # currently a no-op in CMakeLists.txt ) + if use amd64 || use x86; then + # see bug #913400 for explanations + local cpufeats=( + # list of checked cpu features in configure.cmake + avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl} + f16c rdrnd rdseed sse2 sse3 sse4_1 sse4_2 ssse3 vaes + ) + # handle odd ones out not matching -m* and macros (keep same order) + local cpuflags=( "${cpufeats[@]}" aes sha ) + local cpufeats+=( aesni shani ) + + local -a intrins + IFS=' ' read -ra intrins < <( + : "$(test-flags-CXX "${cpuflags[@]/#/-m}")" + $(tc-getCXX) -E -P ${_} ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1 + #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) + #include + #endif + $(printf '__%s__ ' "${cpuflags[@]^^}") + EOF + assert + ) + + # do nothing and leave to qtbase if no macros expanded (test failed?) + if [[ \ ${intrins[*]} == *\ [^_\ ]* ]]; then + local -i i + for ((i=0; i<${#cpufeats[@]}; i++)); do + [[ ${intrins[i]} == __* ]] && + mycmakeargs+=( -DQT_FEATURE_${cpufeats[i]}=OFF ) + done + mycmakeargs+=( -DTEST_x86intrin=ON ) + fi + fi + qt6-build_src_configure } diff --git a/dev-qt/qtbase/qtbase-6.5.9999.ebuild b/dev-qt/qtbase/qtbase-6.5.9999.ebuild index 3c339f31f8b7..a71f3078a605 100644 --- a/dev-qt/qtbase/qtbase-6.5.9999.ebuild +++ b/dev-qt/qtbase/qtbase-6.5.9999.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit qt6-build +inherit flag-o-matic qt6-build toolchain-funcs DESCRIPTION="Cross-platform application development framework" @@ -217,6 +217,40 @@ src_configure() { -DQT_FEATURE_sql_tds=OFF # currently a no-op in CMakeLists.txt ) + if use amd64 || use x86; then + # see bug #913400 for explanations + local cpufeats=( + # list of checked cpu features in configure.cmake + avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl} + f16c rdrnd rdseed sse2 sse3 sse4_1 sse4_2 ssse3 vaes + ) + # handle odd ones out not matching -m* and macros (keep same order) + local cpuflags=( "${cpufeats[@]}" aes sha ) + local cpufeats+=( aesni shani ) + + local -a intrins + IFS=' ' read -ra intrins < <( + : "$(test-flags-CXX "${cpuflags[@]/#/-m}")" + $(tc-getCXX) -E -P ${_} ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1 + #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) + #include + #endif + $(printf '__%s__ ' "${cpuflags[@]^^}") + EOF + assert + ) + + # do nothing and leave to qtbase if no macros expanded (test failed?) + if [[ \ ${intrins[*]} == *\ [^_\ ]* ]]; then + local -i i + for ((i=0; i<${#cpufeats[@]}; i++)); do + [[ ${intrins[i]} == __* ]] && + mycmakeargs+=( -DQT_FEATURE_${cpufeats[i]}=OFF ) + done + mycmakeargs+=( -DTEST_x86intrin=ON ) + fi + fi + qt6-build_src_configure } diff --git a/dev-qt/qtbase/qtbase-6.9999.ebuild b/dev-qt/qtbase/qtbase-6.9999.ebuild index 3c339f31f8b7..a71f3078a605 100644 --- a/dev-qt/qtbase/qtbase-6.9999.ebuild +++ b/dev-qt/qtbase/qtbase-6.9999.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit qt6-build +inherit flag-o-matic qt6-build toolchain-funcs DESCRIPTION="Cross-platform application development framework" @@ -217,6 +217,40 @@ src_configure() { -DQT_FEATURE_sql_tds=OFF # currently a no-op in CMakeLists.txt ) + if use amd64 || use x86; then + # see bug #913400 for explanations + local cpufeats=( + # list of checked cpu features in configure.cmake + avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl} + f16c rdrnd rdseed sse2 sse3 sse4_1 sse4_2 ssse3 vaes + ) + # handle odd ones out not matching -m* and macros (keep same order) + local cpuflags=( "${cpufeats[@]}" aes sha ) + local cpufeats+=( aesni shani ) + + local -a intrins + IFS=' ' read -ra intrins < <( + : "$(test-flags-CXX "${cpuflags[@]/#/-m}")" + $(tc-getCXX) -E -P ${_} ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1 + #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) + #include + #endif + $(printf '__%s__ ' "${cpuflags[@]^^}") + EOF + assert + ) + + # do nothing and leave to qtbase if no macros expanded (test failed?) + if [[ \ ${intrins[*]} == *\ [^_\ ]* ]]; then + local -i i + for ((i=0; i<${#cpufeats[@]}; i++)); do + [[ ${intrins[i]} == __* ]] && + mycmakeargs+=( -DQT_FEATURE_${cpufeats[i]}=OFF ) + done + mycmakeargs+=( -DTEST_x86intrin=ON ) + fi + fi + qt6-build_src_configure }