Search code examples
macosqtmakefileqmake

qmake on OS X: disable x86/i386 arch (build only x86_64)


I'm trying to get qmake to produce a makefile which does not include -arch i386 in CFLAGS/LFLAGS and so far I'm not succeeding. I tried the following:

  • CONFIG-=x86
  • QMAKE_CFLAGS-="-arch i386"

and a couple of other variations. The only one that does work is removing x86.prf from mkspecs/features/mac but I don't think it's a proper solution.

The current commandline looks approximately like this:

qmake -makefile -nocache CONFIG-=release CONFIG+=Debug CONFIG+=mac 
 CONFIG+=CMDMAKE CONFIG-=x86 CONFIG+=x64 
 QMAKE_MAKEFILE=makefile_mac_Debugx64 QMAKE_LFLAGS="<...>"
 QMAKE_CXXFLAGS="<..>" QMAKE_CFLAGS="<...>" QTVER=4.8.4 project.pro

Solution

  • Tentative solution (need to verify a few things to confirm it, but seems to work):

    1) make a separate build of Qt for x64 only, i.e.:

    ./configure -platform macx-g++42 -arch x64 -debug-and-release <...>
    

    2) use qmake from that build to generate x64 makefiles.

    It apparently still needs CONFIG-=x86 but that looks to be enough to prevent stray -arch i386 in the generated makefiles.