Qt Creator + Qt 4.7.3 on Mac OS 10.6 - always builds x86_64, but I need 32 bit.
-
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.
-
Sorry, I forgot an argument, it's actually:
@
lipo -info /Developer/Applications/Qt/Desktop/Qt/474/gcc/lib/QtGui.framework
@ -
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$@
-
@
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.
-
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.
-
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.
-
when you say my "configure call," what are you talking about - the lipo command? I should only have to do that once, right?
-
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.
-
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.
-
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 :-)
-
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.
-
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).
-
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.
-
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_RELEASEAlthough, 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.
-
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?
-
Yep, everything qmake related goes into the .pro.
Regarding the 32bit switch, yep - you need you own Qt build to support this.