July 24, 2011

augiekim augiekim
Lab Rat
24 posts

[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 [cl.ly]
switched Tool chain into gcc4.4 abi: x86-macros-generic-mach-o-64bit,
screen shot [cl.ly]

and added

  1. QMAKE_CC = gcc-4
  2. QMAKE_CXX = g++-4
  3. QMAKE_LINK = g++-4
  4. QMAKE_CXXFLAGS += -std=c++0x

into my .prj file

but the linker shows an error

  1. 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.

4 replies

July 24, 2011

Tobias Hunger Tobias Hunger
Mad Scientist
3132 posts

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.

July 24, 2011

augiekim augiekim
Lab Rat
24 posts

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. :-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.

July 24, 2011

Tobias Hunger Tobias Hunger
Mad Scientist
3132 posts

What kind of system are you targeting?

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

July 25, 2011

augiekim augiekim
Lab Rat
24 posts

Tobias Hunger wrote:
What kind of system are you targeting?

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

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

  1. QMAKE_CFLAGS_X86_64     += -m64 -mmacosx-version-min=10.5
  2. QMAKE_OBJECTIVE_CFLAGS_X86_64  += -m64 -mmacosx-version-min=10.5
  3. ....
  4. QMAKE_CXXFLAGS_X86_64   += -m64  -mmacosx-version-min=10.5
  5. QMAKE_CXXFLAGS_X86      += -m32

 
  ‹‹ How to display Widgets in the midle of a Window      how to use C code in qt? ››

You must log in to post a reply. Not a member yet? Register here!