Qt app without window manager.



  • Hi my goal is to write a small gui app for ubuntu without window manager.

    And you guessed it, i am stuck!

    First i built a machine with ubuntu desktop, installed Qt5 and built a small Qt console app.
    Than i built a machine with ubuntu server (no window manager), copied the console app i built previously and the depending shared libs in this machine, it didn't run. Ok, then i copied the shared libs to /usr/lib and it ran fine.

    GUI time :)

    Built a small GUI app on ubuntu desktop machine, copied the app and it's dependencies to the ubuntu server machine and of course it didn't run. I copied the app Qt shared libs that the app depended on to /usr/lib again it didn't run.

    Last error is :
    "Failed to load platform plugin "xcb" . Available platforms are:

    Aborted.
    "
    I started googling and i installed a bunch of libraries like libxcb , xorg etc...

    Than i put in plugins/platforms the libqxcb.so library and you guessed it again, no luck.

    :( Has anyone ever done or thought about it?



  • a window manager may be mandatory for gui app?
    refer to source code, configure options etc.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I you don't want any window manager you would have to use i.e the linuxFB plugin.

    The xcb plugins implies the use of x11 which is a window manager.

    You will have to compile Qt 5 yourself to achieve what you want



  • Aha, the framebuffer again.

    All the build configurations i've seen use xcb how do i configure Qt to use the linux framebuffer and then build it?


  • Lifetime Qt Champion

    There's also DirectFB if your system supports it.

    Just pass the -linuxfb to configure. For more options you can run configure --help



  • Until now i have tried three times to build but all times have failed.

    I followed "Building Qt5 from Git":http://qt-project.org/wiki/Building_Qt_5_from_Git step by step.

    My configuration is: ./configure -opensource -release -force-debug-info -confirm-license -static -qt-sql-mysql -qt-zlib -qt-libpng -qt-libjpeg -no-openssl -no-pch -linuxfb -nomake examples -nomake tests

    and it fails. with this error:
    @/home/user/Qt5.1Git/qt5/qtwebkit/lib/libQt5WebKitWidgets.a: could not read symbols: Malformed archive
    collect2: error: ld returned 1 exit status
    make[3]: *** [../../bin/QtWebProcess] Error 1
    make[3]: Leaving directory /home/user/Qt5.1Git/qt5/qtwebkit/Source/WebKit2' make[2]: *** [sub-WebKit2-WebProcess-pro-make_first-ordered] Error 2 make[2]: Leaving directory/home/user/Qt5.1Git/qt5/qtwebkit/Source'
    make[1]: *** [sub-Source-QtWebKit-pro-make_first-ordered] Error 2
    make[1]: Leaving directory `/home/user/Qt5.1Git/qt5/qtwebkit'
    make: *** [module-qtwebkit-make_first] Error 2@

    At first i had -no-xcb but it failed saying that libqxcb was missing.

    Edit: My g++ version is g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3


  • Lifetime Qt Champion

    Unless you explicitly need webkit you should just not build it. That will save time and hassle



  • Webkit would've ben nice.

    Ok, i am trying to build without webkit but i have to delete the webkit directory because the configure script has no option to remove webkit from commpiling. "-no-web" and " nomake webkit " do no work.


  • Lifetime Qt Champion

    IIRC, building webkit statically has always been problematic.

    Also, don't forget the licensing implication of building Qt statically



  • Ahhh painful.

    The error now is:

    @make[3]: Leaving directory /home/user/Qt5.1Git/qt5/qtbase/src/network' make[3]: Entering directory/home/user/Qt5.1Git/qt5/qtbase/src/network'
    make[3]: Warning: File ../../.qmake.cache' has modification time 1.6e+04 s in the future /home/user/Qt5.1Git/qt5/qtbase/bin/qmake -o Makefile network.pro Project MESSAGE: perl -w /home/user/Qt5.1Git/qt5/qtbase/bin/syncqt.pl -module QtNetwork -version 5.1.2 -outdir /home/user/Qt5.1Git/qt5/qtbase /home/user/Qt5.1Git/qt5/qtbase <srcbase> = /home/user/Qt5.1Git/qt5/qtbase <outbase> = /home/user/Qt5.1Git/qt5/qtbase make[3]: Leaving directory/home/user/Qt5.1Git/qt5/qtbase/src/network'
    make[3]: Entering directory /home/user/Qt5.1Git/qt5/qtbase/src/network' make[3]: Warning: File../../.qmake.cache' has modification time 1.6e+04 s in the future
    /home/user/Qt5.1Git/qt5/qtbase/bin/qmake -o Makefile network.pro
    Project MESSAGE: perl -w /home/user/Qt5.1Git/qt5/qtbase/bin/syncqt.pl -module QtNetwork -version 5.1.2 -outdir /home/user/Qt5.1Git/qt5/qtbase /home/user/Qt5.1Git/qt5/qtbase
    <srcbase> = /home/user/Qt5.1Git/qt5/qtbase
    <outbase> = /home/user/Qt5.1Git/qt5/qtbase
    @

    it is constantly printing this. Looks like it is stuck in a loop printing this all the time.


  • Lifetime Qt Champion

    You seem to have some problem with your system clock...

    You should restart your build from a clean source tree and use a shadow build directory.



  • What do you mean by system clock? I am using a virtual machine for this.

    The only thing that is not working from that guide is : scl enable devtoolset-1.1 bash

    Now i restarted the system and started a new build under root without webkit.


  • Lifetime Qt Champion

    This line

    @make[3]: Warning: File `../../.qmake.cache' has modification time 1.6e+04 s in the future
    @

    made me think of a clock problem



  • Finally some progress.

    The build finished fine. I also built my first app. All ok.

    But when i try to run the app i get an error:
    @QFontDatabase: Cannot find font directory /usr/local/Qt-5.1.2/lib/fonts - is Qt installed correctly?@

    At this stage i haven't executed make install . A note on the guide says :
    @Note: Installation is only needed if you haven’t used the configure options -developer-build or -prefix “PWD/qtbase”. Otherwise you can just use Qt from the build directory.@

    And i didn't put -developer-build in my build configuration.
    Could this be the problem?


  • Lifetime Qt Champion

    You need to have this folder on your target computer



  • Which directory? PWD/qtbase or /usr/local/Qt-5.1.2/lib/fonts ?
    What should it contain?

    I will also try a build with -developer-build but currently gitorious is down.


  • Lifetime Qt Champion

    /usr/local/Qt-5.1.2/lib/fonts, you need it on your target computer, the one running without window manager. It must contain the font files



  • Ok, on dev platform it worked. The compiled binary is around 150MB.

    In the target at first it failed because it couldn't find libicudata.so.48 libicuuc.so.48 libicui18n.so.48 which is strange because i compiled it statically.
    Do i need any thing extra in the .pro file for static building the app ?

    After copying the requested libs in the target /usr/lib a new error appeared:
    @QXcbConnection Could not connect to display@


  • Lifetime Qt Champion

    You can build a static library but still have shared dependency.

    IIRC you need to tell your application which plugin you want to use



  • Ok, but why is qt still trying to use xcb, i built it for linuxfb?

    My build configuration is:
    @./configure -opensource -release -force-debug-info -confirm-license -static -qt-sql-mysql -qt-zlib -qt-libpng -qt-libjpeg -no-openssl -no-pch -linuxfb -nomake examples -nomake tests
    @


  • Lifetime Qt Champion

    Just wild guess, but it might be that linuxfb is built additionally to xcb



  • I just finnished rebuilding a fresh copy and if put -no-xcb the compilation fails with error:
    @g++ -Wl,-rpath-link,/qt51/qtjsbackend/lib -o ../../bin/qmlplugindump .obj/release-static/main.o .obj/release-static/qmlstreamwriter.o .obj/release-static/qmlplugindump_plugin_import.o -L/qt51/qtdeclarative/lib -lQt5Quick -L/qt51/qtbase/lib -L/qt51/qtjsbackend/lib -lQt5Qml -lQt5V8 -lQt5Network -L/qt51/qtbase/plugins/platforms -lqminimal -lQt5PlatformSupport -lfontconfig -lfreetype -lXext -lX11 -lXrender -lQt5Gui -lQt5Core -licui18n -licuuc -lm -ldl -pthread -lgthread-2.0 -lglib-2.0 -lrt -lGL -lpthread
    /usr/bin/ld: cannot find -lqxcb
    collect2: error: ld returned 1 exit status
    make[3]: *** [../../bin/qmlscene] Error 1
    make[3]: Leaving directory /qt51/qtdeclarative/tools/qmlscene' make[2]: *** [sub-qmlscene-make_first] Error 2 make[2]: *** Waiting for unfinished jobs.... /qt51/qtbase/lib/libQt5Gui.a(qimage.o): In functionmemset':
    /usr/include/i386-linux-gnu/bits/string3.h:81: warning: memset used with constant zero length parameter; this could be due to transposed parameters
    make[3]: Leaving directory /qt51/qtdeclarative/tools/qmlplugindump' make[2]: Leaving directory/qt51/qtdeclarative/tools'
    make[1]: *** [sub-tools-make_first] Error 2
    make[1]: Leaving directory `/qt51/qtdeclarative'
    make: *** [module-qtdeclarative-make_first] Error 2
    @


  • Lifetime Qt Champion

    Did you cleanup before rebuilding ?



  • It was a fresh build in a new directory.


  • Lifetime Qt Champion

    Did you try with -qpa linuxfb ?



  • This is my configuration now:
    @sudo ./configure -opensource -release -force-debug-info -confirm-license -static -qt-sql-mysql -qt-zlib -qt-libpng -qt-libjpeg -no-openssl -no-pch -qpa linuxfb -no-xcb -nomake examples -nomake tests@

    @Build options:
    Configuration .......... accessibility alsa audio-backend avx avx2 c++11 clock-gettime

    clock-monotonic compile_examples concurrent cups dbus evdev eventfd fontconfig

    force_debug_info full-config getaddrinfo getifaddrs gif glib gstreamer gtk2 gtkstyle iconv

    icu inotify ipv6ifname jpeg large-config largefile linuxfb medium-config minimal-config

    mremap nis opengl pcre png pulseaudio qpa qpa reduce_exports reduce_relocations release rpath

    small-config sse2 sse3 sse4_1 sse4_2 ssse3 static system-freetype v8 v8snapshot xlib xrender

    zlib
    Build parts ............ libs tools
    Mode ................... release (with debug info)
    Using C++11 ............ yes
    Using PCH .............. no
    Target compiler supports:
    SSE2/SSE3/SSSE3 ...... yes/yes/yes
    SSE4.1/SSE4.2 ........ yes/yes
    AVX/AVX2 ............. yes/yes

    Qt modules and options:
    Qt D-Bus ............... yes (loading dbus-1 at runtime)
    Qt Concurrent .......... yes
    Qt GUI ................. yes
    Qt Widgets ............. yes
    JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
    QML debugging .......... yes
    Use system proxies ..... no

    Support enabled for:
    Accessibility .......... yes
    ALSA ................... yes
    CUPS ................... yes
    FontConfig ............. yes
    Iconv .................. yes
    ICU .................... yes
    Image formats:
    GIF .................. yes (in QtGui, using system library)
    JPEG ................. yes (in QtGui, using bundled copy)
    PNG .................. yes (in QtGui, using bundled copy)
    Glib ................... yes
    GStreamer .............. yes
    GTK theme .............. yes
    Large File ............. yes
    libudev ................ no
    Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. no
    NIS .................... yes
    OpenGL ................. desktop
    OpenVG ................. no
    PCRE ................... yes (bundled copy)
    pkg-config ............. yes
    PulseAudio ............. yes
    QPA backends:
    DirectFB ............. no
    EGLFS ................ no
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. no
    Session management ..... yes
    SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ qt
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
    udev ................... no
    xkbcommon .............. no
    zlib ................... yes (bundled copy)
    @

    It is building now, fingers crossed.



  • So far so great.

    I built twice. It failed the first time because i forgot to ommit the webkit, pfff.

    The second time it build perfectly with the above configuration. Thanks SGaist.

    So i quickly built a simple gui app and copied it in the target system and voila a window appeared :) .

    But, still a but, i don't have a mouse and keyboard. And the system is stuck at this point.


  • Lifetime Qt Champion

    Great !

    You can also move/remove the webkit folder if you want to avoid that.

    Are both detected on your target system ?



  • My target system is just a console system. I guess at least the keyboard should be ok because i am able to launch it.

    How can i check if mouse is detected also?



  • Update:

    AnalogClock example runs ok. I mean that the clock ticks.

    I changed my app by placing a QLineEdit and i can see the cursor in the QLineEdit blinking but i can't type nor move the mouse.



  • Update: yes mouse is detected on the target system.


  • Lifetime Qt Champion

    What kind of device is reported ? (/dev/mouse or... ?)



  • Yes /dev/mouse2 .

    There is also /dev/mouse1 but it appers that the correct one is /dev/mouse2


  • Lifetime Qt Champion

    Then you might need to setup that information before starting your application but I don't know if Qt 5 has the same set of variables / command line options as Qt 4 for that, sorry.



  • Ok, thanks a lot. You've been very helpful.

    I will start a new thread for this problem.

    Edit: Follow "this thread":http://qt-project.org/forums/viewthread/31911/ for mouse and keyboard problem.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.