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

How to set compile for qmake



  • Hello. I have easy question (maybe): How to specify path to compile for qmake?
    I've set compilers and Qt in my QtCreator, I've have set Prefix in qt.conf.

    But qmake still igone compilers which set in QtCreator and tried to use old invalid path.

    What I'm doing wrong?


    Also how I can specify compilers without QtCreator ?

    Thanks!



  • @r3d9u11

    In creator go to "Tools"->"Options"->"Kits" and check the different tabs for "kits", "Compiler" and "Qt Versions" for special signs in red or yellow.

    When you have all properly installed you have basically to choose the qmake for a specifc Qt version and in most cases you are fine.

    AFAIK you should not make compilers available through general environment settings outside of creator, because this might interfere.



  • @koahnig Hello. Thank for the reply.

    Yes, I've checked and all settings are right:

    • Kits -> Manual -> Compiler -> C and C++ = GCCARM

    • Compilers -> Manual -> C -> GCCARM = /opt/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc

    • Compilers -> Manual -> C++ -> GCCARM = /opt/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++

    My own Kit has two Warnings:

    • Device not set
    • Debugger not set

    I think it doesn't metter

    Error:
    :-1: error: /home/user/Desktop/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: Command not found
    (it is deprecated path)

    And environment variables:
    $ printenv | grep QT
    QT_ACCESSIBILITY=1
    QT_AUTO_SCREEN_SCALE_FACTOR=0

    I have not ideas whats wrong :(


    Ok, how I can specify compiler if I should compile project by command (without QtCoreator)?
    For example:

    cd OwnProject
    /opt/Qt5.9/bin/qmake OwnProject.pro -spec "devices/linux-imx6-g++" CONFIG+=release CONFIG+=qtquickcompiler
    

    I tried this:

    $ export CC=/opt/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
    $ export CXX=/opt/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
    $ /opt/Qt5.9/bin/qmake MCP1App.pro -spec "devices/linux-imx6-g++" CONFIG+=release CONFIG+=qtquickcompiler
    Project ERROR: Cannot run target compiler '/home/user/Desktop/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++'. Output:
    ===================
    sh: 1:/home/user/Desktop/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: not found
    ===================
    Maybe you forgot to setup the environment?
    


  • @r3d9u11 said in How to set compile for qmake:

    @koahnig Hello. Thank for the reply.

    Yes, I've checked and all settings are right:

    • Kits -> Manual -> Compiler -> C and C++ = GCCARM

    • Compilers -> Manual -> C -> GCCARM = /opt/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc

    • Compilers -> Manual -> C++ -> GCCARM = /opt/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++

    Did you self-compile Qt libs with the toolchain?

    @r3d9u11 said in How to set compile for qmake:

    Error:
    :-1: error: /home/user/Desktop/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++:

    That seem to be the relevant error. Note the difference in path to the compiler.
    AFAIK if you have self-compiled Qt libs and moved or reinstalled the compiler in another location, this might cause such problems.

    When building Qt libs a specific version of qmake for your machine is generated. This holds the path to the toolchain used for compilation. I do not know how tô fix that afterwards. Possibly that is done in mkspecs with its different compiler settings.
    Anyway I tend to have clean setups with lowest amount of intereference in special adaptations.

    If I am correct with self-compilation and moving or reinstallation of cross-compiler, you have 2 options:

    1. Recompile Qt libs with new location of cross-compiler
    2. Move back the cross-compiler to the user/Desktop location where qmake generated process is looking for it.


  • @r3d9u11 said in How to set compile for qmake:

    Device not set
    Debugger not set

    I think it doesn't metter

    Yes, it DOES matter... as it seems you're trying to cross-compile a Qt app. So your kit needs a device which you need to create under tab Devices

    /home/user/Desktop/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: not found

    Please check that your cross-compiler is installed properly and available in the path

    In addition, did you cross-compile Qt framework already?
    Or are you using a pre-built SDK to cross-compile Qt apps?



  • @koahnig said in How to set compile for qmake:

    That seem to be the relevant error. Note the difference in path to the compiler.
    AFAIK if you have self-compiled Qt libs and moved or reinstalled the compiler in another location, this might cause such problems.

    Yes, I I'm looking for way to set toolchain.
    As I told, I've set bin/qt.conf with Prefix, and it works fine (I see correct paths).

    But what's wrong with TC?
    We can't force specify path to compiler?

    When building Qt libs a specific version of qmake for your machine is generated. This holds the path to the toolchain used for compilation. I do not know how tô fix that afterwards. Possibly that is done in mkspecs with its different compiler settings.

    I've tried to change and export variable CROSS_COMPILER, but without success :(



  • @Pablo-J-Rogina said in How to set compile for qmake:

    Yes, it DOES matter... as it seems you're trying to cross-compile a Qt app. So your kit needs a device which you need to create under tab Devices

    Sure, I'm trying to cross-compile application.
    But I dont want install and deploy it.
    All paths to Qt libs are right. However, I still can't make application even I've set valid path to compiler and Qt libs?



  • @Pablo-J-Rogina said in How to set compile for qmake:

    Yes, it DOES matter... as it seems you're trying to cross-compile a Qt app. So your kit needs a device which you need to create under tab Devices

    Ok, but if I don't move TC, it works. Event section Device isn't configured and still empty.
    I think that this section deep for remove debugging and/or deployment, but not for compilation, no?



  • @Pablo-J-Rogina
    shortly: If I understand right, once Qt cross-compiled, will store original TC path into qmake and can't be changed (to compile any Qt project with different TC path, for example) ?



  • @r3d9u11 said in How to set compile for qmake:

    once Qt cross-compiled, will store original TC path into qmake

    That's what I understand too. Hopefully that changed since Qt 5.14 with the "relocatable Qt" feature. See this blog post for a detailed explanation, or original post about the feature.



  • @Pablo-J-Rogina thank you for hints and useful links
    (also I should to do 'make clean' before calling qmake)


Log in to reply