A patch to enable building proprietary codecs in qtwebengine

  • Done
  • quality assurance status badge
Details
4 participants
  • Leo Famulari
  • Tobias Geerinckx-Rice
  • pkill9
  • Sergey Trofimov
Owner
unassigned
Submitted by
pkill9
Severity
normal
P
P
pkill9 wrote on 6 Feb 2021 02:47
(address . guix-patches@gnu.org)
20210206014748.5b281d65@runbox.com
Toggle diff (14 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 4fbb157600..057644a576 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -1939,7 +1939,8 @@ using the Enchant spell-checking library.")
"--webengine-printing-and-pdf=no"
"--webengine-ffmpeg=system"
"--webengine-icu=system"
- "--webengine-pepper-plugins=no")))))
+ "--webengine-pepper-plugins=no"
+ "-webengine-proprietary-codecs")))))
;; Tests are disabled due to "Could not find QtWebEngineProcess
error" ;; It's possible this can be fixed by setting
QTWEBENGINEPROCESS_PATH ;; before running tests.
T
T
Tobias Geerinckx-Rice wrote on 6 Feb 2021 11:10
(name . pkill9)(address . pkill9@runbox.com)
87a6shy0af.fsf@nckx
Pkill,

pkill9 ???
Toggle quote (2 lines)
> A patch to enable building proprietary codecs in qtwebengine

LGTM, but please send a proper (‘git format-patch’-format) patch
that can be applied with ‘git am’ with a standardised commit
message. See ‘info (guix)Submitting Patches’ and the git log.

Toggle quote (3 lines)
> + "--webengine-pepper-plugins=no"
> + "-webengine-proprietary-codecs")))))

The indentation's off here. Guix Scheme code uses spaces
everywhere.

Thanks!

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYB5rCA0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15Mc0A/0bCX46gBpeI0Odc+16ficUZrqO9dbg28mZ8wUqa
PQ0bAQDt74DwtF6/wiWiIdV2xAuOITEzwcTW7YhN859Cn1LaAg==
=QkY6
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 6 Feb 2021 14:05
87pn1dwdmo.fsf@nckx
Tobias Geerinckx-Rice via Guix-patches via ???
Toggle quote (2 lines)
> + "-webengine-proprietary-codecs")))))

Addendum: add a comment explicitly noting that these are all free
software, or we might face ‘misunderstandings’ later.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYB6UAA0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15g0MA/2a9UoLQ8rtLwSNMeVXS0UF/MoiN+uzIB74vqTdz
3dUhAQDzBBSyLEtCHTygiRI687N9IHzEYiOQaElxJqxADjFLDQ==
=Nim6
-----END PGP SIGNATURE-----

L
L
Leo Famulari wrote on 7 Feb 2021 19:12
(name . pkill9)(address . pkill9@runbox.com)(address . 46337@debbugs.gnu.org)
YCAtfGuZDUrjAHwx@jasmine.lan
On Sat, Feb 06, 2021 at 01:47:48AM +0000, pkill9 wrote:
Toggle quote (12 lines)
> diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
> index 4fbb157600..057644a576 100644
> --- a/gnu/packages/qt.scm
> +++ b/gnu/packages/qt.scm
> @@ -1939,7 +1939,8 @@ using the Enchant spell-checking library.")
> "--webengine-printing-and-pdf=no"
> "--webengine-ffmpeg=system"
> "--webengine-icu=system"
> - "--webengine-pepper-plugins=no")))))
> + "--webengine-pepper-plugins=no"
> + "-webengine-proprietary-codecs")))))

Thanks! I tried building with this flag on a powerful computer, but the
build failed because it couldn't find the dependency openh264. That is
packaged, so we just need an updated patch.
P
P
pkill9 wrote on 8 Feb 2021 16:40
(name . Leo Famulari)(address . leo@famulari.name)(address . 46337@debbugs.gnu.org)
20210208154043.65635e9c@runbox.com
Toggle quote (4 lines)
> Thanks! I tried building with this flag on a powerful computer, but
> the build failed because it couldn't find the dependency openh264.
> That is packaged, so we just need an updated patch.

I've attached an updated patch with the 'openh264' package added to
inputs. Also changed the flag so it's indented using spaces instead of
tabs, which is why it wasn't aligned previously.
From dc0945c1720c74f0a071a8b28b0220e91890ec5c Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
Date: Mon, 8 Feb 2021 15:37:54 +0000
Subject: [PATCH] gnu/packages/qt.scm: Enable proprietary codecs support (h264)
in qtwebengine

