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.
Forum Updated to NodeBB v4.3 + New Features

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.7k 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.
  • 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
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #21

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

                  the first one was a directory. Just cd into the to see what's in it.

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

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

                    OK, now we're getting somewhere:

                    @Macintosh-d49a20f3c0dc:~ mzimmers$ lipo -info /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework/QtGui
                    Non-fat file: /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework/QtGui is architecture: x86_64
                    Macintosh-d49a20f3c0dc:~ mzimmers$
                    @

                    So...where do I go from here? And, is there a way to be sure that this is indeed the path that Creator is using, since I seem to have a few versions hanging around?

                    Thanks.

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

                      Ok, that's what I suspected, but never could prove myself: The prebuilt Qt binaries from the SDK only contain code for Intel 64bit.

                      The only solution for a requirement that contains any 32bit support, is to build Qt manually. Make sure to add

                      @
                      -arch x86 -arch ppc
                      @

                      to your configure call (x86 = 32 bit Intel, ppc = 32 bit PowerPC). You might want to add

                      @
                      -arch x86_64
                      @

                      too, in case you need 64 bit Intel too.

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

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

                        when you say my "configure call," what are you talking about - the lipo command? I should only have to do that once, right?

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

                          Ahm, no. You will have to get the sources from the "download page":http://qt.nokia.com/downloads/downloads#qt-lib and do the usual configure, make, make install steps. See the "general installation guide":http://developer.qt.nokia.com/doc/qt-4.7/installation.html and the "Mac installation guide":http://developer.qt.nokia.com/doc/qt-4.7/install-mac.html for detailed instructions.

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

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

                            Thanks, Volker. I appreciate the help with this.

                            I don't think I'm ready to start building my own tools, though. The only reason this is of interest to me (at the moment) is that I recently realized that a version change of Qt seems to have altered my compiler's behavior a bit. Specifically, a "long" declaration used to give me a 32-bit value, but now gives me a 64-bit value. I think I'll just edit my program to replace all the longs with int32_ts. I need this code to work on Windows, too.

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

                              Ah, I see.

                              For the building: It's really not a big deal. The default settings of the configure script are sane, so you hardly need to change things. Once you get used to it, you like it :-)

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

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

                                Well, OK, maybe I'll try it. I imagine that I'll still have to go through my code and change the longs to int32_ts, though, won't I? Unless there's some compiler flag I can use that does this.

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

                                  That depends on your use case. An "upgrade" from 32 to 64 bit usually doesn't harm that much :-)

                                  I would recommend using qint32 or quint32 typedefs of Qt for this (there are 16 and 64 bit typedefs too).

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

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

                                    I don't think I want to use the Qt typedefs (at least not yet); there's a chance that I may need to develop this program outside of Qt. (I'm currently just using Creator as my IDE; not actually taking advantage of any Qt stuff yet.)

                                    I found the compiler option "-m32" which will do what I want, but...from what I've read earlier in this thread, I don't think this will work, because my build of Qt only contains libraries for 64-bit code, right?

                                    I'm trying to do this the "right" way. My code (though not necessarily the make information) will also have to run on a Windows OS eventually. What is your recommendation for the best way to tackle this issue?

                                    Oh: and if I did want to use that compiler option, where do I put that? I can't find a place in the preferences to put that.

                                    Thanks again for all the help.

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

                                      I never used the "-m32" option, so I cannot comment with proof on that. According to the docs, it generates 32bit code - and that would not link against the 64 bit Qt libs.

                                      That compiler option would have to be placed into

                                      QMAKE_CFLAGS_DEBUG
                                      QMAKE_CFLAGS_RELEASE
                                      QMAKE_CXXFLAGS_DEBUG
                                      QMAKE_CXXFLAGS_RELEASE

                                      Although, I would recommend the CONFIG and arch settings. I'm not sure if you can build fat binaries using -m32 at all.

                                      If you cannot rely on the Qt typedefs, then int32_t seems to be a good solution.

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

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

                                        OK...those flags you reference above -- they go in the .pro file, right? As would the CONFIG setting?

                                        And, if I'm following this thread correctly, the arch setting is only useful when I'm building my own binaries, since the default binary won't support 32-bit, right?

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

                                          Yep, everything qmake related goes into the .pro.

                                          Regarding the 32bit switch, yep - you need you own Qt build to support this.

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

                                          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