Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: update gyp to make xcode tools work #21520

Closed
wants to merge 1 commit into from

Conversation

ryzokuken
Copy link
Contributor

A recent change must have started requiring a full XCode installation in
order to run "./configure" and pretty much everything related.
This patch ensures that a full installation isn't required and the tools
work just fine.

Credits: @bnoordhuis
Fixes: #12531

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

/cc @bnoordhuis @refack @nodejs/gyp

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. tools Issues and PRs related to the tools directory. labels Jun 25, 2018
Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I sign off on my own code? Of course I can!

@Trott
Copy link
Member

Trott commented Jun 26, 2018

Not a blocking objection, but I think the commit message here could be revised. It seems to say (or at least imply?) that building without full XCode is broken. But if I understand correctly, it's not broken. It just shows an error message that happens to not matter. This doesn't "fix" a broken build process. It suppresses an erroneous error message. (Or am I mistaken?)

@ryzokuken
Copy link
Contributor Author

@Trott no. The error message still keeps coming (and is very irritating), but without this patch, I found it impossible to build without full XCode, so yeah, it's probably broken.

@Trott
Copy link
Member

Trott commented Jun 26, 2018

@Trott no. The error message still keeps coming (and is very irritating), but without this patch, I found it impossible to build without full XCode, so yeah, it's probably broken.

Interesting. I find it nearly impossible to believe that building with full XCode could be broken without it impacting a significant percentage of core devs. But I suppose it's possible that it affects just the right version of XCode and/or OS or something like that.

@Trott
Copy link
Member

Trott commented Jun 26, 2018

I don't want to be too annoying about my fixation on this, and you can totally ignore me if you want. That said, some other observations:

FWIW, I don't have a full XCode installed an either of the machines I use to build Node.js and I haven't had a problem building.

The bug that this fixes is over a year old but the commit message talks of a "recent change"... I guess it's possible that the bug first manifested as an irritating-but-harmless message over a year ago and then started causing a completely build failure more recently under certain conditions.

It might be good to simply remove speculation. Maybe something more like this?

tools: patch gyp for Xcode tools

Work around errors that occur when building without a full
XCode installation. 

Maybe those errors mean you can't build and maybe they don't, but either way, let's navigate around them.

@ryzokuken
Copy link
Contributor Author

I don't want to be too annoying about my fixation on this, and you can totally ignore me if you want.

@Trott not at all! I'd love to get to the bottom of this as well.

Interesting. I find it nearly impossible to believe that building with full XCode could be broken without it impacting a significant percentage of core devs. But I suppose it's possible that it affects just the right version of XCode and/or OS or something like that.

FWIW, I don't have a full XCode installed an either of the machines I use to build Node.js and I haven't had a problem building.

Strange, right? I should've mentioned that this happened only when setting up the project from scratch on a new machine (my home machine works just fine). So I also believe this has something to do with a specific XCode/MacOS version maybe?

@ryzokuken
Copy link
Contributor Author

@Trott I hope this looks good to you? Planning to land this soon-ish.

@Trott
Copy link
Member

Trott commented Jun 28, 2018

Yup, as I wrote above, "not a blocking objection". If CI is green and no one else objects, feel free to land. I would prefer the commit message get revised (and provided my suggestion above), but it's fine if it doesn't.

@ryzokuken
Copy link
Contributor Author

@Trott it's fine. I'll amend the commit message, run CI and land tomorrow morning.

@gibfahn
Copy link
Member

gibfahn commented Jun 29, 2018

The error message still keeps coming (and is very irritating)

FWIW applying nodejs/node-gyp#1370 to the in-tree copy of gyp should fix the other error. I haven't done it because I'm not sure how updating gyp in node works, but if someone else would like to pull that change in they're more than welcome to.

@gibfahn
Copy link
Member

gibfahn commented Jun 29, 2018

To clarify:

master:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

This PR:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

This PR + nodejs/node-gyp#1370:

I applied the patch by doing: curl https://github.com/nodejs/node-gyp/commit/3a52936d6cae0b35a4bd486017c7c7a88ae0b415.patch | git am -3 --directory=tools and then fixing the merge conflict (change GetStdout to GetStdoutQuiet).

@ryzokuken if you would be willing to apply that one (probably best left to a separate PR) then I think we could get ./configure to run cleanly, which would be amazing.