---
gnu/packages/qt.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 4fbb157600..cb4699387d 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -1881,6 +1881,7 @@ using the Enchant spell-checking library.")
("mesa" ,mesa)
("minizip" ,minizip)
("nss" ,nss)
+ ("openh264" ,openh264)
("opus" ,opus)
("pciutils" ,pciutils)
("protobuf" ,protobuf)
@@ -1939,7 +1940,8 @@ using the Enchant spell-checking library.")
"--webengine-printing-and-pdf=no"
"--webengine-ffmpeg=system"
"--webengine-icu=system"
- "--webengine-pepper-plugins=no")))))
+ "--webengine-pepper-plugins=no"
+ "-webengine-proprietary-codecs")))))
;; Tests are disabled due to "Could not find QtWebEngineProcess error"
;; It's possible this can be fixed by setting QTWEBENGINEPROCESS_PATH
;; before running tests.
--
2.30.0
L
L
Leo Famulari wrote on 8 Feb 2021 17:36
(name . pkill9)(address . pkill9@runbox.com)(address . 46337@debbugs.gnu.org)
YCFomN/8j2N1JoFV@jasmine.lan
On Mon, Feb 08, 2021 at 03:40:43PM +0000, pkill9 wrote:
Toggle quote (6 lines)
> From dc0945c1720c74f0a071a8b28b0220e91890ec5c Mon Sep 17 00:00:00 2001
> From: Pkill -9 <pkill9@runbox.com>
> Date: Mon, 8 Feb 2021 15:37:54 +0000
> Subject: [PATCH] gnu/packages/qt.scm: Enable proprietary codecs support (h264)
> in qtwebengine

Thanks!

It fails like this:

------
[187/187] LINK gn
make[3]: Entering directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/buildtools'
make[3]: Nothing to be done for 'first'.
make[3]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/buildtools'
make[2]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/buildtools'
cd core/ && ( test -e Makefile || /tmp/guix-build-qtwebengine-5.15.2.drv-0/qmake -o Makefile /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core/core.pro 'QT_B
make[2]: Entering directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
( test -e Makefile.core_headers || /tmp/guix-build-qtwebengine-5.15.2.drv-0/qmake -o Makefile.core_headers /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core/
make[3]: Entering directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
make[3]: Nothing to be done for 'first'.
make[3]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
( test -e Makefile.core_generator || /tmp/guix-build-qtwebengine-5.15.2.drv-0/qmake -o Makefile.core_generator /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/c
make[3]: Entering directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
make[3]: Nothing to be done for 'first'.
make[3]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
( test -e Makefile.gn_run || /tmp/guix-build-qtwebengine-5.15.2.drv-0/qmake -o Makefile.gn_run /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core/gn_run.pro '
Project MESSAGE: Running: /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/3rdparty/gn/out/Release/gn gen /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-ev
Done. Made 12488 targets from 1973 files in 5046ms
make[3]: Entering directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
ninja -k1 -j16 -C /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core/release QtWebEngineCore
ninja: Entering directory `/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core/release'
ninja: error: '../../3rdparty/chromium/third_party/openh264/src/codec/encoder/core/src/au_set.cpp', needed by 'obj/third_party/openh264/bundled_encoder/au_set.o', missing and no known rule tot
make[3]: *** [Makefile.gn_run:354: run_ninja] Error 1
make[3]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
make[2]: *** [Makefile:82: sub-gn_run-pro-make_first] Error 2
make[2]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src/core'
make[1]: *** [Makefile:80: sub-core-make_first] Error 2
make[1]: Leaving directory '/tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/src'
make: *** [Makefile:49: sub-src-make_first] Error 2
command "make" "-j" "16" failed with status 2
builder for `/gnu/store/50f3xngwq0n1vnfxslyhxpqd0yswdxss-qtwebengine-5.15.2.drv' failed with exit code 1
@ build-failed /gnu/store/50f3xngwq0n1vnfxslyhxpqd0yswdxss-qtwebengine-5.15.2.drv - 1 builder for `/gnu/store/50f3xngwq0n1vnfxslyhxpqd0yswdxss-qtwebengine-5.15.2.drv' failed with exit code 1
derivation '/gnu/store/50f3xngwq0n1vnfxslyhxpqd0yswdxss-qtwebengine-5.15.2.drv' offloaded to '141.80.167.174' failed: build of `/gnu/store/50f3xngwq0n1vnfxslyhxpqd0yswdxss-qtwebengine-5.15.2.d
build of /gnu/store/50f3xngwq0n1vnfxslyhxpqd0yswdxss-qtwebengine-5.15.2.drv failed
------
P
P
pkill9 wrote on 8 Feb 2021 23:53
(name . Leo Famulari)(address . leo@famulari.name)(address . 46337@debbugs.gnu.org)
20210208225307.456a3fd7@runbox.com
Toggle quote (4 lines)
> Thanks!
>
> It fails like this:

Thanks for testing, I've attached another patch that adds the configure
flag "--system-openh264" based on the examples given under
"Third Party Libraries" on this page
From 8cc8c39e7d765c6213e3fbbf679f1edda2b2c76d Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
Date: Mon, 8 Feb 2021 22:24:13 +0000
Subject: [PATCH] gnu/packages/qt.scm: Enable proprietary codecs support (h264)
in qtwebengine

---
gnu/packages/qt.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (25 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 4fbb157600..ceb5842755 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -1881,6 +1881,7 @@ using the Enchant spell-checking library.")
("mesa" ,mesa)
("minizip" ,minizip)
("nss" ,nss)
+ ("openh264" ,openh264)
("opus" ,opus)
("pciutils" ,pciutils)
("protobuf" ,protobuf)
@@ -1939,7 +1940,9 @@ using the Enchant spell-checking library.")
"--webengine-printing-and-pdf=no"
"--webengine-ffmpeg=system"
"--webengine-icu=system"
- "--webengine-pepper-plugins=no")))))
+ "--webengine-pepper-plugins=no"
+ "-webengine-proprietary-codecs"
+ "--system-openh264")))))
;; Tests are disabled due to "Could not find QtWebEngineProcess error"
;; It's possible this can be fixed by setting QTWEBENGINEPROCESS_PATH
;; before running tests.
--
2.30.0
P
P
pkill9 wrote on 9 Feb 2021 00:44
(name . Leo Famulari)(address . leo@famulari.name)(address . 46337@debbugs.gnu.org)
20210208234442.00967d36@runbox.com
I accidentally used two dashes instead of one, here is another patch
that fixes this.
From f6dde87ee7749727293ade2ef3f9a2fbaf0f7c1f Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
Date: Mon, 8 Feb 2021 22:24:13 +0000
Subject: [PATCH] gnu/packages/qt.scm: Enable proprietary codecs support (h264)
in qtwebengine

