Skip to contentSkip to conversation

Fix to Qt5base-build

Buildroot New Espen Frimann Koren 4 participants 6 messages Sep 17, 2013 – Sep 18, 2013

lore
Share & tools
lore
#0 lore raw

Hi.

I have found a solution to why Qt5 does not find either OpenGL ES2 or EGL during configuration.

In the file package/qt5/qt5base/qt5base-mkspecs-files.patch, two files are created in output/build/qt5base-5.0.2/mkspecs/devices/linux-buildroot-g++. In my opinion the following lines must be included in the file (from the patch):

QMAKE_LIBS_EGL += -lEGL
QMAKE_LIBS_OPENGL_ES2 += -lEGL -lGAL

QMAKE_CFLAGS           += -DEGL_API_FB=1
QMAKE_CXXFLAGS         += -DEGL_API_FB=1
QMAKE_CFLAGS_DEBUG     += -DEGL_API_FB=1
QMAKE_CXXFLAGS_DEBUG   += -DEGL_API_FB=1

I cannot commit to the buildroot tree, so someone have to do this. There are other issues in the corresponding file in output/build/qt5base-5.0.2/mkspecs/devices/linux-imx6-g++/qmake.conf, which is provided by Qt themselves, that may need to be taken into consideration, for instance

EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_imx6.cpp

Maybe there should be possible to select Qt device mkspec in the make menuconfig-system?

Sp1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130917/c46171b6/attachment.html>

#1 lore raw

PATCH 1/1 Fix EGL support in qt5base

For many EGL libraries, Qt5 need special instructions to compile correctly. This patch implement a more generic way to customize Qt5 compilation.

In add, it fix support for Rasberry Pi and Vivante GPUs.

---

You may try this patch. I have not yet added/tested support for Omap and Mali, but it should work imx6.

 ...nce-add-egl-to-CONFIG-to-get-correct-incl.patch |   32 --------------------
 package/qt5/qt5base/qt5base-mkspecs-files.patch    |    2 +-
 package/qt5/qt5base/qt5base.mk                     |   29 +++++++++++++++---
 3 files changed, 26 insertions(+), 37 deletions(-)
 delete mode 100644 package/qt5/qt5base/qt5base-eglconvenience-add-egl-to-CONFIG-to-get-correct-incl.patch
