Important: Please read the Qt Code of Conduct -

Copying a qt5 build to a different host machine

  • I have successfully cross-built qt5 for the Odroid C2 in a qt5-build directory on an Ubuntu x86-64 host machine. (Configured thus:

    -sysroot ~/Projects/Odroid/C2/sysroot 
    -prefix /usr/local/qt5c2 
    -hostprefix ~/Projects/Odroid/C2/Qt/qt5-build

    This works fine, and I am able to build and deploy an application on the target device via Qt Creator. I want to enable another host machine (also Ubuntu x86-64) to facilitate development, and thought the process would be as simple as copying my qt5-build directory to the second host.

    To my surprise, this does not work at all, owing to hardcoded paths in various places. Per this SO post I tried creating a qt.conf with

    Prefix = ./../

    With this, "qmake -query" does return the correct paths. However, QtCreator still barfs when I try to select this qmake as my desired Qt version.

    Then I tried "qmake -set" as suggested in another post in the same SO thread:

    $ ./qmake -set QT_HOST_PREFIX /opt/Qt/Odroid-C2/qt5-build
    $ ./qmake -set QT_SYSROOT ~/Projects/Odroid/C2/sysroot

    (The paths here are correct for the new host machine I wish to enable).
    However, it still does not work in QtCreator.

    So: how does one copy/move a Qt build from one host machine to another? Surely it should not require rebuilding Qt from source on every host I'd like to enable. One workaround I can think of is to build on the original host with generic paths under /opt wherever path specification is required, and replicate that structure on all other hosts. But it just feels like there ought to be a real solution to this rather than workarounds.

  • Moderators

    The official recommendation is not to copy the libs after building. The way Qt installers go around it is indeed by using qt.conf.

    I guess the easiest way is indeed to preserve the same paths in all machines. Not very convenient, but will work.

  • I have verified that preserving the same paths (in my case, /opt/Qt) on all hosts for the cross-compiled output, works fine.

Log in to reply