How can we restore ppc/ppc64 as well as full 10.4/10.5 SDK support to Xcode 4?

Since Apple only ships SDK 10.6 with Xcode4,
developing PPC applications with Xcode4 became impossible. While it is
possible to develop applications with Xcode4 that can also run on 10.5
and maybe even on 10.4 systems (by selecting SDK 10.6, but deployment
target 10.5 or 10.4), they will only run on Intel Macs because you need
at least SDK 10.5 for building PPC applications.

Further there are some rare cases, where you really need to build
against an SDK prior to 10.6 for full platform support, e.g. if certain
deprecated functionality has vanished completely from the 10.6 SDK, but
you’ll have to use it and dynamic linking is not always the best option
in those cases. Also linking against an earlier SDK sometimes will ease
development as functionality you are not supposed to use, as it would
cause incompatibility to earlier OS versions, won’t be available and any
attempt to use it anyhow immediately leads to compiler or linker

Last but not least Apple has also removed GCC 4.0 support from
Xcode4, which may be necessary for certain software to build correctly
and Apple has never allowed to compile software with GCC 4.2 when using
SDK 10.4, even though I hardly believe that this would really cause any
issues, after all software built with GCC 4.2 and SDK 10.6 can also run
on Mac OS 10.4 without any issues as long as the deployment target has
been set correctly and no functionality that is unavailable under MacOS
10.4 has been used.

Of course you can always have a parallel installation of Xcode3 next
to Xcode4, but that means you must forgo all the (great?) new features
of Xcode4 and keep working with the outdated Xcode3 IDE. It would
certainly be much better if you could also manage all your old projects
within the same IDE as your new ones and benefit from any new features
available. Not all projects can be made 10.6 or Intel only in the
foreseeable future. Further I’m strictly against abolishing support for
older platforms earlier than would be really necessary.

Can we restore this functionality to Xcode4?

2 Answers

The quick answer is: Yes, we can!

Before I get to the “how it is done” part, here are some notes about my patch/hack/fix. Right from the start the major goals have been:

  1. Keep all modifications to an absolute minimum.
    We want to keep the Xcode setups as original as possible.

  2. By all means, try to avoid patching or modifying any files.
    We want all files to stay untouched and keep their original content.

  3. Try to avoid moving or copying files around, unless absolutely necessary.

I was able to keep all those goals. Almost everything is done by
creating symlinks. Only a single existing symlink had to be replaced and
we’ll back it up before replacement, just in case.

If you are no expert on terminal operations, I strongly advise you to
copy/paste all terminal commands from my reply to your terminal, to
avoid typos. Bear in mind that even spacing, quoting and especially
capitalization can be important. Copy/paste them line by line, never
more than one line at once and hit return after each pasted line to
execute the command. Should any operation ever prompt you for a
password, this will be the password of the currently logged in
administrator user (your keystrokes are not displayed while typing, this
is normal, don’t worry, just keep typing the password and hit return;
re-try if you had a typo and get prompted again).


Before we can start, make sure the following conditions are true:

  • You are logged in as an administrator user.
  • You have started (Applications/Utilities) and a terminal window is open.
  • You have a copy of the Xcode3 (e.g. 3.2.5) and Xcode4 disk image (DMG) or installer available.
  • If you already have either Xcode version installed, consider uninstalling it first,
    so you can start with a fresh/clean setup. Uninstalling Xcode will not
    remove your preferences, color scheme or key binding customizations.
    Ideally you’d start with a system that has no Xcode version (neither 3
    nor 4) currently installed.

Step 1: Installing Xcode3

Important: Do not install “System Tools” or “Unix Development” package of Xcode3.
Whether you want to install “Mac OS X 10.4 SDK” and/or “Documentation” is up to you. If that is a Xcode3 with iOS SDKs, whether you install those or not is also up to you.

You are free to choose any destination folder for your installation. For this guide I have chosen “/Xcode3“, but feel free to pick a different one. Just make sure to alter all terminal commands accordingly.

The order of the steps given here is usually not really important,
but I strongly advise you to not swap step 1 and step 2. Xcode always
installs a couple of files outside of the chosen destination folder and
trust me, in the end you want the Xcode4 versions of those files on your
disk. By installing Xcode3 before Xcode4, you can be sure that Xcode4
will overwrite those files if necessary. I once swapped steps 1 and 2
and in the end I had some rather strange issues that might have been
related to the incorrect order (I cannot say for sure, but after
re-installing in the correct order the issues were gone).

Step 2: Installing Xcode4

Chose any packets you like. Installing “System Tools” is advisable, but not strictly necessary (though most people will sooner or later miss that functionality).