package/qt5/qt5base/qt5base-eglconvenience-add-egl-to-CONFIG-to-get-correct-incl.patch deleted +0 -32
deleted file mode 100644
index a85a5aa..0000000
@@ -1,32 +0,0 @@
-From 588c60d0c3d11e79d19860fa62b03c935658d13a Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <[email protected]>
-Date: Sun, 13 Jan 2013 14:36:48 +0100
-Subject: [PATCH qtbase] eglconvenience: add egl to CONFIG to get correct include
- paths
-
-The eglconvenience code includes <EGL/egl.h>. Therefore, it should get
-the appropriate EGL-specific include paths from QMAKE_INCDIR_EGL,
-otherwise the build might if the EGL library has its headers in
-special locations. In order to achieve this, we simply add the "egl"
-feature to the list of features imported by eglconvenience.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
----
- .../eglconvenience/eglconvenience.pri              |    1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri
-index 188eb1c..8996cea 100644
---- a/src/platformsupport/eglconvenience/eglconvenience.pri
-+++ b/src/platformsupport/eglconvenience/eglconvenience.pri
-@@ -5,6 +5,7 @@ contains(QT_CONFIG,egl) {
-     SOURCES += \
-         $$PWD/qeglconvenience.cpp \
-         $$PWD/qeglplatformcontext.cpp
-+    CONFIG += egl
- 
-     contains(QT_CONFIG,xlib) {
-         HEADERS += \
--- 
-1.7.9.5
-
package/qt5/qt5base/qt5base-mkspecs-files.patch +1 -1
index bfa9c15..2669c2c 100644
@@ -52,7 +52,7 @@ Index: b/mkspecs/devices/linux-buildroot-g++/qmake.conf
 +QMAKE_LIBS             += -lrt -lpthread -ldl
 +
 +# device specific glue code
-+EGLFS_PLATFORM_HOOKS_SOURCES =
++include(qmake-extra-conf.conf)
 +
 +# Sanity check
 +deviceSanityCheckCompiler()
package/qt5/qt5base/qt5base.mk +25 -4
index 1686dad..41d7dfa 100644
@@ -99,8 +99,30 @@ ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y)
 QT5BASE_CONFIGURE_OPTS += -opengl es2 -eglfs
 QT5BASE_DEPENDENCIES   += libgles libegl
 ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
-QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
-	$(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
+define QT5BASE_EXTRA_OPTIONS
+EGLFS_PLATFORM_HOOKS_SOURCES = \
+	$(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp  \n\
+INCLUDEPATH += \
+	$(STAGING_DIR)/usr/include/interface/vcos/pthreads          \n
+endef
+else ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q)x$(BR2_PACKAGE_XORG7),yx)
+define QT5BASE_EXTRA_OPTIONS
+EGLFS_PLATFORM_HOOKS_SOURCES = \
+	$(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp   \n\
+QMAKE_CFLAGS += -DEGL_API_FB=1                                      \n\
+QMAKE_CXXFLAGS += -DEGL_API_FB=1                                    \n\
+QMAKE_LIBS_OPENGL_ES2 += -lEGL -lGAL                                \n\
+QMAKE_LIBS_OPENVG += -lEGL -lGAL                                    \n
+endef
+else ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q)x$(BR2_PACKAGE_XORG7),yxy)
+error("GPU_VIV_BIN_MX6Q + XORG7 + qt5 w/ eglfs is known to be broken.")
+define QT5BASE_EXTRA_OPTIONS
+# Notice this configuration is broken since eglvivante.h include    \n\
+# Xlib.h and Xlib.h defines tons of macros which conflict with Qt5  \n\
+# compilation                                                       \n\
+QMAKE_LIBS_OPENGL_ES2 += -lEGL -lGAL                                \n\
+QMAKE_LIBS_OPENVG += -lEGL -lGAL                                    \n
+endef
 endif
 else
 QT5BASE_CONFIGURE_OPTS += -no-opengl -no-eglfs
@@ -154,8 +176,7 @@ define QT5BASE_CONFIGURE_CMDS
 	$(call QT5BASE_CONFIG_SET,BUILDROOT_COMPILER_CFLAGS,$(TARGET_CFLAGS))
 	$(call QT5BASE_CONFIG_SET,BUILDROOT_COMPILER_CXXFLAGS,$(TARGET_CXXFLAGS))
 	$(call QT5BASE_CONFIG_SET,BUILDROOT_INCLUDE_PATH,$(STAGING_DIR)/usr/include)
