[issue3277] hg-2.1 on OSX Lion - compile error, xcodebuild

nibbles bugs at mercurial.selenic.com
Sat Feb 18 23:48:22 CST 2012

New submission from nibbles <nibbles at speakeasy.net>:

setup.py calls xcodebuild which can return an error or versionless path,
causing compile to fail on OSX Lion, if the user has only the new
command_line_tools_for_xcode.dmg not the full XCode-4.3 (which they don't
need anymore).  A clean install of Lion with only the command line tools
will never work with setup.py.

==> make PREFIX=/usr/local/Cellar/mercurial/2.1 build
python setup.py  build
Traceback (most recent call last):
  File "setup.py", line 455, in <module>
    version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0]
IndexError: list index out of range
make: *** [build] Error 1

Here are the details:

On Feb 16, 2012, Apple released XCode-4.3 for OSX Lion, which does not
contain the command line tools (CLT) to build open source software.

An OSX Lion user can get those tools in one of two ways:

1) Install the CLT inside of the XCode-4.3 preferences window.
2) or not install the massive XCode-4.3 at all, but rather only install the
small CLT archive from Apple's developer website,
https://developer.apple.com/downloads/index.action (requires free
registration like this bug tracker does).

When an OSX Lion user only installs the CLT-4.3, xcodebuild -version will
return an error because the path is unset, or it might return a path with no
SDK number in it.  It can never return a path with the version in it because
there is no SDKs folder in this situation where there's no XCode-4.3 full

Hg's setup.py does not handle the error or versionless path.  Compile fails.

The program you call, xcodebuild, reads a text file btw.

    $ ls -l /usr/share/xcode-select/xcode_dir_path
    -rw-r--r--  1 root  wheel      2 Feb 18 21:21 xcode_dir_path

Ok many thanks if you can handle the case where xcodebuild returns garbage.
2bits @ homebrew

messages: 19134
nosy: nibbles
priority: urgent
status: unread
title: hg-2.1 on OSX Lion - compile error, xcodebuild
topic: macos

Mercurial issue tracker <bugs at mercurial.selenic.com>

More information about the Mercurial-devel mailing list