Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt Creator + Qt 4.7.3 on Mac OS 10.6 - always builds x86_64, but I need 32 bit.

Qt Creator + Qt 4.7.3 on Mac OS 10.6 - always builds x86_64, but I need 32 bit.

Scheduled Pinned Locked Moved Installation and Deployment
33 Posts 6 Posters 26.4k Views
  • 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.
  • W Offline
    W Offline
    Will49
    wrote on last edited by
    #1

    I'm compiling my Qt app on Mac OS 10.6.8 with the latest Qt Creator (2.2.1) and Qt 4.7.3 installed from the Online Installer.

    When I compile my app that uses some 3rd party libraries built for x86 and PPC in Qt Creator, I get "missing required architecture x86_64 in file...." errors. So obviously it is compiling for 64 bits - which I don't need.

    In my .pro file I have:
    Qt Code:

    CONFIG -= x86_64
    CONFIG +=x86 ppc
    

    Which I understand will tell the compiler to not build for 64 bits.

    When I look at the "Build Settings" for my project I notice:
    "Qt version" is "Desktop Qt 4.7.3 for GCC (Qt SDK)" and is grayed out.
    "Tool chain" is "GCC (x86 64bit)" and also grayed out.

    I'm not sure why only 64 bit compiles are available. Should I be able to select to use 32 bits in the "Build Settings"?

    Also shouldn't my settings in the .pro file remove the 64 bit build, and add x86 32 bit and PCC?

    I don't remember seeing any options during the Qt install to select the defaults.

    How can I tell Qt Creator to only build for 32 bit x86 and PPC?

    Thanks

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I won't say for sure, especially since I don't use Mac OS, but probably the libraries you link against are 64bit (that's the case in Linux anyway). So, in order to compile x86, you'll have to compile Qt in x86, or use the source files instead of the lib. Mind you, I might be wrong, I myself am happy with x86_64, and have not actually tried compiling for other architectures. Also, this might be some special case of Mac that I'm not aware of.

      (Z(:^

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        The Qt version being greyed out shows that you only have that one available for the target you develop for. So the first thing is which ABIs does it support? Please check in Tools->Options->Qt versions and hover the Qt version in question. Check the tooltip for information on the supported ABIs. If there is no 32bit version there, then you will need to install a Qt that actually was compiled for a 32bit environment.

        If that lists 32bit, then you might not be able to build a 32bit version because Qt Creator did not find any 32bit tool chain on your system: Please check in Tools->Options->Tool chains and make sure you have tool chains defined for all ABIs of the Qt version.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Will49
          wrote on last edited by
          #4

          Tobias
          I'm using Qt from the online installer for Mac OS.

          The Qt version tool tip shows:
          ABI: x86-macos-generic-mach_o-32bit
          ABI: ppc-macos-generic-mach_o-32bit

          On the Tool Chains panel it shows:
          Auto-Detected Auto-Detected
          GCC (x86 64bit) GCC
          GCC (x86 32bit) GCC
          GCC (ppc 64bit) GCC
          GCC (ppc 32bit) GCC
          Manual Manual

          So it looks like it has 32 bits in the tool chain - correct?

          Then why does it compile and link against 64 bit stuff? I get errors because some of the Carbon APIs I use aren't available in 64 bit. If I remove those temporarily, when it gets to linking it says that my external frameworks are missing 64bit architecture (which I know - but I don't want a 64 bit app anyway).

          1 Reply Last reply
          0
          • W Offline
            W Offline
            Will49
            wrote on last edited by
            #5

            Here is some output from the compile window, which seems to prove the compiler is being directed to make a 64 bit version:

            g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -arch ppc -arch i386 -Wall -W -isysroot /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../../QtSDK/Desktop/Qt/473/gcc/mkspecs/macx-g++ -I../

            I see there are multiple -arch parameters there. So where are the "-arch x86_64 -Xarch_x86_64" coming from? In my pro file I have :
            CONFIG -= x86_64
            CONFIG +=x86 ppc

            I've also tried with just:
            CONFIG +=x86 ppc

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tobias.hunger
              wrote on last edited by
              #6

              Looks like we are having trouble to pick the correct mkspec. As a workaround you can specify the mkspec you want via the qmake build step widget (Projects->Build Settings, somewhere in the middle of the page). I am not sure there actually is one available to build for 32bit PPC on Mac though.

              Please "file a bug report":http://bugreports.qt.nokia.com/ if you find one:-)

              1 Reply Last reply
              0
              • W Offline
                W Offline
                Will49
                wrote on last edited by
                #7

                OK I filed a bug report:

                https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5949

                Sorry but I'm not quite sure how I would specify the mkspec to not tell the compiler to use "-arch x86_64 -Xarch_x86_64".

                FYI - I have Xcode 3.2.6 installed and it will compile my app OK as 32 bit only when creating an XCode project from the .pro file.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  You can add to your .pro file:

                  @
                  CONFIG -= x86_64 ppc64
                  CONFIG += x86 ppc
                  @

                  The first line removes the 64bit targets that may have been added by the qmake build system. The second line ensures that the 32bit version for Intel and PPC processors are built.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    Will49
                    wrote on last edited by
                    #9

                    That didn't work. I did a clean and rebuild of my app but I still see "-arch x86_64 -Xarch_x86_64" in the compile output. It's like it is totally ignoring it.

                    The following may be useful:

                    If in Qt Creator I go to the Build Settings, General and change the "Qt Version" from "Desktop Qt 4.7.3 for CGG (SDK)" to "Qt in PATH", then do a clean rebuild of my app I no longer get any of the x64 stuff included.

                    Does that mean something is messed up with my Qt install?

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #10

                      I don't know for sure, I never installed Qt from the SDK, but it may be that the SDK only delivers universal binaries containing intel code and/or containing only 64bit code. You can check yourself with

                      @
                      lipo -info /path/to/your/SDK/libs/QtGui.framework/QtGui
                      @

                      The output will containt i386 and ppc7400 for Intel and PPC 32bit, and x86_64 for Intel 64bit.

                      Also, make sure that the command line for qmake in the build settings pane, does not contain any arch related stuff, as this can override the settings in the .pro file.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tobias.hunger
                        wrote on last edited by
                        #11

                        Are you sure the tooltip is from the Qt version you used to build? The one you caim to be using is 64bit only when I check it on the mac.

                        Please update the bug report with this information. Thanks!

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          michkol
                          wrote on last edited by
                          #12

                          I had the same problem. My solution was to download Qt source and compile it both for i386 and x86_64.

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            tobias.hunger
                            wrote on last edited by
                            #13

                            michkol: Are you building that as a fat binary or as two separate binaries?

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              michkol
                              wrote on last edited by
                              #14

                              I compiled it as a fat library. As someone said, the shipped binaries come as a 64 version only. When built from scratch, you can choose your compiler.

                              1 Reply Last reply
                              0
                              • mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on last edited by
                                #15

                                I just stumbled across this problem myself, though I don't fully understand it.

                                I'm running Creator 2.3.0, based on Qt 4.7.4 (64 bit).

                                So, do I understand correctly that I can't control which GCC the build process uses? In Preferences -> Tool Chains, I have Auto-detected entries for both 64 and 32 bit (as well as some PPC entries which I should probably get rid of). 64 is listed first, so I assumed that's why I was getting 64-bit integers in my code. Not so?

                                Thanks.

                                1 Reply Last reply
                                0
                                • G Offline
                                  G Offline
                                  goetz
                                  wrote on last edited by
                                  #16

                                  The toolchain on the Mac is a single one (although Creatore reports at least two). You have only one gcc (per version, you have gcc-4.0 and gcc-4.2 of course). This gcc can produce object code for Intel and PowerPC and for 32 and 64 bit, make four architectures altogether.

                                  BUT: You cannot create an object file containing, let's say 32 and 64 bit Intel code, in case your Qt libs only contains 64 bit Intel code. In the end, the linker would complain that some code is missing.

                                  I never used the prebuilt binaries or SDKs for the Mac myself, so I cannot tell you what's inside. You can find out yourself:

                                  @
                                  lipo /path/to/your/Qt/lib/QtGui.framework/QtGui
                                  @

                                  It should print something like: Architectures in the fat file: /usr/local/Trolltech/Qt-4.7.3/lib/QtGui.framework/QtGui are: i386 ppc7400 - the architectures listed differ, of course :-)

                                  By manipulating the CONFIG variable you control for which architectures code will be built.

                                  http://www.catb.org/~esr/faqs/smart-questions.html

                                  1 Reply Last reply
                                  0
                                  • mzimmersM Offline
                                    mzimmersM Offline
                                    mzimmers
                                    wrote on last edited by
                                    #17

                                    OK, this might sound like an incredibly dumb question, but...how do I determine the path to my library? I've got so many Qt files and folders all over the place, I'm not sure which is which.

                                    Thanks.

                                    EDIT:

                                    I don't know if this information is any help, but...

                                    !http://scopedin.com/images/qttoolchains.jpg(tool chains)!

                                    !http://scopedin.com/images/qtversions.jpg(versions)!

                                    I also have a 4.7.3 version on my system. When I deleted it, the debugger didn't work right, so I put it back. It seems that I have some unnecessary stuff floating around...I'd like to get rid of it if possible.

                                    1 Reply Last reply
                                    0
                                    • mzimmersM Offline
                                      mzimmersM Offline
                                      mzimmers
                                      wrote on last edited by
                                      #18

                                      Hi, Volker -

                                      I found a directory that may be the one I want use for the lipo command, but I get an error:

                                      bq. Macintosh-d49a20f3c0dc:~ mzimmers$ lipo /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework
                                      lipo: one of -create, -thin <arch_type>, -extract <arch_type>, -remove <arch_type>, -replace <arch_type> <file_name>, -verify_arch <arch_type> ... , -info or -detailed_info must be specified
                                      lipo: Usage: lipo [input_file] ... [-arch <arch_type> input_file] ... [-info] [-detailed_info] [-output output_file] [-create] [-arch_blank <arch_type>] [-thin <arch_type>] [-remove <arch_type>] ... [-extract <arch_type>] ... [-extract_family <arch_type>] ... [-verify_arch <arch_type> ...] [-replace <arch_type> <file_name>] ...

                                      Does lipo need an argument?

                                      Thanks.

                                      1 Reply Last reply
                                      0
                                      • G Offline
                                        G Offline
                                        goetz
                                        wrote on last edited by
                                        #19

                                        Sorry, I forgot an argument, it's actually:

                                        @
                                        lipo -info /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework
                                        @

                                        http://www.catb.org/~esr/faqs/smart-questions.html

                                        1 Reply Last reply
                                        0
                                        • mzimmersM Offline
                                          mzimmersM Offline
                                          mzimmers
                                          wrote on last edited by
                                          #20

                                          Hi, Volker. Now I get this:

                                          @Macintosh-d49a20f3c0dc:~ mzimmers$ lipo -info /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework
                                          lipo: Can't map input file: /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework (Invalid argument)
                                          Macintosh-d49a20f3c0dc:~ mzimmers$

                                          @

                                          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