---
gnu/packages/qt.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (25 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 4fbb157600..431c597b8a 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -1881,6 +1881,7 @@ using the Enchant spell-checking library.")
("mesa" ,mesa)
("minizip" ,minizip)
("nss" ,nss)
+ ("openh264" ,openh264)
("opus" ,opus)
("pciutils" ,pciutils)
("protobuf" ,protobuf)
@@ -1939,7 +1940,9 @@ using the Enchant spell-checking library.")
"--webengine-printing-and-pdf=no"
"--webengine-ffmpeg=system"
"--webengine-icu=system"
- "--webengine-pepper-plugins=no")))))
+ "--webengine-pepper-plugins=no"
+ "-webengine-proprietary-codecs"
+ "-system-openh264")))))
;; Tests are disabled due to "Could not find QtWebEngineProcess error"
;; It's possible this can be fixed by setting QTWEBENGINEPROCESS_PATH
;; before running tests.
--
2.30.0
L
L
Leo Famulari wrote on 9 Feb 2021 22:17
(name . pkill9)(address . pkill9@runbox.com)(address . 46337@debbugs.gnu.org)
YCL741t8VnaSumeE@jasmine.lan
On Mon, Feb 08, 2021 at 11:44:42PM +0000, pkill9 wrote:
Toggle quote (9 lines)
> I accidentally used two dashes instead of one, here is another patch
> that fixes this.

> From f6dde87ee7749727293ade2ef3f9a2fbaf0f7c1f Mon Sep 17 00:00:00 2001
> From: Pkill -9 <pkill9@runbox.com>
> Date: Mon, 8 Feb 2021 22:24:13 +0000
> Subject: [PATCH] gnu/packages/qt.scm: Enable proprietary codecs support (h264)
> in qtwebengine

It fails like this:

