Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 5, 2012, 11:50 AM   #1
rabidz7
Banned
 
Join Date: Jun 2012
Location: Isla De Juventud, south Havana provence, Cincinnati Ohio
-arch

How do i choose the architecture I compile an app for? e.g. ppc, ppc64, i386, i386_64
rabidz7 is offline   0 Reply With Quote
Old Dec 5, 2012, 01:54 PM   #2
mfram
macrumors 6502a
 
Join Date: Jan 2010
In XCode, I assume, right? Under Project Target Settings.
mfram is offline   0 Reply With Quote
Old Dec 5, 2012, 03:24 PM   #3
rabidz7
Thread Starter
Banned
 
Join Date: Jun 2012
Location: Isla De Juventud, south Havana provence, Cincinnati Ohio
Command line tool

Quote:
Originally Posted by mfram View Post
In XCode, I assume, right? Under Project Target Settings.
How would I do this in the command line compiler.
rabidz7 is offline   0 Reply With Quote
Old Dec 5, 2012, 04:32 PM   #4
karter16
macrumors member
 
Join Date: Aug 2012
Location: Auckland, New Zealand
Quote:
Originally Posted by rabidz7 View Post
How would I do this in the command line compiler.
gcc -arch i386 program.c

for example
karter16 is offline   0 Reply With Quote
Old Dec 5, 2012, 04:37 PM   #5
rabidz7
Thread Starter
Banned
 
Join Date: Jun 2012
Location: Isla De Juventud, south Havana provence, Cincinnati Ohio
Explain

Quote:
Originally Posted by karter16 View Post
gcc -arch i386 program.c

for example
So, do I do this when i type ./configure or make?
rabidz7 is offline   0 Reply With Quote
Old Dec 5, 2012, 04:48 PM   #6
karter16
macrumors member
 
Join Date: Aug 2012
Location: Auckland, New Zealand
Quote:
Originally Posted by rabidz7 View Post
So, do I do this when i type ./configure or make?
Hmmm it's a bit difficult to say without knowing exactly what you are doing.

it might pay to do some background reading on gcc, option flags, makefiles, etc. but essentially -arch is an option for gcc, which is what compiles your source code.

You need to add -arch (and your chosen architecture) to the relevant gcc calls. Without knowing your setup this is probably in the configure file or possibly directly in the makefile (although I'm guessing the way you have things setup configure is building your makefile). Anyway, I'd suggest doing background reading on whatever your workflow is so that you understand each step of what is happening :-)

Cheers

----------

Starting with something like this could be useful :-)

http://www.eupcs.org/wiki/Introduction_To_Makefiles
karter16 is offline   0 Reply With Quote
Old Dec 5, 2012, 05:03 PM   #7
rabidz7
Thread Starter
Banned
 
Join Date: Jun 2012
Location: Isla De Juventud, south Havana provence, Cincinnati Ohio
clarification

Quote:
Originally Posted by karter16 View Post
Hmmm it's a bit difficult to say without knowing exactly what you are doing.

it might pay to do some background reading on gcc, option flags, makefiles, etc. but essentially -arch is an option for gcc, which is what compiles your source code.

You need to add -arch (and your chosen architecture) to the relevant gcc calls. Without knowing your setup this is probably in the configure file or possibly directly in the makefile (although I'm guessing the way you have things setup configure is building your makefile). Anyway, I'd suggest doing background reading on whatever your workflow is so that you understand each step of what is happening :-)

Cheers

----------

Starting with something like this could be useful :-)

http://www.eupcs.org/wiki/Introduction_To_Makefiles

A am compiling an app from source code on my macbook pro 2011. I first type ./configure then I type make.
rabidz7 is offline   0 Reply With Quote
Old Dec 5, 2012, 05:05 PM   #8
karter16
macrumors member
 
Join Date: Aug 2012
Location: Auckland, New Zealand
Quote:
Originally Posted by rabidz7 View Post
A am compiling an app from source code on my macbook pro 2011. I first type ./configure then I type make.
Yep - so you need to edit your makefile to contain the arch option when GCC is called.

I really, really recommend reading up on makefiles etc. so you understand what's going on :-)

Good luck!
karter16 is offline   1 Reply With Quote
Old Dec 5, 2012, 10:30 PM   #9
mfram
macrumors 6502a
 
Join Date: Jan 2010
Usually you'd say something like

Code:
./configure --help
It will tell you the options available. It might be something like:

Code:
./configure --with-cflags="-march=i386"
or something like that. Every package is different.
mfram is offline   0 Reply With Quote
Old Dec 9, 2012, 12:56 PM   #10
Madd the Sane
macrumors 6502
 
Join Date: Nov 2010
Location: Utah
One way to do it is with
Code:
./configure --with-cflags="-arch i386" --with-ldflags="-arch i386"
or with
Code:
CC="gcc -arch i386" ./configure
The arch flag is specific to Darwin/OS X/NeXTStep and won't work on other OSes.
Madd the Sane is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
app, architecture, compile, intel, ppc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:15 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC