Skip to contentSkip to conversation

qt5multimedia: fix plugins videonode egl x11 header related compile failure

PATCH New Peter Seiderer 2 participants 8 messages Jun 26, 2017 – Jul 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Add MESA_EGL_NO_X11_HEADERS define (as other egl projects do via QT_EGL_NO_X11).

Fixes [1]:

In file included from .../host/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/EGL/egl.h:39:0,
from qsgvideonode_egl.h:48,
from qsgvideonode_egl.cpp:40:
.../host/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/EGL/eglplatform.h:119:22: fatal error: X11/Xlib.h: No such file or directory

   #include <X11/Xlib.h>
                      ^

compilation terminated.
make[5]: Leaving directory `.../build/qt5multimedia-5.8.0/src/plugins/videonode/egl'

[1] http://autobuild.buildroot.net/results/364/364a76bbf90251f9cae2abd3ef2e382758eae538

---
 ...eonode-egl-fix-x11-header-related-compile.patch | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 package/qt5/qt5multimedia/5.8.0/0001-plugins-videonode-egl-fix-x11-header-related-compile.patch
package/qt5/qt5multimedia/5.8.0/0001-plugins-videonode-egl-fix-x11-header-related-compile.patch new file +30 -0
new file mode 100644
index 0000000000..bbf2a94f6d
@@ -0,0 +1,30 @@
+From 72e04823b49bb8ec5f126a172521c16f3281282d Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+Date: Mon, 26 Jun 2017 23:01:32 +0200
+Subject: [PATCH] plugins/videonode/egl: fix x11 header related compile failure
+
+Add MESA_EGL_NO_X11_HEADERS define (as other egl projects do via
+QT_EGL_NO_X11).
+
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ src/plugins/videonode/egl/egl.pro | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/plugins/videonode/egl/egl.pro b/src/plugins/videonode/egl/egl.pro
+index 7151123..08ec149 100644
+--- a/src/plugins/videonode/egl/egl.pro
++++ b/src/plugins/videonode/egl/egl.pro
+@@ -3,6 +3,9 @@ TARGET = eglvideonode
+ QT += multimedia-private qtmultimediaquicktools-private
+ CONFIG += egl
+ 
++# Avoid X11 header collision, use generic EGL native types
++DEFINES += MESA_EGL_NO_X11_HEADERS
++
+ HEADERS += \
+     qsgvideonode_egl.h
+ 
+-- 
+2.11.0
+
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Hello,

package/qt5/qt5multimedia/5.8.0/0001-plugins-videonode-egl-fix-x11-header-related-compile.patch line 24

Quoted 11 lines · Peter Seiderer
package/qt5/qt5multimedia/5.8.0/0001-plugins-videonode-egl-fix-x11-header-related-compile.patch new file +11 -0
+diff --git a/src/plugins/videonode/egl/egl.pro b/src/plugins/videonode/egl/egl.pro
+index 7151123..08ec149 100644
+--- a/src/plugins/videonode/egl/egl.pro
++++ b/src/plugins/videonode/egl/egl.pro
+@@ -3,6 +3,9 @@ TARGET = eglvideonode
+ QT += multimedia-private qtmultimediaquicktools-private
+ CONFIG += egl
+ 
++# Avoid X11 header collision, use generic EGL native types
++DEFINES += MESA_EGL_NO_X11_HEADERS
++

I am not really convinced by this patch. Indeed, I believe it should be the OpenGL providers that define this constant when needed. If you look at the config that generated the build failure you're trying to fix
(http://autobuild.buildroot.net/results/364/364a76bbf90251f9cae2abd3ef2e382758eae538),
you'll see that the OpenGL provider used is mali-t76x. However, package/mali-t76x/glesv2.pc contains:

Cflags: -I${includedir} -DMESA_EGL_NO_X11_HEADERS

So, I would expect that Qt5 should not need to redefine it again. Obviously, what worries me is that fixing Qt5 will fix just Qt5, and not any other package using the same OpenGL provider.

What do you think?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Hello Thomas,

Quoted 23 lines · Thomas Petazzoni

Hello,

package/qt5/qt5multimedia/5.8.0/0001-plugins-videonode-egl-fix-x11-header-related-compile.patch line 24

Quoted 11 lines · Peter Seiderer
package/qt5/qt5multimedia/5.8.0/0001-plugins-videonode-egl-fix-x11-header-related-compile.patch new file +11 -0
+diff --git a/src/plugins/videonode/egl/egl.pro b/src/plugins/videonode/egl/egl.pro
+index 7151123..08ec149 100644
+--- a/src/plugins/videonode/egl/egl.pro
++++ b/src/plugins/videonode/egl/egl.pro
+@@ -3,6 +3,9 @@ TARGET = eglvideonode
+ QT += multimedia-private qtmultimediaquicktools-private
+ CONFIG += egl
+ 
++# Avoid X11 header collision, use generic EGL native types
++DEFINES += MESA_EGL_NO_X11_HEADERS
++

I am not really convinced by this patch. Indeed, I believe it should be the OpenGL providers that define this constant when needed. If you look at the config that generated the build failure you're trying to fix
(http://autobuild.buildroot.net/results/364/364a76bbf90251f9cae2abd3ef2e382758eae538),
you'll see that the OpenGL provider used is mali-t76x. However, package/mali-t76x/glesv2.pc contains:

Quoted 7 lines

Cflags: -I${includedir} -DMESA_EGL_NO_X11_HEADERS

So, I would expect that Qt5 should not need to redefine it again. Obviously, what worries me is that fixing Qt5 will fix just Qt5, and not any other package using the same OpenGL provider.

What do you think?

Same fixing pattern as for qt5base (and for qtbase accepted upstream, see e.g. [1]), but in general your are right, honor the given provider provided flags would be the better solution...maybe something as suggested on the yocto meta-freescale mailing list will work, see [2], [3]: 'egl.prf: Fix build error when egl headers need platform definition'?

Did not yet had time to try the suggested patch (the first references says 'Upstream-Status: Pending' but without reference)...

Regards,
Peter

[1] https://codereview.qt-project.org/#/c/188158/
[2] https://lists.yoctoproject.org/pipermail/meta-freescale/2017-June/020654.html
[3] https://lists.yoctoproject.org/pipermail/meta-freescale/2017-June/020653.html

Quoted 2 lines

Thomas

#3 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Hello,

Quoted 1 line · Peter Seiderer

Same fixing pattern as for qt5base (and for qtbase accepted upstream, see e.g. [1]),

Well, [1] is about adding QT_EGL_NO_X11, which is a QT definition. It is very different from MESA_EGL_NO_X11_HEADERS, which is an OpenGL-level definition.

Quoted 4 lines

but in general your are right, honor the given provider provided flags would be the better solution...maybe something as suggested on the yocto meta-freescale mailing list will work, see [2], [3]: 'egl.prf: Fix build error when egl headers need platform definition'?

I'm not sure I fully understand those patches, but apparently they use more pkg-config flags from OpenGL, which is exactly the approach I suggest to investigate indeed.

BTW, the same thing should be done for Qt instead of package/qt/0012-OpenGL-EGL-Avoid-X11-header-collision.patch.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Hello Thomas,

Quoted 9 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Peter Seiderer

Same fixing pattern as for qt5base (and for qtbase accepted upstream, see e.g. [1]),

Well, [1] is about adding QT_EGL_NO_X11, which is a QT definition. It is very different from MESA_EGL_NO_X11_HEADERS, which is an OpenGL-level definition.

The missing link is in file src/platformsupport/eglconvenience/qt_egl_p.h line 54ff:

54 #ifdef QT_EGL_NO_X11
55 # define MESA_EGL_NO_X11_HEADERS // MESA
56 # define WIN_INTERFACE_CUSTOM // NV
57 #endif // QT_EGL_NO_X11
58
59 #ifdef QT_EGL_WAYLAND
60 # define WAYLAND // NV
61 #endif // QT_EGL_WAYLAND
62
63 #include <EGL/egl.h>
64 #include <EGL/eglext.h>

QT_EGL_NO_X11 forces MESA_EGL_NO_X11_HEADERS before the egl headers are included...

Quoted 6 lines
Quoted 5 lines

but in general your are right, honor the given provider provided flags would be the better solution...maybe something as suggested on the yocto meta-freescale mailing list will work, see [2], [3]: 'egl.prf: Fix build error when egl headers need platform definition'?

Quoted 6 lines

I'm not sure I fully understand those patches, but apparently they use more pkg-config flags from OpenGL, which is exactly the approach I suggest to investigate indeed.

BTW, the same thing should be done for Qt instead of package/qt/0012-OpenGL-EGL-Avoid-X11-header-collision.patch.

Will test the patch(es) the next days...

Regards,
Peter

Quoted 4 lines

Best regards,

Thomas

#5 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Hello,

Quoted 26 lines · Peter Seiderer
Quoted 9 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Peter Seiderer

Same fixing pattern as for qt5base (and for qtbase accepted upstream, see e.g. [1]),

Well, [1] is about adding QT_EGL_NO_X11, which is a QT definition. It is very different from MESA_EGL_NO_X11_HEADERS, which is an OpenGL-level definition.

The missing link is in file src/platformsupport/eglconvenience/qt_egl_p.h line 54ff:

54 #ifdef QT_EGL_NO_X11
55 # define MESA_EGL_NO_X11_HEADERS // MESA
56 # define WIN_INTERFACE_CUSTOM // NV
57 #endif // QT_EGL_NO_X11
58
59 #ifdef QT_EGL_WAYLAND
60 # define WAYLAND // NV
61 #endif // QT_EGL_WAYLAND
62
63 #include <EGL/egl.h>
64 #include <EGL/eglext.h>

Quoted 1 line

QT_EGL_NO_X11 forces MESA_EGL_NO_X11_HEADERS before the egl headers are included...

Ah, okay, indeed. But still, I really think it should be the responsibility of the OpenGL provider to define MESA_EGL_NO_X11_HEADERS in its .pc files, rather than having this logic duplicated in all packages "consuming" the OpenGL API.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

In reply to Thomas Petazzoni

Hello Thomas,

Quoted 14 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Peter Seiderer

Same fixing pattern as for qt5base (and for qtbase accepted upstream, see e.g. [1]),

Well, [1] is about adding QT_EGL_NO_X11, which is a QT definition. It is very different from MESA_EGL_NO_X11_HEADERS, which is an OpenGL-level definition.

Quoted 4 lines

but in general your are right, honor the given provider provided flags would be the better solution...maybe something as suggested on the yocto meta-freescale mailing list will work, see [2], [3]: 'egl.prf: Fix build error when egl headers need platform definition'?

And two links to the upstream suggestion/discussion:

- QTBUG-61712: qtbase: A build error was occurring due to missing EGL configuration
https://bugreports.qt.io/browse/QTBUG-61712

- Patch: qtbase: Fix build error when using EGL
https://codereview.qt-project.org/#/c/198906/

Regards,
Peter

Quoted 11 lines

I'm not sure I fully understand those patches, but apparently they use more pkg-config flags from OpenGL, which is exactly the approach I suggest to investigate indeed.

BTW, the same thing should be done for Qt instead of package/qt/0012-OpenGL-EGL-Avoid-X11-header-collision.patch.

Best regards,

Thomas

#7 lore raw

PATCH 1/1 qt5multimedia: fix plugins videonode egl x11 header related compile failure

Hello,

Quoted 5 lines · Peter Seiderer
Quoted 4 lines
Quoted 4 lines

but in general your are right, honor the given provider provided flags would be the better solution...maybe something as suggested on the yocto meta-freescale mailing list will work, see [2], [3]: 'egl.prf: Fix build error when egl headers need platform definition'?

Quoted 7 lines

And two links to the upstream suggestion/discussion:

- QTBUG-61712: qtbase: A build error was occurring due to missing EGL configuration
https://bugreports.qt.io/browse/QTBUG-61712

- Patch: qtbase: Fix build error when using EGL
https://codereview.qt-project.org/#/c/198906/

I'm not used to the Qt contribution workflow, but the patch visible through those links looks good (use CFLAGS provided by the EGL .pc file), and the reception seems positive (+6 votes on the code review tool).

So it all seems to be going in the right direction, no?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com