From: Kevin Walzer <kw@co...> - 2012-02-22 23:44:59
Apple released Xcode 4.3 this week, and the new version has some
significant differences over previous iterations of the IDE. Xcode no
longer installs in /Developer, but is instead a single app bundle that
installs in /Applications. Additionally, Xcode no longer installs
numerous command-line tools such as llvm, clang, gcc, etc. These can
either be installed from Xcode 4.3's preferences menu, or as a separate
download from Apple's developer site.
The reason I'm mentioning this is that I ran into significant issues
trying to patch and build a new version of Tk with Xcode 4.3. (I'm not
alone in this respect. Many open-source projects, such as MacPorts,
Fink, and Homebrew are also finding a lot of their packages are breaking
because of the changes in Xcode.) Tk couldn't find standard headers like
stdio.h, let alone the Cocoa and Carbon headers it depends on for the
After a lot of Googling, trial and error, I got a new build of Tcl and
Tk to work. Here's what I did:
1. Before installing Xcode 4.3 from the Mac App Store, I removed all
previous installations of Xcode using the uninstall script that is found
in /Developer. (Xcode 4.3 also allows you to do this.) I did this to
avoid path conflicts.
2. Installed Xcode 4.3 and the command-line tools.
3. Ran this command: sudo xcode-select -switch
/Applications/Xcode.app/Contents/Developer/. This command points system
resources to the correct header paths, command-line tools, etc. if you
have the full Xcode installation.
After this, I had to rebuild Tcl and Tk from scratch, and everything ran
Apple also has made the command-line tools available as a download that
does not require the full Xcode installation. I haven't tested this
setup, so I can't speak to how it works with open-source software; my
guess is that the xcode-select command would need to be run, possibly to
point to a different location. The list archives and bug trackers of
MacPorts, Fink, and Homebrew are full of discussion about this over the
past several days, and it's not fully clear to me how they are resolving
the issue or what setup they are recommending for end users.
This release of Xcode was a bit bumpy for open-source projects, and I
hope this basic discussion of what worked for me will be helpful to others.
Code by Kevin