Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] qmake 3.0 using wrong compiler on Mac OS 10.9.5
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qmake 3.0 using wrong compiler on Mac OS 10.9.5

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 6.2k 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.
  • K Offline
    K Offline
    koplersky
    wrote on last edited by
    #1

    I have a project set up to use clang from /usr/bin. I checked the compilers, the kits and the .pro.user file and it's using the correct compiler. But when I try to compile the code generated by qmake from Qt 5.4 (version 3.0), it uses the iOS compiler.

    When trying to compile using qmake from Qt 4.8 (version 2.01a), it uses the correct compiler and everything works fine.
    I noticed the problem because I was integrating Sparkle into my application and it was not finding the framework. The project now has some Objective-C++ code, but I don't think that's a problem, otherwise qmake 2.0a would also have switched to another compiler.

    This problem happens whether I run qmake 3.0 from Qt Creator or the command line. Either way a Makefile with wrong compiler paths is generated.

    The compiler variables in the Makefile generated by qmake 2.01 are as follow:
    @
    CC = clang
    CXX = clang++
    @

    The ones in the Makefile generated by qmake 3.0 are:
    @
    CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
    @

    Is this a normal behavior?
    I appreciate any advice on this.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on last edited by
      #2

      You can find out what your setup is from qmake by running the command qmake -query (or 'qmake -query QMAKE_SPEC' if you want to only look at the spec setup):

      @
      bash-3.2$ qmake -query
      QT_SYSROOT:
      ...
      QMAKE_SPEC:macx-clang
      QMAKE_XSPEC:macx-clang
      QMAKE_VERSION:3.0
      QT_VERSION:5.4.0
      @

      I remove some of the output.

      My setup is almost identical to what you have except I am running on Yosemite. It does work.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        AFAIK, yes it is. You could also be using another self-built clang so a full path ensure that you are using the version you configured for

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koplersky
          wrote on last edited by
          #4

          Thank you for the answers.
          My QMAKE_SPEC variable is set to the same as yours, Rondog, but qmake still calls the wrong compiler.

          The generated stash file is the following:

          @
          QMAKE_XCODE_DEVELOPER_PATH = /Applications/Xcode.app/Contents/Developer
          QMAKE_XCODE_VERSION = 6.1.1
          QMAKE_MAC_SDK.macosx.path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_FIX_RPATH =
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool
          -id
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_AR =
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
          cq
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_RANLIB =
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib
          -s
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
          QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK_SHLIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
          QMAKE_MAC_SDK.macosx.platform_name = macosx
          @

          The qmake set in my PATH variable is the 2.01a, installed through Homebrew (for this the query outputs "Unknown").
          SGaist, to set the full path, should I manually edit the .conf files?

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rondog
            wrote on last edited by
            #5

            On my system the compiler target is x86_64. I assume on your system it is reporting IOS ...

            Running g++ -v command:
            @
            iMac:$ g++ -v
            Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
            Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
            Target: x86_64-apple-darwin14.0.0
            Thread model: posix
            @

            If your output is the same, and qmake is reporting the same setup (I checked one of my qstash files, it is the same) then you must have QtCreator setup somehow to target IOS devices(?). If this is true you should be able to create a new make file and compile from the terminal window and end up with proper target program.

            I don't use QtCreator too often but I do remember a section where you can select different compilers for targeting different platforms.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koplersky
              wrote on last edited by
              #6

              The output here is the same, only the darwin version is different (x86_64-apple-darwin13.4.0). I thought that Qt Creator might be setting things wrong but I doubled checked everything and it's correctly setting it to the Desktop kit.

              But I don't think that's the problem because if I run qmake from the command line it generates the same Makefile.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rondog
                wrote on last edited by
                #7

                I can only assume that when you run qmake it assumes your makespec is 'macx-ios-clang'. Not sure where it is getting that from.

                You can specify a makespec when you run qmake. The first one should be the one you need (the second if you use XCode for the IDE).

                @
                qmake -spec macx-clang
                qmake -spec macx-xcode
                @

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  koplersky
                  wrote on last edited by
                  #8

                  Thanks Rondog, but that didn't work either.
                  I've solved this by setting the full compiler path in the clang.conf file (included by the qmake.conf file from the macx-clang folder), as mentioned by SGaist.

                  But many thanks for your time!

                  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