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. Change compiler in Qt Creator on Mac OS X
Forum Update on Tuesday, May 27th 2025

Change compiler in Qt Creator on Mac OS X

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 3 Posters 7.8k 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.
  • B Offline
    B Offline
    berlem
    wrote on 9 Oct 2013, 09:27 last edited by
    #1

    I want to switch to the latest version of gcc and use it in Qt Creator.

    • I followed the standard online installation of Qt 5.1.1 for Mac (installed in /Applications/Qt)
    • Latest version of gcc has been installed using "Fink":http://fink.thetis.ig42.org (gcc 4.8.1)
    • In Qt Creator, I added a new Kit, pointing to the new compiler (located in /sw/bin/gcc-4) and the installed Qt version (Qt 5.1.1 clang 64bit).

    Everything looks good config-wise but when I want to compile my project, Qt Creator uses another compiler instead of the specified one:

    /Applications/Xcode.app/Contents/Developer/usr/bin/g++

    which corresponds to the one shipped with Xcode (llvm-g++-4.2)

    Did I miss something?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hardcodes.de
      wrote on 10 Oct 2013, 08:37 last edited by
      #2

      Does your project use the new kit?

      Just out of curiosity: why don't you want the clang compiler?

      while(!sleep){++sheep;}

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sierdzio
        Moderators
        wrote on 10 Oct 2013, 09:01 last edited by
        #3

        You are either not using the right kit, or maybe you need to modify the mkspecs for Qt.

        (Z(:^

        1 Reply Last reply
        0
        • B Offline
          B Offline
          berlem
          wrote on 10 Oct 2013, 09:06 last edited by
          #4

          Yes, I switched to the new kit before building the project. The compile output is different from the one generated by the clang-based kit but I still don't understand why the new kit doesn't use /sw/bin/gcc-4.

          • compile output with clang based kit:

          @/Applications/Qt/5.1.1/clang_64/bin/uic /Users/sylvain/Documents/Work/Dev/Qt\ projects/UITest1/mainwindow.ui -o ui_mainwindow.h
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -Wall -W -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Applications/Qt/5.1.1/clang_64/mkspecs/macx-clang -I/Users/sylvain/Documents/Work/Dev/Qt\ projects/UITest1 -I/Applications/Qt/5.1.1/clang_64/include -I/Applications/Qt/5.1.1/clang_64/include/QtWidgets -I/Applications/Qt/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I/Applications/Qt/5.1.1/clang_64/include/QtGui -I/Applications/Qt/5.1.1/clang_64/lib/QtGui.framework/Versions/5/Headers -I/Applications/Qt/5.1.1/clang_64/include/QtCore -I/Applications/Qt/5.1.1/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I. -F/Applications/Qt/5.1.1/clang_64/lib -o main.o /Users/sylvain/Documents/Work/Dev/Qt\ projects/UITest1/main.cpp@

          • compile output for gcc-4 based kit:

          @/Applications/Qt/5.1.1/clang_64/bin/uic /Users/sylvain/Documents/Work/Dev/Qt\ projects/UITest1/mainwindow.ui -o ui_mainwindow.h
          /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -c -pipe -g -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.6 -Wall -W -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Applications/Qt/5.1.1/clang_64/mkspecs/macx-g++ -I/Users/sylvain/Documents/Work/Dev/Qt\ projects/UITest1 -I/Applications/Qt/5.1.1/clang_64/include -I/Applications/Qt/5.1.1/clang_64/include/QtWidgets -I/Applications/Qt/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I/Applications/Qt/5.1.1/clang_64/include/QtGui -I/Applications/Qt/5.1.1/clang_64/lib/QtGui.framework/Versions/5/Headers -I/Applications/Qt/5.1.1/clang_64/include/QtCore -I/Applications/Qt/5.1.1/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I. -F/Applications/Qt/5.1.1/clang_64/lib -o main.o /Users/sylvain/Documents/Work/Dev/Qt\ projects/UITest1/main.cpp@

          How do I modify the mkspecs for Qt?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 10 Oct 2013, 09:13 last edited by
            #5

            Qt has a folder named "mkspecs" somewhere, you go there and look for a toolkit similar to yours (like macx-g++), copy it, then open the files inside (they are simple Makefiles) and update the commands to point to the compiler you want to use.

            I am compiling Qt myself, so this is all easy, I don't know where does the binary installer put that directory.

            (Z(:^

            1 Reply Last reply
            0
            • B Offline
              B Offline
              berlem
              wrote on 10 Oct 2013, 09:31 last edited by
              #6

              Thanks sierdzio. I've located mkspecs folder, which is in /Applications/Qt/clang_64.

              This is where I'm getting confused about the role of these subfolders. I though specifying the compiler in the Qt build & run tab was enough to tell Qt how to build the project. How these mkspecs files are used in the build process?

              I guess in my case, Qt is switching to the 'unsupported' config, as the one associated with my new toolchain is not present, isn't it?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sierdzio
                Moderators
                wrote on 10 Oct 2013, 10:10 last edited by
                #7

                Normally, Qt Creator should override the default setup and use whatever you have specified in your Kits. Since you are suing a custom compiler, however, I think it might be causing problems. I don't really know, though. It should work.

                mkspecs are normally used when building from command line.

                (Z(:^

                1 Reply Last reply
                0

                1/7

                9 Oct 2013, 09:27

                • Login

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