Crosscompile Qt5.7: Additional dependencies?

  • Hi I'm crosscompiling on a Ubuntu 16.04 VM for the raspberry pi - I followed this guide - Everything works just great until I needed some additional libraries which are not available as package on the Raspi (but they are on Ubuntu) - So, the question is how do you add additional raspi libraries to the qtcreator build system which you compiled yourself?


  • Lifetime Qt Champion


    The usual way is to install the dev packages of the dependencies you need on the Pi and use the filesystem as sysroot.

  • Yes, that's exactly the problem since there is no dev package for that version - In other words Ubuntu and Raspi packages are not aligned for ola and libola-dev
    Ubuntu: 0.9.8
    Raspi: 0.9.1
    I compiled ola from source on the Raspi - but now I have to get the libs and headers over to the build system

  • Lifetime Qt Champion

    Either mount the Raspberry Pi root file system using sshfs on your computer and use it to compile Qt or sync it with what you are using on your computer.

  • I managed to compile the correct version of ola and synced the sysroot back onto my Ubuntu development host - now I'm getting the following error: ...raspi/sysroot/usr/lib/ error: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20' - I assume the problem is that the crosstool-ng is compiled with gcc4.7 where the libs were compiled on a current Raspbian Jessie which uses gcc 4.9.

  • Lifetime Qt Champion

    You should indeed update your toolchain.

  • Just a quick update for your reference: The toolchain used in the guide is a old compiler built by linaro. They no longer make specific raspberry pi builds. If you need to crosscompile using libraries you compiled on your Raspberry (Jessie) which uses gcc4.9 you need to use a different tool chain
    arm-rpi-4.9.3-linux-gnueabihf - This will unfortunately not work out of the box - there are a few things which need to be changed to make this work see here for the necessary fixes which need to be applied. Also the configure should use -device linux-rasp-pi-g++ I could not get it to work for linux-rasp-pi2-g++ or linux-rpi3-g++. The reason is mainly because the qmake.conf in e.g. linux-rpi3-g++ (qtbase/mkspecs/devices/linux-rpi3-g++) have errors (it would be great if Qt could fix these - even in the latest 5.8.0 I still see errors like hardcoded /opt dirs which will not work when crosscompiling)

    To summarize: This was done using the following:

  • Lifetime Qt Champion

    Thanks for the follow up !

    Since there seems that there might be errors in the mkspecs, can you provide an updated version ? If so, would you consider submitting it for inclusion in the next release ?

    If not, then at least consider opening a new report on the bug report system. Don't forget to check first if there's already something about it.

Log in to reply

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