Again, feel free to pick any target folder you like. For this guide I chose the normal target folder “/Developer“, if you take a different one, alter all terminal commands accordingly.

Step 3: Restoring 10.4/10.5 SDK Support

Switch to your terminal window and run the following commands:

cd /Developer/SDKs
sudo ln
-s /Xcode3/SDKs/MacOSX10.4u.sdk .
sudo ln
-s /Xcode3/SDKs/MacOSX10.5.sdk .

Of course only run the command for 10.4u if you also installed SDK 10.4 in step 1.

This is enough to bring the SDKs 10.5 (and possibly 10.4) back to the
selection list in Xcode4. Give it a try if you like. Fire up Xcode4,
open a project, try changing the selected SDK. That was easy, huh? Be
sure to close Xcode4 again (the application, not just the window) before
proceeding with the next step.

Step 4: Restoring GCC 4.0 Support

If you have not installed MacOS 10.4 SDK or if you don’t plan to ever
use it, you can safely skip this step and proceed with step 5.

To use SDK 10.4, you’ll have to use GCC 4.0, GCC 4.2 won’t work.
Apple claims that GCC 4.2 is not compatible with SDK 10.4, well, if you
ask me, this is a hoax. I have already overwritten this limitations more
than once and there was never the tiniest issue because of it. It would
be easy to modify SDK 10.4 so that Xcode will allow you to use GCC 4.2
for it, but my goal was to avoid all file modifications, so we just add
GCC 4.0 support back to Xcode, which is also a good thing, because some
projects really depend on GCC 4.0 (e.g. there are some bugs in GCC 4.2
that prevent valid inline assembly code to compile without errors, while
the same code compiles flawlessly on GCC 4.0 and GCC 4.4).

Back to terminal:

cd /Developer/usr/bin
for SRC_FILE in /Xcode3/usr/bin/*4.0*; do sudo ln -s "$SRC_FILE" .; done

cd /Developer/usr/libexec/gcc/powerpc-apple-darwin10
sudo ln -s /Xcode3/usr/libexec/gcc/powerpc-apple-darwin10/4.0.1 .

Don’t get confused by the fact that the syntax highlighting seems
rather broken above; the highlighting is not really optimized for shell

Right now we have restored full GCC 4.0 support except for the fact
that GCC 4.0 is still not selectable in Xcode4. That is because Xcode4
has no GCC 4.0 compiler plug-in any longer. Fortunately the Xcode3
plug-in also works in Xcode4, only the position has radically changed.
Apple now hides those plug-ins deep within a bundle and only plug-ins
there seem to work, placing them to their old position seems to have no

cd /Developer/Library/Xcode/PrivatePlugIns
sudo ln
-s "/Xcode3/Library/Xcode/Plug-ins/GCC 4.0.xcplugin" .

Now fire up Xcode4 again, open a project and try selecting the
compiler. You should have GCC 4.0 back on the list. Now you can actually
already select SDK 10.4 or 10.5, GCC 4.0 and you should have no issue
to build a PPC binary. Just select “Other…” for the “Architecture” build setting and manually enter “ppc“, then alter “Valid Architectures” to also include “ppc“. We are almost done, except that trying to build a PPC binary using GCC 4.2 and SDK 10.5 will still fail.

Step 5: Restoring PPC Support for GCC 4.2

Since Apple is only supporting Intel platforms in Xcode4, not all GCC
4.2 tools have been built with PPC support. There is one important tool
that has no PPC support, the tool is named “as” and it is the GNU Assembler. To compile ppc/ppc64 binaries with GCC 4.2 we need to use an “as
version with ppc/ppc64 support. This is the one and only file (actually
it also a symlink) we have to first move aside (making a backup copy)
before we can replace it by a symlink:

cd /Developer/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1
sudo mv
as as.bak
sudo ln
-s /Xcode3/usr/bin/as .

Step 6: There is No Step 6

That’s all folks. Considering how easy that was, you can imagine that
Apple has certainly not dropped SDK 10.4/10.5 or ppc/ppc64 or GCC 4.0
support because this was a necessity, they dropped all that because they
wanted to drop it.

I hope this setup works as well for you as it does for me. I have
been able to compile all my old projects in Xcode4 without any major
changes, except for having to alter a search path here and there.

It may look strange that I answer my own question here, but since I have
found out how to solve this problem all by myself, I’d like to share my
knowledge with the community, because I believe this is really valuable
input to all MacOS developers out there. This question has been asked
so many times in so many places and so far I have never seen anyone
coming up with a similar fix. Share the wealth, spread the knowledge and
so on, you know what I mean.

Copied from  :

Leave a Comment.