title: How do I add PPC/PPC64 support back to Xcode 4.2 under Lion?
body: <p>I have a Lion (10.7.1) system on which I installed Xcode 4.2. Suppose I have a simple C program <code>helloWorld.c</code> as follows:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main() {
    printf("hello, world\n");
  }
  </code></pre>
  
  <p>Using this setup, I would like to try to compile <code>helloWorld.c</code> for use on PPC and PPC64 architectures, <em>e.g.</em>:</p>
  
  <pre><code>$ gcc -arch ppc helloWorld.c -o helloWorld
  </code></pre>
  
  <p>This gives the following error message:</p>
  
  <pre><code>llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
  </code></pre>
  
  <p>How do I restore support for PowerPC to my Xcode 4 installation? </p>
  
  <p>I have tried the instructions outlined in <a href="https://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4">this previous Stack Overflow post</a>, but these instructions do not work for my Lion installation. </p>
  
  <p>I am using the <a href="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792" rel="nofollow noreferrer">Xcode 3.2.6 installer located on Apple's dev site</a>.</p>
  
  <p>From the symbolic links, I suspect those instructions work for a 10.6 installation, but not 10.7. </p>
  
  <p>In any case, some of the source files and directories from the Xcode 3.2.6 installation do not exist to make symbolic links from, or are located elsewhere in the Xcode 3 install. (For example, there is no <code>/Xcode3/usr/bin</code> directory from which to link the <code>as</code> binary.)</p>
  
  <p>Has anyone had luck with compiling PPC and PPC64 binaries from a Lion system?</p>
  
  <p><strong>To be awarded the bounty, please write a reasonably detailed answer. For myself, but also for posterity. :)</strong></p>
  
  <p><strong>EDIT - 31 Aug 2011</strong></p>
  
  <p>So I tried the modifications that Laurent pointed to and got further along, but this was not enough to get PPC support working. </p>
  
  <p>I added symbolic links to try to help <code>gcc</code> along in finding the resources it needs:</p>
  
  <pre><code>$ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 
  $ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2
  $ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2 
  $ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-g++-4.2
  </code></pre>
  
  <p>When I tried to compile my test app, I get a lot of errors:</p>
  
  <pre><code>$ gcc -arch ppc helloWorld.c -o helloWorld
  powerpc-apple-darwin11-llvm-gcc-4.2: 2: No such file or directory
  In file included from /usr/include/stdio.h:64,
                   from helloWorld.c:1:
  /usr/include/sys/cdefs.h:540:4: error: #error Unknown architecture
  In file included from /usr/include/sys/_types.h:33,
                   from /usr/include/_types.h:27,
                   from /usr/include/stdio.h:67,
                   from helloWorld.c:1:
  /usr/include/machine/_types.h:36:2: error: #error architecture not supported
  In file included from /usr/include/_types.h:27,
                   from /usr/include/stdio.h:67,
                   from helloWorld.c:1:
  /usr/include/sys/_types.h:94: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_blkcnt_t’
  /usr/include/sys/_types.h:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_blksize_t’
  /usr/include/sys/_types.h:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_dev_t’
  /usr/include/sys/_types.h:99: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_gid_t’
  /usr/include/sys/_types.h:100: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_id_t’
  /usr/include/sys/_types.h:101: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_ino64_t’
  /usr/include/sys/_types.h:103: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_ino_t’
  /usr/include/sys/_types.h:107: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mach_port_name_t’
  /usr/include/sys/_types.h:108: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mach_port_t’
  /usr/include/sys/_types.h:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mode_t’
  /usr/include/sys/_types.h:110: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_off_t’
  /usr/include/sys/_types.h:111: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_pid_t’
  /usr/include/sys/_types.h:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_sigset_t’
  /usr/include/sys/_types.h:132: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_suseconds_t’
  /usr/include/sys/_types.h:133: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_uid_t’
  /usr/include/sys/_types.h:134: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_useconds_t’
  ...
  /usr/include/secure/_stdio.h:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__DARWIN_LDBL_COMPAT’
  /usr/include/secure/_stdio.h:67: error: expected declaration specifiers or ‘...’ before ‘size_t’
  /usr/include/secure/_stdio.h:67: error: expected declaration specifiers or ‘...’ before ‘size_t’
  /usr/include/secure/_stdio.h:68: error: expected declaration specifiers or ‘...’ before ‘va_list’
  /usr/include/secure/_stdio.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__DARWIN_LDBL_COMPAT’
  helloWorld.c:3: error: expected declaration specifiers before ‘main’
  helloWorld.c:5: error: old-style parameter declarations in prototyped function definition
  /usr/include/stdio.h:252: error: parameter name omitted
  /usr/include/stdio.h:252: error: parameter name omitted
  helloWorld.c:5: error: expected ‘{’ at end of input
  </code></pre>
  
  <p>Perhaps there compilation options I should add to point to Xcode3 headers, but I'm looking in <code>/Xcode3/usr/include</code> and there's not really much there.</p>