Copy link
Member

@gibfahn gibfahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the commit message changed

@gibfahn
Copy link
Member

gibfahn commented Jun 29, 2018

Commit message suggestion:

tools: patch gyp to avoid xcrun errors

Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

@gibfahn
Copy link
Member

gibfahn commented Jun 29, 2018

@Trott no. The error message still keeps coming (and is very irritating), but without this patch, I found it impossible to build without full XCode, so yeah, it's probably broken.

It's not really a big deal if it's fixed by this, but it sounds like something is different about your machine that makes xcode fail rather than just logging the errors and continuing, I also have no problems with the command line tools.

I would say let's debug it, but if this PR fixes the issue let's just land it.

@ryzokuken
Copy link
Contributor Author

ryzokuken commented Jun 29, 2018

@gibfahn it actually does fix the issue, and I think @bnoordhuis would have much more insight over how thing even works, but I'm thinking that because they were able to hack up a solution this quick, then there must be a catch.

P.S. totally using your suggestion for the commit message, thanks.

@ryzokuken
Copy link
Contributor Author

@ryzokuken
Copy link
Contributor Author

Force pushed to update failing master, rerunning tests.

@gibfahn
Copy link
Member

gibfahn commented Jun 30, 2018

Still LGTM, but if you wanted to credit Ben you could use the Co-authored-by:.

@ryzokuken
Copy link
Contributor Author

@gibfahn awesome! I'll add that line.

Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: nodejs#12531
@ryzokuken
Copy link
Contributor Author

@ryzokuken
Copy link
Contributor Author

@ryzokuken
Copy link
Contributor Author

ryzokuken commented Jul 1, 2018

Windows fanned passed, landing once linux passes: https://ci.nodejs.org/job/node-test-commit-linux/19881/

@ryzokuken
Copy link
Contributor Author

@maclover7
Copy link
Contributor

Should this patch be applied to node-gyp's version of GYP too?

@ryzokuken
Copy link
Contributor Author

@maclover7 is node-gyp affected by this? I tried it with our version of gyp and it just won't work without a full XCode installation. Let's check if node-gyp requires this patch too?

@gibfahn
Copy link
Member

gibfahn commented Jul 10, 2018

Should this patch be applied to node-gyp's version of GYP too?

@maclover7 yep, that's a separate PR someone should raise (but it doesn't block or affect this PR).

tl;dr: 2 changes in 2 repos, once they've all landed we should be warning-free everywhere:

@ryzokuken
Copy link
Contributor Author

ryzokuken commented Jul 10, 2018 via email

@ryzokuken
Copy link
Contributor Author

ryzokuken added a commit to ryzokuken/node that referenced this pull request Jul 12, 2018
Muffle gyp from creating xcode-select related warnings, essentially
flooding the console.

Co-authored-by: Gibson Fahnestock <gibfahn@gmail.com>
Refs: nodejs/node-gyp#1370
Refs: nodejs#21520
@gibfahn gibfahn mentioned this pull request Jul 13, 2018
4 tasks
@ryzokuken
Copy link
Contributor Author

Final CI run (hopefully): https://ci.nodejs.org/job/node-test-pull-request/16055/

@ryzokuken
Copy link
Contributor Author

@ryzokuken
Copy link
Contributor Author

Tests passed, landing this.

@ryzokuken
Copy link
Contributor Author

Landed in 51812ff

@ryzokuken ryzokuken closed this Jul 29, 2018
ryzokuken added a commit that referenced this pull request Jul 29, 2018
Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: #12531

PR-URL: #21520
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2018
Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: #12531

PR-URL: #21520
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos targos mentioned this pull request Jul 31, 2018
rvagg pushed a commit to nodejs/node-gyp that referenced this pull request Aug 9, 2018
Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: nodejs/node#12531

PR-URL: nodejs/node#21520
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this pull request Aug 9, 2018
Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: nodejs/node#12531

PR-URL: nodejs/node#21520
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
BaochengSu pushed a commit to BaochengSu/node that referenced this pull request Oct 20, 2020
Previously running ./configure with only the Xcode Command Line Tools
installed would give:

xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: nodejs#12531

PR-URL: nodejs#21520
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
(cherry picked from commit 51812ff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xcrun error when building master
9 participants