• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help : Compiling for multiple architectures, is ppc970 valid ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help : Compiling for multiple architectures, is ppc970 valid ?


  • Subject: Re: Help : Compiling for multiple architectures, is ppc970 valid ?
  • From: Eric Albert <email@hidden>
  • Date: Thu, 13 Apr 2006 02:32:34 -0700

On Apr 13, 2006, at 2:16 AM, Peter wrote:

All the while I thought there can be 3 settings as in Apple's document, ppc, ppc64 and i386 at XCode Architectures settings. Recently I found out that about ppc970 setting at the end of an XCode compile session.

setenv VALID_ARCHS "m68k i386 sparc hppa ppc ppc7400 ppc970 ppc64"

My intention is to build 3 binaries into 1, that is generic PowerPC, PowerPC G5 and Intel. All binaries are targeted for 32 bit. Since there is no additional documentations, I hope some one can answer my questions,

1) is ppc970 setting valid under XCode 2.1 ?

Yes, though it isn't supported very well. (See the answer to the next question for the answer you're probably looking for here.) Note that some of the architectures in that list are not supported at all.


From the Xcode 2.2.1 tools, which are similar to Xcode 2.1 as far as ppc970 support:

Erics-MacBook-Pro:~> gcc -Wall -arch ppc970 -g -o test test.c
Erics-MacBook-Pro:~> otool -hv test
test:
Mach header
magic cputype cpusubtype filetype ncmds sizeofcmds flags
MH_MAGIC PPC ppc970 EXECUTE 10 1348 NOUNDEFS DYLDLINK TWOLEVEL
Erics-MacBook-Pro:~> file test
test: Mach-O executable ppc
Erics-MacBook-Pro:~>


2) I would like to put extra settings for compiling G5 code,

 -mcpu=970 -mpowerpc64 -mpowerpc-gpopt -force_cpusubtype_ALL -DCPUG5

where can I put this settings or it is obsolete ?

That's obsolete. The architecture name you want is 'ppc64'. 'ppc970' gives you a 32-bit G5-specific binary.


Erics-MacBook-Pro:~> gcc -Wall -arch ppc64 -g -o test test.c
Erics-MacBook-Pro:~> file test
test: Mach-O 64-bit executable ppc64
Erics-MacBook-Pro:~>

3) When the binary is launch, how does the program process knows which binary it is running (ppc, ppc970 or i386) ?
I want to put a text on the about box showing which binary it is running.

Do something like this in your code: const char *arch; #if __i386__ arch = "Intel"; #elif __ppc__ arch = "PowerPC"; #elif __ppc64__ arch = "PowerPC 64"; #else #error Unknown architecture #endif

The only ppc64 libraries in the system are libSystem and the Accelerate framework, so if you're running ppc64 code you can't have an about box. :)

4) Does this means I can only use 10.4 sdk (not 10.3.9 or lower) and final binary must run on OS 10.4.x ?

You must use the 10.4 SDK for ppc64 or i386 support. However, Xcode supports per-architecture SDKs, so you can use the 10.3.9 or 10.2.8 SDK for ppc if you'd like.


Hope this helps,
Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Help : Compiling for multiple architectures, is ppc970 valid ?
      • From: Paul Russell <email@hidden>
References: 
 >Help : Compiling for multiple architectures, is ppc970 valid ? (From: Peter <email@hidden>)

  • Prev by Date: Help : Compiling for multiple architectures, is ppc970 valid ?
  • Next by Date: Re: Link errors
  • Previous by thread: Help : Compiling for multiple architectures, is ppc970 valid ?
  • Next by thread: Re: Help : Compiling for multiple architectures, is ppc970 valid ?
  • Index(es):
    • Date
    • Thread