-	$(call QT5BASE_CONFIG_SET,EGLFS_PLATFORM_HOOKS_SOURCES, \
-		$(QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES))
+	printf '$(QT5BASE_EXTRA_OPTIONS)' > $(@D)/mkspecs/devices/linux-buildroot-g++/qmake-extra-conf.conf
 	(cd $(@D); \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 		PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/1 Fix EGL support in qt5base

Hi,

package/qt5/qt5base/qt5base.mk ifeq ($(BR2_PACKAGE_QT5BASE_EGLFS),y) · line 115

Quoted 8 lines · J?r?me Pouiller
package/qt5/qt5base/qt5base.mk +8 -0
+else ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q)x$(BR2_PACKAGE_XORG7),yx)
+define QT5BASE_EXTRA_OPTIONS
+EGLFS_PLATFORM_HOOKS_SOURCES = \
+	$(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp   \n\
+QMAKE_CFLAGS += -DEGL_API_FB=1                                      \n\
+QMAKE_CXXFLAGS += -DEGL_API_FB=1                                    \n\
+QMAKE_LIBS_OPENGL_ES2 += -lEGL -lGAL                                \n\
+QMAKE_LIBS_OPENVG += -lEGL -lGAL                                    \n

Hardcoding device specific code in qt5base.mk is not nice; but it seems impossible to get rid of them since qt needs a platform hook path.

I have sent a patch to the list which adds .pc files to gpu-viv-bin-mx6q package. This helps qt5 to get needed flags; but for the platform hook .mk file still needs to be modified.

I have also sent a bug report[1] to qt developers for another file with hardcoded EGL flags.

[1] https://bugreports.qt-project.org/browse/QTBUG-33494

#3 lore raw

PATCH 1/1 Fix EGL support in qt5base

In reply to Jérôme Pouiller

Dear J?r?me Pouiller,

Quoted 6 lines · J?r?me Pouiller

For many EGL libraries, Qt5 need special instructions to compile correctly. This patch implement a more generic way to customize Qt5 compilation.

In add, it fix support for Rasberry Pi and Vivante GPUs.

I'm sorry, but this really looks ugly, and doesn't seem needed at all. We already have a working solution for this problem (which we already had for the RPi, and we solved in a much nicer way I believe) :

(1) The OpenGL implementation should install proper pkg-config files to allow Qt5 to get the right compilation flags/libraries. See the "gpu-viv-bin-mx6q: add pkgconfig files for EGL and OpenGLESv2" patch that Fatih has sent today.

(2) We already have a mechanism in qt5.mk to customize the EGL platform hook implementation. It just need to be extended to cover the i.MX6 case. I.e, next to:

ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)

QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
        $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp

endif

one should add:

ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q),y)

QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
	$(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp

endif

If someone makes a patch with both of these changes, then it'll have my Acked-by.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/1 Fix EGL support in qt5base

Quoted 8 lines · Thomas Petazzoni

Dear J?r?me Pouiller,

Quoted 5 lines · J?r?me Pouiller

For many EGL libraries, Qt5 need special instructions to compile correctly.
This patch implement a more generic way to customize Qt5 compilation.

Quoted 5 lines
Quoted 3 lines

In add, it fix support for Rasberry Pi and Vivante GPUs.

I'm sorry, but this really looks ugly.

I agree :-)

In fact, I mainly wrote this patch as a work around for one of my imx6
compilations. I sent it only because Espen seemed to have same issue.

Quoted 9 lines

and doesn't seem needed at all.
We already have a working solution for this problem (which we already had for the RPi, and we solved in a much nicer way I believe) :

(1) The OpenGL implementation should install proper pkg-config files to allow Qt5 to get the right compilation flags/libraries. See
the
"gpu-viv-bin-mx6q: add pkgconfig files for EGL and OpenGLESv2" patch that Fatih has sent today.

100% agree

Quoted 8 lines

(2) We already have a mechanism in qt5.mk to customize the EGL platform hook implementation. It just need to be extended to
cover
the i.MX6 case. I.e, next to:

ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)

QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
        $(@D)/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
Quoted 8 lines

endif

one should add:

ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q),y)

QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
	$(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp

endif

My idea was QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES may not be sufficient
to support all future cases and we may have a more generic way to
customize qmake.conf. But I am agree, this case is not yet arrived.

Signature · 3 lines
J?r?me Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr
#5 lore raw

PATCH 1/1 Fix EGL support in qt5base

Dear J?r?me Pouiller,

Quoted 6 lines · J?r?me Pouiller
Quoted 1 line

I'm sorry, but this really looks ugly.

I agree :-)

In fact, I mainly wrote this patch as a work around for one of my imx6
compilations. I sent it only because Espen seemed to have same issue.

Ok, no problem :)

Quoted 9 lines
Quoted 4 lines

ifeq ($(BR2_PACKAGE_GPU_VIV_BIN_MX6Q),y)

QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES = \
	$(@D)/mkspecs/devices/linux-imx6-g++/qeglfshooks_imx6.cpp

endif

My idea was QT5BASE_EGLFS_PLATFORM_HOOKS_SOURCES may not be sufficient
to support all future cases and we may have a more generic way to
customize qmake.conf. But I am agree, this case is not yet arrived.

Of course, this might happen, but until that happens, let's not plan something in advance without having any idea of what will exactly happen :-)

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com