My favorites | Sign in
gyp
Project Home Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 292: gyp errors out when xcode-select returns no path
23 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by charles....@gmail.com, Aug 25, 2012
What steps will reproduce the problem?
1. Take a fresh install of OS X 10.7 or newer.
2. Install the Command Line Tools package from connect.apple.com

What is the expected output? What do you see instead?

Expected:

gyp can configure projects that build using the Frameworks and compilers contained in the Command Line Tools package.

Result:

gyp throws an error from _GetSdkBaseDir in pylib/gyp/xcode_emulation.py and quits because no allowance is made for xcode-select returning a nonzero exit code. xcode-select returns 1 when no path has been set, which is normal for a CLT-only setup as there is no /Developer folder or XCode.app to set the path to.


What version of the product are you using? On what operating system?

The error showed up in r1237 and is very prominent when building Node.js. Version 0.8.1 of Node, which used gyp r1214 builds just fine under a CLT-only setup. Version 0.8.2, which upgraded to gyp r1426 fails to build.

It should be noted that setting a completely bogus path using `xcode-select -switch some_dir_that_exists_but_doesnt_contain_anything` allows gyp to configure and build Node just fine because xcode-select returns a zero exit code in this case.

Please provide any additional information below.

See the following issue on GitHub for more info:

https://github.com/joyent/node/issues/3681
Aug 25, 2012
#1 charles....@gmail.com
It should also be noted that:

  - The xcodebuild tool is completely no-functional when just the Command Line Tools are installed.

  - Using xcode-select to set a bogus path results in xcodebuild hanging in an infinite loop rather than reporting to the user that it is non-functional.
Aug 28, 2012
#2 charles....@gmail.com
Also, this can be re-produced on a non-fresh install by unsetting the xcode-select path. This can be accomplished by moving or removing the contents of `/usr/share/xcode-select/`.
Feb 1, 2013
#3 ankurset...@gmail.com
Basically this bug means gyp depends on xcode when not all projects need it.  Now that Mac has released the Xcode developer tools, would be nice if Gyp would respect that instead of blowing up if xcode-select doesn't exist.
Apr 22, 2013
#4 mistyde...@gmail.com
Now that gyp has switched to using xcodebuild instead of xcode-select, the workaround of setting the DEVELOPER_DIR environment variable no longer works at all. The xcodebuild script that comes with the OS is just a shim, and the Command Line Tools don't ship the real version of xcodebuild.

Hence - CLT-only users can't build any gyp projects ATM. This affects node, as one example, which doesn't actually require Xcode to build but which fails to configure under gyp.
Apr 23, 2013
#5 dylan.verheul
Please fix this for CLT users.
Aug 22, 2013
#7 d...@dbsgeo.com
Could this patch please be accepted? This is still blocking node installs when XCode is not present. As I mention on the original node.js ticket I was able to cleanly work around the problem by applying this patch: https://github.com/joyent/node/issues/3681
Sep 16, 2013
#8 d...@dbsgeo.com
Anyone know the timeline of when this might be accepted or if it needs more work?
Oct 6, 2013
#9 eric.sam...@gmail.com
Hi, I was able to verify that this patch fixed an issue I was having while trying to compile a large OS project which had a submodule which uses gyp. Would it be possible for someone from gyp to review this patch and/or consider accepting it? Thanks! :)
Dec 16, 2013
#11 mistyde...@gmail.com
This is now fixed in r1819.
Dec 24, 2013
#12 mistyde...@gmail.com
The patch was reverted, but has landed again in r1825. A second patch to fix Xcode version detection is incoming.
Feb 3, 2014
#13 James.G....@gmail.com


Many of the patches to gyp mentioned above didn't work for me. I managed to get this to work. In case any of you are still having problems, here's what I did:

I noticed that the source code for gyp is trying to run xcodebuild, but if xcodebuild fails, then gyp fails. However, there is error handling in gyp in case xcodebuild runs successfully, but returns something other than expected. Relying on the behavior of gyp as described, I created an executable file called xcodebuild and put it in my search path. Here are its contents:

#!/bin/bash

exit 0

That's it. All I wanted to do was make sure that gyp doesn't freak out when it tries to run xcodebuild. I did not touch xcode-select or the gyp source.

This will probably break badly if there is a project that depends on Xcode, though...

Sign in to add a comment

Powered by Google Project Hosting