Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator does not pick up compiler configured in Kit
Forum Updated to NodeBB v4.3 + New Features

QtCreator does not pick up compiler configured in Kit

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • vikramgV Offline
    vikramgV Offline
    vikramg
    wrote on last edited by
    #1

    I'm seeing this while cross-building to RPi. I find that the only way to use a specific compiler is to specify the path via QMAKE_CC and QMAKE_CXX in the .pro file. Selecting the desired compiler as part of the Kit doesn't work. If I only select the compiler in the Kit, the build somehow defaults to using the compiler used for cross-compiling Qt itself.

    Why does this happen, and how can I enforce use of a specific compiler without hardcoding it in the .pro file?

    aha_1980A 1 Reply Last reply
    0
    • vikramgV vikramg

      I'm seeing this while cross-building to RPi. I find that the only way to use a specific compiler is to specify the path via QMAKE_CC and QMAKE_CXX in the .pro file. Selecting the desired compiler as part of the Kit doesn't work. If I only select the compiler in the Kit, the build somehow defaults to using the compiler used for cross-compiling Qt itself.

      Why does this happen, and how can I enforce use of a specific compiler without hardcoding it in the .pro file?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @vikramg You need to setup your cross-environment properly. Most often, the cross-compilers have an environment-setup shell script or similar. This sets the environment variables needed for cross-compiling.

      You can either source this script in a shell before starting Qt Creator, or put the (expanded) variables in Qt Creators Kit settings (which I prefer). Then it is easily possible to switch between Desktop and embedded target.

      Regards

      Qt has to stay free or it will die.

      vikramgV 1 Reply Last reply
      0
      • aha_1980A aha_1980

        @vikramg You need to setup your cross-environment properly. Most often, the cross-compilers have an environment-setup shell script or similar. This sets the environment variables needed for cross-compiling.

        You can either source this script in a shell before starting Qt Creator, or put the (expanded) variables in Qt Creators Kit settings (which I prefer). Then it is easily possible to switch between Desktop and embedded target.

        Regards

        vikramgV Offline
        vikramgV Offline
        vikramg
        wrote on last edited by
        #3

        @aha_1980 Can you elaborate on this env-setup script? What does it contain? I am using the cross compiler from Linaro here: https://releases.linaro.org/components/toolchain/binaries/latest-7/armv8l-linux-gnueabihf. That tarball just has the x86-64 cross-executables, and ARM libraries and headers. No env setup script of any sort. Is there documentation for what env variables are read by QtCreator for cross compilation?

        I am able to switch kits right now and build at will for Desktop and embedded; the only hiccup is that QtCreator seemingly does not pick the compiler from the kit for the embedded target, so I have to hardcode it in the .pro file.

        aha_1980A 1 Reply Last reply
        0
        • vikramgV vikramg

          @aha_1980 Can you elaborate on this env-setup script? What does it contain? I am using the cross compiler from Linaro here: https://releases.linaro.org/components/toolchain/binaries/latest-7/armv8l-linux-gnueabihf. That tarball just has the x86-64 cross-executables, and ARM libraries and headers. No env setup script of any sort. Is there documentation for what env variables are read by QtCreator for cross compilation?

          I am able to switch kits right now and build at will for Desktop and embedded; the only hiccup is that QtCreator seemingly does not pick the compiler from the kit for the embedded target, so I have to hardcode it in the .pro file.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @vikramg I don't have access to my machine right now, but if you say it works with the variables you changed in the pro file, I'd say setting the CC and CXX env variables could already work.

          I'm using the Yocto SDK, and there much more env variables are set in the script.

          Regards

          Qt has to stay free or it will die.

          vikramgV 1 Reply Last reply
          0
          • aha_1980A aha_1980

            @vikramg I don't have access to my machine right now, but if you say it works with the variables you changed in the pro file, I'd say setting the CC and CXX env variables could already work.

            I'm using the Yocto SDK, and there much more env variables are set in the script.

            Regards

            vikramgV Offline
            vikramgV Offline
            vikramg
            wrote on last edited by
            #5

            @aha_1980 Hmm, but that is no more advantageous than having the variables in the pro file. It is still baffling as to why QtCreator would ignore the compiler set in the Kit. Ideally I would like to have multiple cross-compilers configured, and be able to switch between them by selecting the desired one in the Compiler dropdown in the Kit configuration.

            kitconfig.png

            aha_1980A 1 Reply Last reply
            0
            • vikramgV vikramg

              @aha_1980 Hmm, but that is no more advantageous than having the variables in the pro file. It is still baffling as to why QtCreator would ignore the compiler set in the Kit. Ideally I would like to have multiple cross-compilers configured, and be able to switch between them by selecting the desired one in the Compiler dropdown in the Kit configuration.

              kitconfig.png

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @vikramg

              Hmm, but that is no more advantageous than having the variables in the pro file.

              It is, because you can change the kit for a project easily. if you hardcode in project, you can't.

              Cross-compiling has always been done by setting CC to the correct compiler. Creator does not build your project, make does. That's the reason thrse old habits still apply. And as I said, most often more variables need to be set.
              Regards

              Qt has to stay free or it will die.

              vikramgV 1 Reply Last reply
              0
              • aha_1980A aha_1980

                @vikramg

                Hmm, but that is no more advantageous than having the variables in the pro file.

                It is, because you can change the kit for a project easily. if you hardcode in project, you can't.

                Cross-compiling has always been done by setting CC to the correct compiler. Creator does not build your project, make does. That's the reason thrse old habits still apply. And as I said, most often more variables need to be set.
                Regards

                vikramgV Offline
                vikramgV Offline
                vikramg
                wrote on last edited by
                #7

                @aha_1980

                Cross-compiling has always been done by setting CC to the correct compiler. Creator does not build your project, make does. That's the reason thrse old habits still apply.

                Ah, I see. I still think QtCreator could set up the compiler-related env vars for you before launching the build, but I'll keep using the CC/CXX then.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved