Qt Creator 'automatically' sets compiler path

  • Hi,

    I noticed that Qt Creator modifies the build environment when a Qt version is loaded (from the Manage button in Projects).

    How is this accomplished?

    I'd like to get the Intel Compiler environment supported in the same manner. Currently, I'd have to set the compiler environment and then start Qt Creator, or manually set the environment in build settings.



  • There should be a makespec for the compiler you use (Qt should be compiled with that compiler too). The makespec is determined from the default setting of the Qt version you choose.

    Alternatively, you can change it manually in the project view, tab build settings, make steps for qmake. There you can add additional arguments, e.g. "-spec linux-icc"

  • Thanks. I've seen the makespec qmake.conf and also know how to specify the compiler via -spec linux-icc.

    The problem is that the compiler environment is not set by either of these. Instead, you have to set the bin, lib, include path for the compiler before you start qtcreator.

    Now it may be possible to specify a complete path to icc in the qmake.conf file, but I don't think that's done in any of the other qmake.conf files I've seen.



  • Ah, I think I understand now: Your icc binary is not found, because it is not in the path.

    Did you add the path to .profile or .bashrc in you home dir (or even in the system wide configuration in /etc/*)? As far as it look from the mkspec the tools are named differently (icc, icpc,...), so there shouldn't be a name clash when you have the path to your bin in your PATH variable permanently.

  • Moderators

    The intel compiler should be detected and set up properly in your environment. At least Qt Creator sets up a toolchain for an icpc compiler (if that is found in the PATH set when running Qt Creator). If you use that toolchain (the class is called LinuxIccToolChain IIRC) Creator will make sure the PATH when building/running your application is set to include the directory containing the icpc binary.

    The tricky part is that Creator does not (yet?) set the mkspec used by qmake to match the compiler. You will need to make sure the proper mkspec is selected and rerun qmake.

    PS: If we are missing to set some environment variables, please file a "bug report":http://bugreports.qt.nokia.com/ and assign it straight to me.

  • Thanks Volker and Tobias. Yes, I can get Qt Creator to see and use icc by setting the path to icc before invoking Qt Creator and then adding -spec linux-icc to the qmake command line.

    That is fine. However, we are working on a cross compiler so having your host path 'polluted' with a tool is not preferred.

    Take the Nokia SDK on Windows for example. If you switch between the MSVC 200x Qt Version for Qt simulator and the MinGW gcc Qt Version for Qt simulator, you will notice that Qt Creator changes your build environment paths on the fly. We want this ability for our icc. In addition, the user may have multiple ICCs on their system so it's important for us to be able to explicitly set.

    I'll have to figure out what exactly is meant by LinuxIccToolchain IIRC. I'm guessing it's in the Qt Creator source code which I haven't looked at yet. We're hoping to enable our stuff without having to change Qt Creator source code, but we'll see.

    As an FYI and some background on why I'm asking these types of questions - I'm an architect on the Intel software tools team.

  • Moderators

    Creator will ask the ToolChain for any changes required to the environment. The Linux ICC toolchain should add its directory to the PATH, just as the GCC toolchain does. That is not really visible when using the system environment (as gcc and the icc compilers are both only picked up when they are in the path already:-), but this should be visible when using a clean environment.

    Actually I am refactoring the ToolChain handling right now. One effect will be that the whole thing becomes way more configurable (to e.g. support several different versions of gcc, etc.) and powerful. So stay tuned:-)

Log in to reply

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