diff -Naur a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py --- a/tools/gyp/pylib/gyp/xcode_emulation.py 2013-11-12 21:22:12.000000000 +0100 +++ b/tools/gyp/pylib/gyp/xcode_emulation.py 2013-12-17 11:07:11.000000000 +0100 @@ -285,8 +285,15 @@ if sdk_root.startswith('/'): return sdk_root if sdk_root not in XcodeSettings._sdk_path_cache: - XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem( - sdk_root, 'Path') + try: + XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem( + sdk_root, 'Path') + except: + # if this fails it's because xcodebuild failed, which means + # the user is probably on a CLT-only system, where there + # is no valid SDK root + XcodeSettings._sdk_path_cache[sdk_root] = None + return XcodeSettings._sdk_path_cache[sdk_root] def _AppendPlatformVersionMinFlags(self, lst): @@ -397,10 +404,11 @@ cflags += self._Settings().get('WARNING_CFLAGS', []) - config = self.spec['configurations'][self.configname] - framework_dirs = config.get('mac_framework_dirs', []) - for directory in framework_dirs: - cflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) + if 'SDKROOT' in self._Settings(): + config = self.spec['configurations'][self.configname] + framework_dirs = config.get('mac_framework_dirs', []) + for directory in framework_dirs: + cflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) self.configname = None return cflags @@ -647,10 +655,11 @@ for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []): ldflags.append('-Wl,-rpath,' + rpath) - config = self.spec['configurations'][self.configname] - framework_dirs = config.get('mac_framework_dirs', []) - for directory in framework_dirs: - ldflags.append('-F' + directory.replace('$(SDKROOT)', self._SdkPath())) + if 'SDKROOT' in self._Settings(): + config = self.spec['configurations'][self.configname] + framework_dirs = config.get('mac_framework_dirs', []) + for directory in framework_dirs: + ldflags.append('-F' + directory.replace('$(SDKROOT)', self._SdkPath())) self.configname = None return ldflags @@ -826,7 +835,10 @@ l = '-l' + m.group(1) else: l = library - return l.replace('$(SDKROOT)', self._SdkPath(config_name)) + if self._SdkPath(): + return l.replace('$(SDKROOT)', self._SdkPath(config_name)) + else: + return l def AdjustLibraries(self, libraries, config_name=None): """Transforms entries like 'Cocoa.framework' in libraries into entries like