Raspberry Pi 3 Compile with X11 (EGLF not wanted)
-
So I have been trying to cross-compile QT for my Pi3 running the latest Raspbian GNU/Linux 9 (stretch) for the past 2 days and so far I only seem to be able to get ELGFS to work...which I do not want! I want to be able to run GUI applications running on X11. I have been following this guide "http://wiki.qt.io/RaspberryPi2EGLFS" trying to leave out the EGLFS stuff. Please give me some help here as I am pulling my hair out at this point. I have tried QT versions 5.5, 5.6, and 5.9.1, they all end up with "EGL on X ........... no" and there error is here:
EGL-X11 auto-detection... () /home/psyc/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux -mfloat-abi=hard --sysroot=/home/psyc/raspi/sysroot -O2 -Wall -W -fPIC -I. -I/home/psyc/raspi/sysroot/opt/vc/include -I/home/psyc/raspi/sysroot/opt/vc/include/interface/vcos/pthreads -I/home/psyc/raspi/sysroot/opt/vc/include/interface/vmcs_host/linux -I../../../mkspecs/devices/linux-rasp-pi2-g++ -o egl-x11.o egl-x11.cpp In file included from egl-x11.cpp:34:0: egl-x11.cpp: In function ‘int main(int, char**)’: /home/psyc/raspi/sysroot/opt/vc/include/EGL/egl.h:68:54: error: invalid conversion from ‘EGLNativeDisplayType {aka void*}’ to ‘Display* {aka _XDisplay*}’ [-fpermissive] #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) ^ egl-x11.cpp:47:20: note: in expansion of macro ‘EGL_DEFAULT_DISPLAY’ Display *dpy = EGL_DEFAULT_DISPLAY; ^ egl-x11.cpp:49:9: error: invalid conversion from ‘EGLNativeDisplayType {aka void*}’ to ‘Display* {aka _XDisplay*}’ [-fpermissive] dpy = egldpy; ^ egl-x11.cpp:50:79: error: invalid conversion from ‘Window {aka long unsigned int}’ to ‘EGLNativeWindowType {aka void*}’ [-fpermissive] EGLNativeWindowType w = XCreateWindow(dpy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ^ egl-x11.cpp:51:26: error: invalid conversion from ‘EGLNativeWindowType {aka void*}’ to ‘Window {aka long unsigned int}’ [-fpermissive] XDestroyWindow(dpy, w); ^ In file included from egl-x11.cpp:36:0: /home/psyc/raspi/sysroot/usr/include/X11/Xlib.h:2243:12: error: initializing argument 2 of ‘int XDestroyWindow(Display*, Window)’ [-fpermissive] extern int XDestroyWindow( ^ Makefile:266: recipe for target 'egl-x11.o' failed make: *** [egl-x11.o] Error 1 EGL-X11 disabled.
The basic configuration I have been using looks something like this: ./configure -release -opengl es2 -qt-xcb -system-xcb -system-xkbcommon -nomake tests -nomake examples -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
Build options: Configuration .......... accessibility accessibility-atspi-bridge audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile cups dbus egl eglfs eglfs_brcm enable_new_dtags evdev eventfd fontconfig full-config getaddrinfo getifaddrs glib harfbuzz iconv inotify ipv6ifname large-config largefile libinput libudev linuxfb medium-config minimal-config mremap mtdev neon nis opengl opengles2 openssl openvg png posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports release rpath shared small-config system-freetype system-jpeg system-png system-zlib tslib use_gold_linker xcb xcb-glx xcb-plugin xcb-render xcb-xlib xinput2 xkbcommon-evdev xkbcommon-qt xlib xrender Build parts ............ libs Mode ................... release Using sanitizer(s)...... none Using C++11 ............ yes Using gold linker....... yes Using new DTAGS ........ yes Using PCH .............. yes Target compiler supports: Neon ................. yes Qt modules and options: Qt D-Bus ............... yes (loading dbus-1 at runtime) Qt Concurrent .......... yes Qt GUI ................. yes Qt Widgets ............. yes Large File ............. yes QML debugging .......... yes Use system proxies ..... no Support enabled for: Accessibility .......... yes ALSA ................... no CUPS ................... yes Evdev .................. yes FontConfig ............. yes FreeType ............... yes (system library) Glib ................... yes GStreamer .............. no GTK theme .............. no HarfBuzz ............... yes (bundled copy) Iconv .................. yes ICU .................... no Image formats: GIF .................. yes (plugin, using bundled copy) JPEG ................. yes (plugin, using system library) PNG .................. yes (in QtGui, using system library) journald ............... no libinput................ yes mtdev .................. yes (system library) Networking: getaddrinfo .......... yes getifaddrs ........... yes IPv6 ifname .......... yes libproxy.............. no OpenSSL .............. yes (loading libraries at run-time) NIS .................... yes OpenGL / OpenVG: EGL .................. yes OpenGL ............... yes (OpenGL ES 2.0+) OpenVG ............... yes-auto PCRE ................... system pkg-config ............. yes PulseAudio ............. yes QPA backends: DirectFB ............. no EGLFS ................ yes EGLFS i.MX6....... . no EGLFS KMS .......... no EGLFS Mali ......... no EGLFS Raspberry Pi . yes EGLFS X11 .......... no LinuxFB .............. yes XCB .................. yes (system library) EGL on X ........... no GLX ................ yes MIT-SHM ............ yes Xcb-Xlib ........... yes Xcursor ............ yes (loaded at runtime) Xfixes ............. yes (loaded at runtime) Xi ................. no Xi2 ................ yes Xinerama ........... yes (loaded at runtime) Xrandr ............. yes (loaded at runtime) Xrender ............ yes XKB ................ no XShape ............. yes XSync .............. yes XVideo ............. yes Session management ..... yes SQL drivers: DB2 .................. no InterBase ............ no MySQL ................ no OCI .................. no ODBC ................. yes (plugin) PostgreSQL ........... no SQLite 2 ............. yes (plugin) SQLite ............... yes (plugin, using bundled copy) TDS .................. yes (plugin) tslib .................. yes udev ................... yes xkbcommon-x11........... yes (bundled copy, XKB config root: /usr/share/X11/xkb) xkbcommon-evdev......... yes zlib ................... yes (system library) NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1. Configure with '-qreal float' to create a build that is binary compatible with 5.1. Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into /usr/local/qt5pi Prior to reconfiguration, make sure you remove any leftovers from the previous build.
Thanks for any help you can give.
-
Hi and welcome
Maybe you can just use these ?
http://www.qtrpi.com/home -
@mrjj just tried, gives me the same results as when I compile myself. EGLF is the only thing that works.
platform minimalegl gives:Opened display 0x1 Initialized display 1 4 Could not create the egl surface: error = 0x300b EGL error
xcb gives:
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile 0)
minimal and linuxfb give:
This plugin does not support createPlatformOpenGLContext! Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile 0)
So what is the problem here?
-
Turns out the raspberry pi 2 qmake.conf file in qtbase/mkspecs/devices/linux-rasp-pi2-g++ actually tries to force EGLFS. After replacing that config with the one below I finally got: "EGL on X ........... yes" and now my application is happily running windowed on my Pi.
config was:./configure -release -no-eglfs -qt-xcb -xcb -nomake tests -nomake examples -skip qtscript -skip qtwebkit -skip qtwebengine -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
qmake.conf:
# qmake configuration for the Raspberry Pi 2(no EGLFS) include(../common/linux_device_pre.conf) QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux QMAKE_CXXFLAGS = $$QMAKE_CFLAGS DISTRO_OPTS += hard-float QT_QPA_DEFAULT_PLATFORM = xcb include(../common/linux_arm_device_post.conf) load(qt_config)
-
@d.sully Thanks very much for sharing that, I was stuck exactly at same point. Your solution works perfectly.
Just a small question in case you know: my app runs perfectly if I run it directly from the rpi3 but if I try to launch it from QtCreator on my linux machine I get this message:
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
I can survive without being able to launch/debug in creator but in case someone knows a solution...Thanks again
Philippe -
Thank you very much for this information. It's been really usefull. I've been able to compile the libraries and a small Quick Controls 2 sample windowed. But, for me, it seems to be a bit slow. I'm using the MESA drivers since. Is there an alternative or a solution for this.
Again, thanks.
Regards,
Ivan