Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to build Qt on system without a GUI?


  • Lifetime Qt Champion

    Hi,

    What version of xkbcommon do you have installed ?



  • @closx said in How to build Qt on system without a GUI?:
    I'm not aware what is actually installed ... I've just executed the following instruction, as was suggested previously in this topic (except libxcb-util0 which wasn't found)

    sudo apt-get install libxcb1 libxcb-util0 libpam-dev libcairo-dev libxcb-xinerama0 libev-dev libx11-dev libx11-xcb-dev libxkbcommon0 libxkbcommon-x11-dev libxkbcommon-dev libxcb-dpms0-dev libxcb-xinerama0-dev libxkbfile-dev libxcb-util0-dev libxcb-image0-dev


  • Qt Champions 2019

    @Pavel_47 Did you install these packages on your target device? Since you're crosscompiling you need them in your sysroot, not on your host machine.



  • I've contacted libxkbcommon developers. They suggested me using this command:
    sudo apt-get install libxkbcommon-dev libxkbcommon-x11-dev
    That is what i did, but system informed me that libxkbcommon-dev and libxkbcommon-x11-dev are already the newest versions (i.e. 0.8.2-1~ubuntu 18.04.1).

    Well, I'm trying to rebiuild Qt toolchain once more . Now it's running ...



  • Sorry, I've missed your last suggestion - install libxkbcommon on target (i.e RPi3 in my case). But anyway, how build process on the host can be influenced by what is installed (or not) on that target device ?



  • The new attempt of Qt building is also failed.
    I wonder if anyone has managed to bulid Qt on Ubuntu ?
    What should I check ... or install to resolve the problem ?


  • Lifetime Qt Champion

    Since you are cross-compiling, you need all dependencies for your target. This is usually done installing the libraries on said target and then sync the content of the file system of the target back to the host so the cross-compiler can use them to do its work.



  • I've just checked libxkbcommon-dev and libxkbcommon-x11-dev on RPi. As on Ubuntu they are installed and are newest versions.


  • Lifetime Qt Champion

    Did you sync your RPi filesystem back to your host before trying to build Qt ?



  • Yes, at very first time I executed these commands (as it's suggested here https://wiki.qt.io/RaspberryPi2EGLFS):
    rsync -avz pi@raspberrypi.local:/lib sysroot
    rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
    rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
    rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt

    Then I did 3 or 4 other attempts to build, but at each of these attempts I didn't proceed with resync with RPi.
    Anyway one thing escapes me .... should I keep connection with RPi while running toolchain build on host ?


  • Qt Champions 2019

    @Pavel_47 said in How to build Qt on system without a GUI?:

    should I keep connection with RPi while running toolchain build on host ?

    No, you just need to sync your sysroot.



  • I've checked the location of xkbcommon-compose.h. It's Ok:
    alt text
    Then I've tried to compile this:

    #include <xkbcommon/xkbcommon-compose.h>
    int main() {}
    

    It was also Ok


  • Qt Champions 2019

    @Pavel_47 Is it in your host system or sysroot?



  • @jsulm said in How to build Qt on system without a GUI?:

    @Pavel_47 Is it in your host system or sysroot?

    Sorry, I didn't understand what you mean ...
    The location of the screenshot: /usr/include/xkbcommon on my host
    The location of .c snippet (where I compiled it): ~/raspi/ on my host


  • Qt Champions 2019

    @Pavel_47 said in How to build Qt on system without a GUI?:

    /usr/include/xkbcommon on my host

    That's the point: you need these headers in your sysroot!



  • Indeed !
    In ~/raspi/sysroot/usr/include/xkbcommon there is one less file comparing to /usr/include/xkbcommon ... and this missed file is precisely xkbcommon-compose.h.

    alt text

    So, I copy xkbcommon-compose.h from /usr/include/xkbcommon to ~/raspi/sysroot/usr/include/xkbcommon and then build Qt toolchain once more ?



  • I copied xkbcommon-compose.h from /usr/include/xkbcommon to ~/raspi/sysroot/usr/include/xkbcommon and then run make once more.
    And it failed one more time.
    Here is how it finished:
    alt text

    Any other suggestions ?

    Thanks.


  • Lifetime Qt Champion

    As we already wrote: you need the library too. And built for your target.



  • You mean that the errors announce in the screenshot from previous message are still related to the xkbcommon issue ?
    So I should ask xkbcommon developpers for makefile dedicated for RPi3. Correct ?
    Let's say I got it, what next ? Where should I put xkbcommon built directory ... i.e. which location in ~/raspi/sysroot.
    After all ... I wonder if someone already faced this issue ? Or this probles rose for the 1st time ? What about previous Qt releases ? There were no similar issues ?


  • Lifetime Qt Champion

    It's a library that is now provided on all Linux flavours supported by the Qt project. Prior to that, it was bundled with Qt.

    So what distribution are you running on your Pi ?



  • Linux raspberrypi 4.9.77-v7+


  • Lifetime Qt Champion

    That's the kernel running on your target.

    Are you using Raspbian ? Another distribution ?



  • Yes, I use raspbian "Jessie"


  • Lifetime Qt Champion

    Then, AFAIR, you should have the library. So if it can't be found either:

    • it wasn't synchronized properly back to your host machine
    • the configure call has not been done from a clean state
    • it's not the correct library that was found

    For the first point you have to sync the library as well as the symbolic links pointing to it or re-create them in your host copy of the sysroot.



  • I did as you suggested:
    (1) resync host wit RPi:
    rsync -avz pi@raspberrypi.local:/lib sysroot
    rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
    rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
    rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt

    (2) update symbolic names:
    ./sysroot-relativelinks.py sysroot
    Then rebuild Qt (rather tried to rebuild).
    Here is what I got:
    alt text

    This time it's different ... but still fails



  • @Pavel_47 two things please:

    1. Your last screenshot doesn't seem to show exact error, I guess you should scroll up
    2. stop posting screenshots, paste text instead (it's easier for others to comment back on any line of output for instance...)


  • The log is huge.
    I scrolled up a few hundred lines - nothing that indicatedŝ errors.
    Concerning text instead of screenshots - Ok, I took note.


  • Lifetime Qt Champion

    Run the build with only one process you'll have the error closer.



  • Yes, with one core the the log is more verbose.
    Here is what I got at the end:

    rm -f libcomposeplatforminputcontextplugin.so
    /home/pavel/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/pavel/raspi/sysroot -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../lib -Wl,-rpath-link,/home/pavel/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/pavel/raspi/sysroot/lib/arm-linux-gnueabihf -shared -o libcomposeplatforminputcontextplugin.so .obj/qcomposeplatforminputcontextmain.o .obj/qcomposeplatforminputcontext.o .obj/moc_qcomposeplatforminputcontext.o  -L=/opt/vc/lib /home/pavel/raspi/qtbase/lib/libQt5Gui.so /home/pavel/raspi/qtbase/lib/libQt5Core.so /home/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libGLESv2.so -lpthread /home/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so   
    .obj/qcomposeplatforminputcontext.o: In function `QComposeInputContext::~QComposeInputContext()':
    qcomposeplatforminputcontext.cpp:(.text+0x34): undefined reference to `xkb_compose_state_unref'
    qcomposeplatforminputcontext.cpp:(.text+0x3c): undefined reference to `xkb_compose_table_unref'
    .obj/qcomposeplatforminputcontext.o: In function `QComposeInputContext::reset()':
    qcomposeplatforminputcontext.cpp:(.text+0x80): undefined reference to `xkb_compose_state_reset'
    .obj/qcomposeplatforminputcontext.o: In function `QComposeInputContext::ensureInitialized()':
    qcomposeplatforminputcontext.cpp:(.text+0x3bc): undefined reference to `xkb_compose_table_new_from_locale'
    qcomposeplatforminputcontext.cpp:(.text+0x3d0): undefined reference to `xkb_compose_state_new'
    .obj/qcomposeplatforminputcontext.o: In function `QComposeInputContext::filterEvent(QEvent const*)':
    qcomposeplatforminputcontext.cpp:(.text+0x6ac): undefined reference to `xkb_compose_state_feed'
    qcomposeplatforminputcontext.cpp:(.text+0x6b4): undefined reference to `xkb_compose_state_get_status'
    qcomposeplatforminputcontext.cpp:(.text+0x6f8): undefined reference to `xkb_compose_state_get_utf8'
    qcomposeplatforminputcontext.cpp:(.text+0x72c): undefined reference to `xkb_compose_state_get_utf8'
    collect2: error: ld returned 1 exit status
    Makefile:247: recipe for target '../../../../plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so' failed
    make[4]: *** [../../../../plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so] Error 1
    make[4]: Leaving directory '/home/pavel/raspi/qtbase/src/plugins/platforminputcontexts/compose'
    Makefile:47: recipe for target 'sub-compose-make_first' failed
    make[3]: *** [sub-compose-make_first] Error 2
    make[3]: Leaving directory '/home/pavel/raspi/qtbase/src/plugins/platforminputcontexts'
    Makefile:129: recipe for target 'sub-platforminputcontexts-make_first' failed
    make[2]: *** [sub-platforminputcontexts-make_first] Error 2
    make[2]: Leaving directory '/home/pavel/raspi/qtbase/src/plugins'
    Makefile:778: recipe for target 'sub-plugins-make_first' failed
    make[1]: *** [sub-plugins-make_first] Error 2
    make[1]: Leaving directory '/home/pavel/raspi/qtbase/src'
    Makefile:50: recipe for target 'sub-src-make_first' failed
    make: *** [sub-src-make_first] Error 2
    
    

    Seem that problem is still related to xkb staff ...


  • Qt Champions 2019

    @Pavel_47 said in How to build Qt on system without a GUI?:

    undefined reference to `xkb_compose_state_get_utf8'

    You're not linking against xkb lib



  • So, problems in Makefile ?


  • Qt Champions 2019

    @Pavel_47 Try

    file /home/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so
    

    and post the output here.



  • here it is:

    pavel@ALABAMA:~/raspi/qtbase$ file ~/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so
    /home/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so: symbolic link to libxkbcommon.so.0.0.0
    

  • Qt Champions 2019

    @Pavel_47 Then please do

    file /home/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0
    


  • pavel@ALABAMA:~/raspi/qtbase$ file ~/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0
    /home/pavel/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0: cannot open `/home/pavel/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0' (No such file or directory)
    


  • @Pavel_47 said in How to build Qt on system without a GUI?:

    I've just checked libxkbcommon-dev and libxkbcommon-x11-dev on RPi.

    So sync them to your sysroot in the host PC!

    As on Ubuntu they are installed and are newest versions.

    Forget about that, it doesn't matter.

    For cross-compilation you need your libraries + headers installed properly in target device (RPi), then copy (synchronize) some folders from your target device into the sysroot folder in your host PC (with Ubuntu) and only then attempt to build (Qt framework, modules, your application).

    Please take a look at this guide for cross-compiling Qt for RPi



  • @Pablo-J-Rogina said in How to build Qt on system without a GUI?:

    Please take a look at this guide for cross-compiling Qt for RPi

    I proceeded exactly as described on the page you mentioned.
    Sure I performed the resync with RPi



  • @Pavel_47 said in How to build Qt on system without a GUI?:

    Sure I performed the resync with RPi

    I'm not going to argue in contrary, so your next task is to figure out why even having rsync'd the file is missing from your sysroot folder...

    /home/pavel/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0: cannot open



  • The file isn't missing. It's there:
    alt text



  • @Pavel_47

    The file isn't missing. It's there:

    Well, it's somewhere else but not in the expected location it seems...

    /home/pavel/pavel/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0

    is different from the location in your last post (again, please stop posting screenshots!)

    /home/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0.0.0


Log in to reply