[Solved] How to switch architecture from 32bit to 64bit for gcc4.4



  • I installed gcc4.4 by fink and added it with both ABIs (x86 32bit and 64bit)into Tool Chains,
    "screen shot":http://cl.ly/1Y2j2S0v1r39461l2a0a
    switched Tool chain into gcc4.4 abi: x86-macros-generic-mach-o-64bit,
    "screen shot":http://cl.ly/1r1u1Z1j2N3t3m1C1c1X

    and added

    @QMAKE_CC = gcc-4
    QMAKE_CXX = g++-4
    QMAKE_LINK = g++-4
    QMAKE_CXXFLAGS += -std=c++0x
    @
    into my .prj file

    but the linker shows an error
    @ld: symbol(s) not found for architecture i386@

    And I think it is because my gcc4.4 is still compiling codes to 32bit binary and it shows the error.
    Because my project uses some dylibs that are compiled for 64bit only, it should be compiled with 64bit option.

    Is there any more thing that I should do to be compiled with 64bit mode?

    I'm trying to do this on Mac OS X.
    Thank you.


  • Moderators

    Which mkspec do you end up using?

    With Qt Creator 2.2.x uses tool chains only to track what tools to use and does not automatically switch the mkspecs when changing the compiler. So you might still be using the 32bit mkspec.

    Qt Creator 2.3 does switch the mkspecs if it knows which ones to use.



  • Thank you Tobias,
    My Qt Creator is 2.2.1.
    I switched mkspecs and now the gcc 4.4 doesn't accept 64 bit arch option..

    @
    :-1: error: unrecognized option '-Xarch_x86_64'
    @

    I think the -Xarch_x86_64 flag does not work on GNU gcc compiler but Apple's.
    I should modify more makespec file but I don't know how.


  • Moderators

    What kind of system are you targeting?

    If you are targeting a linux system: Have you tried to use the 64bit linux g++ mkspec?



  • [quote author="Tobias Hunger" date="1311528408"]What kind of system are you targeting?

    If you are targeting a linux system: Have you tried to use the 64bit linux g++ mkspec?[/quote]

    It's Mac OSX 10.6.
    I've just succeeded to compile my codes.
    I made a new mkspecs named mac-g++-4 form existing mac-g++ and modified few lines by switching -arch x86_64 and -XArch_x86_64 into -m64

    @
    QMAKE_CFLAGS_X86_64 += -m64 -mmacosx-version-min=10.5
    QMAKE_OBJECTIVE_CFLAGS_X86_64 += -m64 -mmacosx-version-min=10.5
    ....
    QMAKE_CXXFLAGS_X86_64 += -m64 -mmacosx-version-min=10.5
    QMAKE_CXXFLAGS_X86 += -m32
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.