------
starting phase `configure'
Info: creating stash file /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/.qmake.stash
Info: creating cache file /tmp/guix-build-qtwebengine-5.15.2.drv-0/qtwebengine-everywhere-src-5.15.2/.qmake.cache
ERROR: Unknown command line option '-system-openh264'.
command "qmake" "QT_BUILD_PARTS = libs tools" "--" "--webengine-printing-and-pdf=no" "--webengine-ffmpeg=system" "--webengine-icu=system" "--webengine-pepper-plugins=no" "-webengine-proprietary-codecs" "-system-openh264" failed with status 3
------

I know that I said we could test the patch on the build farm, because
this packages requires a lot of resources to build. However, can you at
least make sure that the configure phase succeeds on your end?
S
S
Sergey Trofimov wrote on 30 May 2021 19:54
Attempt to fix the build
(address . 46337@debbugs.gnu.org)
878s3w5cpz.fsf@sarg.org.ru
Hey there, it seems that qtwebengine build script just lacks the
`-system-openh264` flag.
In attempt to fix that I just slap the needed GN arg to the end of
`src/buildtools/config/linux.pri`
I've checked that the configure phase succeeds, but the full build
takes too long on my machine.

Please find attached the proposed patch.
From 553a37f4af401f2a53575c0f2d77cb5030344f40 Mon Sep 17 00:00:00 2001
From: Sergey Trofimov <sarg@sarg.org.ru>
Date: Sun, 30 May 2021 14:39:15 +0200
Subject: [PATCH] qtwebengine with openh264

---
gnu/packages/qt.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

Toggle diff (54 lines)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 55855fb68a..6bb1281570 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -1547,6 +1547,7 @@ using the Enchant spell-checking library.")
"third_party/modp_b64"
"third_party/nasm"
"third_party/one_euro_filter"
+ "third_party/openh264/src/codec/api/svc"
"third_party/opus"
"third_party/ots"
"third_party/pdfium"
@@ -1724,6 +1725,7 @@ using the Enchant spell-checking library.")
;; libxml2 configure summary still states "Checking for compatible
;; system libxml2... no"
("libxml2" ,libxml2)
+ ("openh264" ,openh264)
("libxrandr" ,libxrandr)
("libxrender" ,libxrender)
("libxslt" ,libxslt)
@@ -1747,6 +1749,10 @@ using the Enchant spell-checking library.")
("xcb-util" ,xcb-util)))
(arguments
(substitute-keyword-arguments (package-arguments qtsvg)
+ ((#:modules modules '())
+ `((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 textual-ports)))
((#:phases phases)
`(modify-phases ,phases
(add-before 'configure 'substitute-source
@@ -1754,6 +1760,10 @@ using the Enchant spell-checking library.")
(let ((out (assoc-ref outputs "out"))
(nss (assoc-ref inputs "nss"))
(udev (assoc-ref inputs "udev")))
+ (with-atomic-file-replacement "src/buildtools/config/linux.pri"
+ (lambda (in out)
+ (display (get-string-all in) out)
+ (display "\ngn_args += use_system_openh264=true\n" out)))
;; Qtwebengine is not installed into the same prefix as
;; qtbase. Some qtbase QTLibraryInfo constants will not
;; work. Replace with the full path to the qtwebengine
@@ -1789,7 +1799,8 @@ using the Enchant spell-checking library.")
"--webengine-printing-and-pdf=no"
"--webengine-ffmpeg=system"
"--webengine-icu=system"
- "--webengine-pepper-plugins=no")))))
+ "--webengine-pepper-plugins=no"
+ "-webengine-proprietary-codecs")))))
;; Tests are disabled due to "Could not find QtWebEngineProcess error"
;; It's possible this can be fixed by setting QTWEBENGINEPROCESS_PATH
;; before running tests.
--
2.31.1
S
S
Sergey Trofimov wrote on 30 May 2021 20:47
Clarification for the previous patch
(address . 46337@debbugs.gnu.org)
875yz05a9i.fsf@sarg.org.ru
Hey there. Just to clarify why and how this patch works:
When `-webengine-proprietary-codecs` flag is added `rtc_use_h264`
gn arg would be enabled. [1]
This flag under the hood adds dependency on openh264 (to encode
webrtc streams). [2]

Now to make the build accept system library we have to jump
through some hoops:
- List of config flags [3] which qtwebengine supports misses
webengine-system-openh264
- Chromium on the other hand supports linking with system library.
[4]
- To pass the required GN arg I blatantly slap it in linux.pri to
gn_args

[1]
[2]
[3]
[4]
S
S
Sergey Trofimov wrote on 30 May 2021 22:00
Update
(address . 46337@debbugs.gnu.org)
8735u456w3.fsf@sarg.org.ru
Just a quick update. I built qtwebengine with this patch on my
machine and checked that qutebrowser now plays h.264 videos.
L
L
Leo Famulari wrote on 7 Jun 2021 23:01
Re: [bug#46337] Attempt to fix the build
(name . Sergey Trofimov)(address . sarg@sarg.org.ru)(address . 46337-done@debbugs.gnu.org)
YL6JEuNVGWQfBcKx@jasmine.lan
On Sun, May 30, 2021 at 07:54:33PM +0200, Sergey Trofimov wrote:
Toggle quote (16 lines)
>
> Hey there, it seems that qtwebengine build script just lacks the
> `-system-openh264` flag.
> In attempt to fix that I just slap the needed GN arg to the end of
> `src/buildtools/config/linux.pri`
> I've checked that the configure phase succeeds, but the full build takes too
> long on my machine.
>
> Please find attached the proposed patch.
>

> From 553a37f4af401f2a53575c0f2d77cb5030344f40 Mon Sep 17 00:00:00 2001
> From: Sergey Trofimov <sarg@sarg.org.ru>
> Date: Sun, 30 May 2021 14:39:15 +0200
> Subject: [PATCH] qtwebengine with openh264

Thanks! I wrote a commit message and pushed as
68dcdf6ea76cddc4f9e53aabe7c1a5724d5508b2
Closed
?