void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

qt5: ftbfs for armv6 and armv7

Open jnbr opened this issue 8 years ago • 19 comments

...
/builddir/qt-everywhere-src-5.10.1/qtbase/lib/libQt5Network.so: warning: EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_delete'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_send_ctrl_write'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_recv'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_platform_malloc'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_flush'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_begin'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `platform_memcpy'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_send_bulk'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_error_assist'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_send_ctrl_end'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `client_tls'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `platform_tls_get'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_iterate'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_end'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_get_type_size'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `rpc_send_ctrl_begin'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_platform_free'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_insert'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_lookup'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_term'
/usr/arm-linux-gnueabihf/opt/vc/lib/libGLESv2.so: undefined reference to `khrn_pointer_map_init'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:106: qmltime] Error 1
make[3]: Leaving directory '/builddir/qt-everywhere-src-5.10.1/qtdeclarative/tools/qmltime'
make[2]: *** [Makefile:230: sub-qmltime-make_first] Error 2
make[2]: Leaving directory '/builddir/qt-everywhere-src-5.10.1/qtdeclarative/tools'
make[1]: *** [Makefile:73: sub-tools-make_first] Error 2
make[1]: Leaving directory '/builddir/qt-everywhere-src-5.10.1/qtdeclarative'
make: *** [Makefile:361: module-qtdeclarative-make_first] Error 2
=> ERROR: qt5-5.10.1_9: do_build: 'make ${makejobs}' exited with 2
=> ERROR:   in do_build() at srcpkgs/qt5/template:378

jnbr avatar Jul 13 '18 21:07 jnbr

Those references are in /opt/vc/lib/libEGL.so (from rpi-userland). Could the linker be using /usr/lib/libEGL.so from the libEGL package which doesn’t have these Raspberry specifics?

newbluemoon avatar Jul 14 '18 06:07 newbluemoon

Also, I cannot run any Qt5 application on my Raspberry (armv7l-musl). It stops with

EGL Error : Could not create the egl surface: error = 0x3003

Running xbps-query -Rx qt5 yields

...
libEGL>=7.11_1
...
rpi-userland>=0.0.0.0.20150907_1

Symlinking /usr/lib/libEGL.so to /opt/vc/lib/libEGL.so doesn’t work. So I think when building Qt5 the linker uses the wrong libEGL? Maybe only either one of the libEGLs shoud be used? But I can’t find where rpi-userland is pulled in (in the qt5 template).

newbluemoon avatar Jul 14 '18 07:07 newbluemoon

I think the problem is hidden behind the question whether any / all armv[67]l devices are raspi or not. In theory qt5 should work with every arm device that is covered by .../mkspecs/common/linux_arm_device_post.conf. The dependency /opt/vc/lib/libEGL.so is probably due to SDL2-devel (used in qt5-gamepad). Also note the # FIXME: is this required? in the qt5 template.

Perhaps it's sufficient to just not explicitly define QMAKE_LIBS_OPENGL_ES2? I haven't tried because I have no device to test it on.

pullmoll avatar Jul 14 '18 17:07 pullmoll

whether any / all armv[67]l devices are raspi or not

I’ve been asking this myself, too. ;)

In my opinion OpenGL ES2 shouldn’t be removed/disabled but only the Mesa provided libs should be used, not the ones from rpi-userland.

With the mesa-vc4-dri driver and a modified xorg-server package which sets the options --enable-glamor --enable-dri2 --enable-dri3 --enable-glx for ARM devices “real” OpenGL (but if I remember correctly somewhat restriced) can be used with the rpi (verified that it’s working with glxgears).

So I think the libGLES2 from rpi-userland isn’t essential and non-rpi armv[67]l devices would benefit if it was left out.

Maybe there is a way not to pull in rpi-userland or prevent linking to /opt/vc/lib/libGLES2.so. If only Qt5 wouldn’t take ages to build to do some testing... ;)

newbluemoon avatar Jul 14 '18 19:07 newbluemoon

Could simply adding libGLES to makedepends do the trick, because /usr/lib is searched before /opt/vc/lib? (Didn’t check if it might already be pulled in, though.)

newbluemoon avatar Jul 14 '18 19:07 newbluemoon

libGLES isn’t pulled in. Added it, build is in progress...

newbluemoon avatar Jul 14 '18 20:07 newbluemoon

So far /builddir/qt-everywhere-src-5.10.1/qtdeclarative/tools/qmltime has been built.

newbluemoon avatar Jul 14 '18 20:07 newbluemoon

The build was successful, but it’s not working with the same error:

EGL Error : Could not create the egl surface: error = 0x3003

I think a problem is that both MesaLib-devel and rpi-userland-devel provide

/usr/lib/pkgconfig/egl.pc
/usr/lib/pkgconfig/glesv2.pc

so that there’s an unhealthy mixture between Mesa and rpi-userland. I’ll try to find a way to untangle them.

configure detects:

...
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ yes
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  EGL .................................... yes
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ yes
    OpenGL ES 3.2 ........................ yes
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... yes
  INTEGRITY HID .......................... no
  mtdev .................................. yes
  tslib .................................. yes
  xkbcommon-evdev ........................ yes
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... no
    EGLFS GBM ............................ yes
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... yes
    EGL on X11 ........................... no
  LinuxFB ................................ yes
  VNC .................................... yes
  Mir client ............................. no
  X11:
    Using system-provided XCB libraries .. yes
    EGL on X11 ........................... no
    Xinput2 .............................. yes
    XCB XKB .............................. yes
    XLib ................................. yes
    XCB render ........................... yes
    XCB GLX .............................. yes
    XCB Xlib ............................. yes
    Using system-provided xkbcommon ...... yes
    Native painting (experimental) ....... yes
...

newbluemoon avatar Jul 15 '18 06:07 newbluemoon

# FIXME: is this required?
echo "QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2" >> ${qmake_conf}

Might not be required, because configure reads -lEGL and -lGLESv2 from the .pc files.

When I put MesaLib-devel last in makedepends Mesa’s .pc files are used and configure detects

...
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ yes
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  EGL .................................... yes
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ yes
    OpenGL ES 3.2 ........................ yes
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... yes
  INTEGRITY HID .......................... no
  mtdev .................................. yes
  tslib .................................. yes
  xkbcommon-evdev ........................ yes
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... yes
    EGLFS GBM ............................ yes
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGL on X11 ........................... yes
  LinuxFB ................................ yes
  VNC .................................... yes
  Mir client ............................. no
  X11:
    Using system-provided XCB libraries .. yes
    EGL on X11 ........................... yes
    Xinput2 .............................. yes
    XCB XKB .............................. yes
    XLib ................................. yes
    XCB render ........................... yes
    XCB GLX .............................. yes
    XCB Xlib ............................. yes
    Using system-provided xkbcommon ...... yes
    Native painting (experimental) ....... yes
...

So no Raspberry Pi! I’ll report the outcome in about five hours. ;)

newbluemoon avatar Jul 15 '18 06:07 newbluemoon

Thanks to ccache the build was much faster this time. Had to remove the qtwayland-egl patch. Then everything went fine. And now Qt5 applications are working again on my Raspberry Pi! Will do some further testing.

I’ll try to figure out if it’s possible to use only libGLESv2 and libEGL from rpi-userland if someone might want to have this.

newbluemoon avatar Jul 15 '18 09:07 newbluemoon

@newbluemoon great idea to put MesaLib-devel last. I didn't even realize the *.pc files conflict with rpi-userland. Thanks for your time and testing.

pullmoll avatar Jul 15 '18 10:07 pullmoll

I didn't even realize the *.pc files conflict with rpi-userland.

Just found this while looking through configure.log to find the needle in the haystack. ;)

Also, I removed

# FIXME: is this required?
echo "QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2" >> ${qmake_conf}

and it doesn’t seem to have any effect (with my limited testing, though).

Programs tested so far:

  • speedcrunch / nomacs / qcas no problems so far
  • falkon Failed to load /usr/bin/libGLESv2.so: Error loading shared library /usr/bin/libGLESv2.so: No such file or directory /usr/bin/? No idea where this comes from, but when creating symlinks as a quick workaround it works. Also: WebEngine compiled with X11 support, however qpa backend is not xcb. This may fail. Cannot use the mouse in the browser window, but works in menu. Maybe qt5-webkit needs a rebuild? Edit: confused qt5-webengine with qt5-webkit
  • Fritzing Crashes with segmentation fault right after main window is up. No idea, but this might well be some other issue.
  • TBC...

For reference, here’s a diff with the modifications I made:

--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -5,7 +5,7 @@ revision=9
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="flex ruby gperf git python perl pkg-config protobuf re2c ninja"
-makedepends="libressl-devel libpng-devel MesaLib-devel libXrender-devel unixodbc-devel
+makedepends="libressl-devel libpng-devel libXrender-devel unixodbc-devel
  fontconfig-devel libXi-devel libXv-devel libXinerama-devel libXrandr-devel
  libXcursor-devel libXScrnSaver-devel dbus-devel glib-devel icu-devel
  cups-devel libjpeg-turbo-devel sqlite-devel alsa-lib-devel tiff-devel SDL2-devel
@@ -17,7 +17,7 @@ makedepends="libressl-devel libpng-devel MesaLib-devel libXrender-devel unixodbc
  mtdev-devel freetds-devel libmysqlclient-devel postgresql-libs-devel
  pulseaudio-devel libbluetooth-devel gst-plugins-base1-devel libxslt-devel
  opus-devel pciutils-devel nss-devel libcap-devel libinput-devel libproxy-devel
- libxcb-devel libxkbcommon-devel tslib-devel wayland-devel libwayland-egl"
+ libxcb-devel libxkbcommon-devel tslib-devel wayland-devel libwayland-egl libGLES MesaLib-devel"
 depends="qtchooser"
 replaces="qt5-doc<5.6.0 qt5-quick1<5.6.0 qt5-quick1-devel<5.6.0 qt5-webkit<5.6.0 qt5-webkit-devel<5.6.0
  qt5-enginio<5.7.1 qt5-enginio-devel<5.7.1 qt5-plugin-gtk<5.7.1"
@@ -152,8 +152,6 @@ _create_config() {
 	echo "QMAKE_LFLAGS = ${LDFLAGS}" >> ${qmake_conf}
 	echo "QMAKE_CFLAGS = ${CFLAGS}" >> ${qmake_conf}
 	echo "QMAKE_CXXFLAGS = ${CXXFLAGS}" >> ${qmake_conf}
-	# FIXME: is this required?
-	echo "QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2" >> ${qmake_conf}
 	echo >> ${qmake_conf}
 	case "$XBPS_TARGET_MACHINE" in
 		arm*)
@@ -256,11 +254,6 @@ do_configure() {
 			-e"/gn.file = gn.pro/,+3d"
 
 		case "$XBPS_TARGET_MACHINE" in
-		armv5*)	# Patch not needed for armv5*
-			;;
-		arm*)	# Patch for qtwayland using egl from rpi-userland
-			patch -p0 -i ${FILESDIR}/qtwayland-egl.patch
-			;;
 		mips*)	# sgidefs.h is in /usr/include/asm
 			find ${wrksrc} -name Platform.h  -exec sed -i "{}" \
 				-e "s;<sgidefs.h>;<asm/sgidefs.h>;" \;

newbluemoon avatar Jul 15 '18 14:07 newbluemoon

As for falkon: I just have to set QT_QPA_PLATFORM=xcb then it works fine. Fritzing, too.

newbluemoon avatar Jul 15 '18 15:07 newbluemoon

Falkon looking for libGLESv2.so and libEGL.so in /usr/bin is a bug in WebEngine and has been fixed in 5.11: https://bugreports.qt.io/browse/QTBUG-65682

newbluemoon avatar Jul 15 '18 18:07 newbluemoon

I didn’t encounter any further problems.

The thing with the eglfs backend is that input devices are handled independently and might require further user configuration and it seems to have a problem with WebEngine (WebEngine compiled with X11 support, however qpa backend is not xcb. This may fail.). No idea if this can be tweaked somewhere.

However, when using the xcb X11 backend everything works as it should (even stellarium ;) ).

So I don’t know how to proceed from here. :) I think a problem might still be the conflicting .pc files. Perhaps moving the ones from rpi-userland to /opt/vc/lib/pkgconfig? But then the PKG_CONFIG_PATH has to be adjusted and if both are present how to chose which one to use?

newbluemoon avatar Jul 17 '18 08:07 newbluemoon

Darn.. now I forgot to add this change to the qt5 revbump for gcc dropping gcc4 compat. Ok, yet another revbump afterwards ;-P

pullmoll avatar Jul 17 '18 20:07 pullmoll

@newbluemoon can you perhaps create a PR with the changes you found upon qt5-5.10.1_10 ? That would be great, because I may miss a detail and waste another round of qt5 building.

pullmoll avatar Jul 17 '18 20:07 pullmoll

@pullmoll Sure, no problem! :)

newbluemoon avatar Jul 17 '18 20:07 newbluemoon

@pullmoll Done. Sorry, it took a bit longer than anticipated, but I really wanted to make sure I got everything right. ;)

newbluemoon avatar Jul 17 '18 21:07 newbluemoon