Important: Please read the Qt Code of Conduct -

cross compiling qt5 tools for target

  • hi.

    i am cross compiling qt5 on a 64-bit intel machine for a 32-bit intel device. in this case, qmake/moc/rcc/uic tools are generated for the 64-bit host machine, which i use as part of a cross-compilation toolchain.

    however, i would like to also build these tools for the 32-bit target device, in case i want to compile qt applications directly on the device. how would one generate these tools also for the target device?


  • Compiling Qt and its tools only wouldn't be enough, as they still rely on GCC, MinGW, MSVC or whatever you're using to build the applications. You would need one of these compilers on the device also. Are you sure that's what you want? If you are, you can edit the platform specs you're using on your configure command and add the compiler flags for compiling 32bits binaries. You can find them at qtbase/mkspecs.

  • Lifetime Qt Champion

    @fatih.erol You can simply build Qt on your target device (if you have all needed dependencies there).

  • @jsulm This would be too slow on the target device. Is there a specific make target for just these tools?

  • @Leonardo The target device does have the other build tools and libraries. What I need is a Qt configure option or a make target, so that while cross-compiling Qt on 64-bit development system, these tools are generated not only for the 64-bit host system but also for the 32-bit target platform. For example, the xmlpatterns executable is generated for the 32-bit target platform.

  • Lifetime Qt Champion


    The host tools are never cross-compiled as they are meant to be used from the host.

    If you want a fully operational Qt on your target then you should build it as @jsulm suggested.

  • I assumed you had the same operating system on both the host machine and the device. If that's the case, you could just add the "-platform <name here>" flag when calling "configure". You can see all supported platforms at qtbase/mkspecs.

    If the operating system is not the same, then @SGaist is right. It's not possible. Everything should be built on the device itself.

  • The host system is 64-bit Ubuntu 14.04. The target system is 32-bit ArchLinux with an older kernel.
    So, I guess, I either have to write a cmake/qmake/Makefile for these tools similar to cross-compiled executables such as xmlpatterns, or, I build on the target directly.
    In case of building on the target (which would be rather slow), will the following be the minimal make targets to build these executables:

    cd ${BUILD_DIR}
    ${QT_SRC_DIR}/configure ...
    make -C ${BUILD_DIR}/qtbase/src sub-bootstrap qmake sub-moc sub-rcc sub-uic

  • I don't think building the libraries in one machine and the tools in another one is a good idea. Maybe you could build it using a virtual machine. It will be faster than building on the device. After that, all you have to do is copy the files to the device.

Log in to reply