From 5a828cb3b888b67dfde30e9134a1d29fb29e24a3 Mon Sep 17 00:00:00 2001 From: Winfried Dobbe Date: Thu, 9 Nov 2023 14:39:05 +0100 Subject: [PATCH 1/4] Fix assembly error in qt5 webengine module with binutils >= 2.41 --- recipes/qt/5.x.x/conandata.yml | 5 ++ .../patches/ffmpeg-x86-optimization.patch | 64 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index db92ab6d5dace..f9fcf9a224d25 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -108,6 +108,11 @@ patches: patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" + - patch_file: "patches/ffmpeg-x86-optimization.patch" + base_path: "qt5/qtwebengine" + patch_description: "Fix build error with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://packages.ubuntu.com/source/focal-updates/qtwebengine-opensource-src" "5.15.10": - "base_path": "qt5/qtbase" "patch_file": "patches/aa2a39dea5.diff" diff --git a/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch b/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch new file mode 100644 index 0000000000000..cff8df9a43395 --- /dev/null +++ b/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch @@ -0,0 +1,64 @@ +Description: avcodec/x86/mathops: clip constants used with shift instructions within inline assembly + Fixes assembling with gas from binutils >= 2.41. +Origin: upstream, https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/effadce6c756247e +Bug: https://bugs.debian.org/1038132 +Last-Update: 2023-07-21 + +--- a/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h ++++ b/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ __asm__ volatile(\ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + From b704d37f9191e27a9a72ccc62777929721e3d8c0 Mon Sep 17 00:00:00 2001 From: Winfried Dobbe Date: Thu, 9 Nov 2023 16:09:32 +0100 Subject: [PATCH 2/4] Change patch_source to upstream bug report. Co-authored-by: Jordan Williams --- recipes/qt/5.x.x/conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index f9fcf9a224d25..aac7e70226266 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -112,7 +112,7 @@ patches: base_path: "qt5/qtwebengine" patch_description: "Fix build error with binutils >= 2.41" patch_type: "portability" - patch_source: "https://packages.ubuntu.com/source/focal-updates/qtwebengine-opensource-src" + patch_source: "https://trac.ffmpeg.org/ticket/10405" "5.15.10": - "base_path": "qt5/qtbase" "patch_file": "patches/aa2a39dea5.diff" From c5be0067174b85e3b241f0df920af8cb5ed144a3 Mon Sep 17 00:00:00 2001 From: Winfried Dobbe Date: Thu, 30 Nov 2023 15:29:48 +0100 Subject: [PATCH 3/4] In response to review feedback: Change basepath of ffmpeg assembly fix. Add ffmpeg patch also to older 5.15.x releases. --- recipes/qt/5.x.x/conandata.yml | 24 +++++++++++++++-- recipes/qt/5.x.x/conanfile.py | 6 ++--- ...x_ffmpeg_assembly_for_binutils_2_41.patch} | 26 ++++++++++++++----- 3 files changed, 44 insertions(+), 12 deletions(-) rename recipes/qt/5.x.x/patches/{ffmpeg-x86-optimization.patch => fix_ffmpeg_assembly_for_binutils_2_41.patch} (71%) diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index aac7e70226266..5bf91b2de12c0 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -108,8 +108,8 @@ patches: patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" - - patch_file: "patches/ffmpeg-x86-optimization.patch" - base_path: "qt5/qtwebengine" + - patch_file: "patches/fix_ffmpeg_assembly_for_binutils_2_41.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg" patch_description: "Fix build error with binutils >= 2.41" patch_type: "portability" patch_source: "https://trac.ffmpeg.org/ticket/10405" @@ -146,6 +146,11 @@ patches: patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" + - patch_file: "patches/fix_ffmpeg_assembly_for_binutils_2_41.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg" + patch_description: "Fix build error with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://trac.ffmpeg.org/ticket/10405" "5.15.9": - "base_path": "qt5/qtbase" "patch_file": "patches/aa2a39dea5.diff" @@ -179,6 +184,11 @@ patches: patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" + - patch_file: "patches/fix_ffmpeg_assembly_for_binutils_2_41.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg" + patch_description: "Fix build error with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://trac.ffmpeg.org/ticket/10405" "5.15.8": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" @@ -212,6 +222,11 @@ patches: patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" + - patch_file: "patches/fix_ffmpeg_assembly_for_binutils_2_41.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg" + patch_description: "Fix build error with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://trac.ffmpeg.org/ticket/10405" "5.15.7": - patch_file: "patches/337f28c9ab.patch" base_path: "qt5/qtbase" @@ -253,3 +268,8 @@ patches: patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" + - patch_file: "patches/fix_ffmpeg_assembly_for_binutils_2_41.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg" + patch_description: "Fix build error with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://trac.ffmpeg.org/ticket/10405" diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index a4c631120b356..6cc6218067249 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -151,7 +151,7 @@ def validate_build(self): # In any case, check its actual version for compatibility from six import StringIO # Python 2 and 3 compatible mybuf = StringIO() - cmd_v = f"\"{python_exe}\" --version" + cmd_v = f"\"{python_exe}\" --version 2>&1" self.run(cmd_v, mybuf) verstr = mybuf.getvalue().strip().split("Python ")[1] if verstr.endswith("+"): @@ -355,7 +355,7 @@ def requirements(self): if self.options.with_doubleconversion and not self.options.multiconfiguration: self.requires("double-conversion/3.3.0") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: - self.requires("freetype/2.13.2") + self.requires("freetype/2.13.2", override=True) if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.14.2") if self.options.get_safe("with_icu", False): @@ -370,7 +370,7 @@ def requirements(self): if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: self.requires("libpng/1.6.40") if self.options.with_sqlite3 and not self.options.multiconfiguration: - self.requires("sqlite3/3.44.2") + self.requires("sqlite3/3.44.2", override=True) if self.options.get_safe("with_mysql", False): self.requires("libmysqlclient/8.1.0") if self.options.with_pq: diff --git a/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch b/recipes/qt/5.x.x/patches/fix_ffmpeg_assembly_for_binutils_2_41.patch similarity index 71% rename from recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch rename to recipes/qt/5.x.x/patches/fix_ffmpeg_assembly_for_binutils_2_41.patch index cff8df9a43395..52a93100299cc 100644 --- a/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch +++ b/recipes/qt/5.x.x/patches/fix_ffmpeg_assembly_for_binutils_2_41.patch @@ -1,11 +1,20 @@ -Description: avcodec/x86/mathops: clip constants used with shift instructions within inline assembly - Fixes assembling with gas from binutils >= 2.41. -Origin: upstream, https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/effadce6c756247e -Bug: https://bugs.debian.org/1038132 -Last-Update: 2023-07-21 +From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 +From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= +Date: Sun, 16 Jul 2023 18:18:02 +0300 +Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift + instructions within inline assembly ---- a/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h -+++ b/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h +Fixes assembling with binutil as >= 2.41 + +Signed-off-by: James Almer +--- + libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h +index 6298f5ed19..ca7e2dffc1 100644 +--- a/libavcodec/x86/mathops.h ++++ b/libavcodec/x86/mathops.h @@ -35,12 +35,20 @@ static av_always_inline av_const int MULL(int a, int b, unsigned shift) { @@ -62,3 +71,6 @@ Last-Update: 2023-07-21 return a; } +-- +2.25.1 + From a27843e532417a6fa8c3f8bb863a4e1f2f7f216f Mon Sep 17 00:00:00 2001 From: Winfried Dobbe Date: Fri, 1 Dec 2023 15:04:49 +0100 Subject: [PATCH 4/4] Revert accidental changes that were necessary to make Qt 5.15 build on my machine. --- recipes/qt/5.x.x/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index 6cc6218067249..a4c631120b356 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -151,7 +151,7 @@ def validate_build(self): # In any case, check its actual version for compatibility from six import StringIO # Python 2 and 3 compatible mybuf = StringIO() - cmd_v = f"\"{python_exe}\" --version 2>&1" + cmd_v = f"\"{python_exe}\" --version" self.run(cmd_v, mybuf) verstr = mybuf.getvalue().strip().split("Python ")[1] if verstr.endswith("+"): @@ -355,7 +355,7 @@ def requirements(self): if self.options.with_doubleconversion and not self.options.multiconfiguration: self.requires("double-conversion/3.3.0") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: - self.requires("freetype/2.13.2", override=True) + self.requires("freetype/2.13.2") if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.14.2") if self.options.get_safe("with_icu", False): @@ -370,7 +370,7 @@ def requirements(self): if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: self.requires("libpng/1.6.40") if self.options.with_sqlite3 and not self.options.multiconfiguration: - self.requires("sqlite3/3.44.2", override=True) + self.requires("sqlite3/3.44.2") if self.options.get_safe("with_mysql", False): self.requires("libmysqlclient/8.1.0") if self.options.with_pq: