PDA

View Full Version : Issues with 32/64 bit compiling with XCode on Snow Leopard



fabietto
28th April 2010, 02:22
Hi everyone,

I just came across an issue that took me a while in order to be figured out. I haven't found a definitive solution yet, so I'd like to hear your opinions about that.

As a Qt user primarily working on Mac OS environments, I use Xcode as IDE. Most of the times I start from a .pro file and then I create an Xcode project via QMake (qmake -spec macx-xcode). Since I recently bought a new laptop - powered by an Intel i5 processor - I started investigating the issues related to compile applications against 32 or 64 bit architectures. I found out that, using QMake, is possible to pass specific values (namely x86 and x86_64) to the CONFIG variable in order to instruct Xcode about the architecture to compile against. If I use only one of these parameters (i.e., x86), Xcode just allows me to compile against that architecture. The same if I select the alternative parameter (i.e., x86_64). As far as I tell XCode where the proper libraries are located, everything work fine. Fair play.

The problem arises when I attempt to use both the variables at the same time. In the latter scenario Xcode lets me choose - using the GUI - between the 32 and the 64 bit architectures. Unfortunately, in both cases it then compiles on 32 bit, regardless of my selection and leading to lots of linking errors. Looking at the logs generated by Xcode it's clear how it's attempting to compile on 32 bit (x86/i386) even if I select 64 bit (x86_64):


Ld build/MAVs3D_engine_B.build/Release/MAVs3D_engine_B.build/Objects-normal/i386/MAVs3D_engine_B normal i386
cd /Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D_engine_B
setenv MACOSX_DEPLOYMENT_TARGET 10.4
/Developer/usr/bin/g++-4.2 -arch i386 -L/Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D_engine_B/build/Release -L/Library/Frameworks -L/usr/local/lib -L/System/Library/Frameworks -F/Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D_engine_B/build/Release -filelist /Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D_engine_B/build/MAVs3D_engine_B.build/Release/MAVs3D_engine_B.build/Objects-normal/i386/MAVs3D_engine_B.LinkFileList -mmacosx-version-min=10.4 -headerpad_max_install_names -L/Library/Frameworks -F/Library/Frameworks -lnnfw -lIrrlicht -framework QtXml -framework QtOpenGL -framework QtGui -framework QtCore -framework OpenGL -framework AGL -o /Users/fruini/Documents/University/Plymouth/MAVs/3DSimulations/MAVs3D_engine_B/build/MAVs3D_engine_B.build/Release/MAVs3D_engine_B.build/Objects-normal/i386/MAVs3D_engine_B

ld: warning: in /usr/local/lib/libnnfw.a, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
...

Furthermore, Xcode tends to crash very often when I switch among the two alternatives.

I'm running Qt 4.6.2 (64bit) and Xcode 3.2.2 on Mac OS 10.6.3. Am I the only one experiencing this kind of issue?

Cheers,
Fabio