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

xcrun error when building master #12531

Closed
gibfahn opened this issue Apr 20, 2017 · 25 comments
Closed

xcrun error when building master #12531

gibfahn opened this issue Apr 20, 2017 · 25 comments
Labels
build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX.

Comments

@gibfahn
Copy link
Member

gibfahn commented Apr 20, 2017

As of I think yesterday, when I run ./configure on macOS, I get a new xcrun error in addition to the xcodebuild warnings that we all know and love. The build still passes, but it'd be nice to avoid these.

Error:

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 '/'
  • Version: master
  • Platform: macOS
  • Subsystem: build
@gibfahn gibfahn added build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX. labels Apr 20, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Apr 20, 2017

Looks like change comes from: 3a334b1 which was #12450, so cc @refack.

@gibfahn
Copy link
Member Author

gibfahn commented Apr 20, 2017

The issue with the xcodebuild warnings is that on macOS you can have either the full Xcode, or just the command line tools (similar to the Visual Studio / Visual C++ build tools on Windows). The command line tools don't include xcodebuild, but gyp calls it and then never uses it so it's not actually a problem. I'm not sure if the xcrun is a similar problem, but looking at the commit diff, it looks like xcrun was already being called prior to this, it just wasn't giving errors.

@refack
Copy link
Contributor

refack commented Apr 20, 2017

@gibfahn can you verify it's

tools/gyp/pylib/gyp/mac_tool.py:
79      -    args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices',
80      -        '--output-format', 'human-readable-text', '--compile', dest, source]
     86 +    args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices']

So I can dig deeper?

@refack
Copy link
Contributor

refack commented Apr 20, 2017

(I meen that whole patched area )

@refack
Copy link
Contributor

refack commented Apr 20, 2017

Is your os.environ['XCODE_VERSION_ACTUAL'] > '0700'?

@refack refack self-assigned this Apr 20, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Apr 20, 2017

I put some print statements in there but nothing happened. I don't know enough about GYP to know whether that file is even being triggered. I think it might not be.

I don't have any XCODE things in my environment (or os.environ) at all.

@refack
Copy link
Contributor

refack commented Apr 20, 2017

Hmm. I'll have to spin up my hackintosh VM.
Which OSX ver you have? and version of the "Xcode Command Line Tools"?

@refack
Copy link
Contributor

refack commented Apr 20, 2017

P.S. you say these errors comes from GYP (i.e. ./configure) not the ninja run, right?

@refack
Copy link
Contributor

refack commented Apr 20, 2017

[not a solution]
P.P.S. have you tried https://github.com/nodejs/node-gyp? Mostly as an exercise...

  1. rename /tools/gyp_node.py - to stop GYP from running
  2. run ./configure to generate config.gypi
  3. run gyp.js -Icommon.gypi -Iconfig.gypi [-Dtarget_arch=x64] node.gyp

@gibfahn
Copy link
Member Author

gibfahn commented Apr 21, 2017

macOS 10.12.4 (16E195) (the latest Sierra).

Yes, errors come from ./configure.

Not sure how to tell which version of the command line tools, but it should be the latest, here's the output of clang --version.

➜  node git:(master) ✗ ❯ clang --version                                                                             ~/wrk/com/node
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@ghost
Copy link

ghost commented Apr 26, 2017

screen shot 2017-04-26 at 09 51 41

I got it too

@refack
Copy link
Contributor

refack commented Apr 26, 2017

AFAIK they are just messages, right? you can make/ninja afterwards?

@gibfahn
Copy link
Member Author

gibfahn commented Apr 26, 2017

AFAIK they are just messages, right? you can make/ninja afterwards?

Yep, they don't actually seem to affect anything. I know xcodebuild isn't actually used, and I suspect the same is true for xcrun.

@refack
Copy link
Contributor

refack commented May 2, 2017

FYI, trying to push this upstream https://chromium-review.googlesource.com/c/492046/ voice your opinion

@Trott
Copy link
Member

Trott commented Aug 10, 2017

This is still a thing, right?

@gibfahn
Copy link
Member Author

gibfahn commented Aug 10, 2017

This is still a thing, right?

Yep, just confirmed on master.

@ryzokuken
Copy link
Contributor

@Trott just got this. Could we check what's wrong here?

@bnoordhuis
Copy link
Member

What does xcrun --show-sdk-platform-path print on your system?

@ryzokuken
Copy link
Contributor

ryzokuken commented Jun 25, 2018

@bnoordhuis the exact same thing.

> $ xcrun --show-sdk-platform-path
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/'

@bnoordhuis
Copy link
Member

Good, that means it isn't because of the environment gyp invokes it in. Does this patch fix it?

diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
index 9082b9da35..c303313a30 100644
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
@@ -645,9 +645,10 @@ class XcodeSettings(object):
 
     cflags += self._Settings().get('WARNING_CFLAGS', [])
 
-    platform_root = self._XcodePlatformPath(configname)
-    if platform_root and self._IsXCTest():
-      cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/')
+    if self._IsXCTest():
+        platform_root = self._XcodePlatformPath(configname)
+        if platform_root:
+          cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/')
 
     if sdk_root:
       framework_root = sdk_root
@@ -913,10 +914,11 @@ class XcodeSettings(object):
     for directory in framework_dirs:
       ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
 
-    platform_root = self._XcodePlatformPath(configname)
-    if sdk_root and platform_root and self._IsXCTest():
-      ldflags.append('-F' + platform_root + '/Developer/Library/Frameworks/')
-      ldflags.append('-framework XCTest')
+    if self._IsXCTest():
+        platform_root = self._XcodePlatformPath(configname)
+        if sdk_root and platform_root:
+          ldflags.append('-F' + platform_root + '/Developer/Library/Frameworks/')
+          ldflags.append('-framework XCTest')
 
     is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension()
     if sdk_root and is_extension:

@ryzokuken
Copy link
Contributor

@bnoordhuis it did, awesome! I hope it landed in a version of gyp we don't have yet? If not, why aren't we floating this upstream?

@bnoordhuis
Copy link
Member

Because I just wrote it 30 minutes ago. :-)

I'd be okay with floating it on top of our local copy. Upstream gyp is pretty much dead by now.

@ryzokuken
Copy link
Contributor

@bnoordhuis making a PR for nodejs/node.

@ryzokuken
Copy link
Contributor

BTW, I was confused because I thought @refack had made a similar patch for upstream gyp, but maybe it didn't land?

@bnoordhuis
Copy link
Member

It didn't.

ryzokuken added a commit to ryzokuken/node that referenced this issue Jun 30, 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#12531
targos pushed a commit that referenced this issue 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>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue 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 issue 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>
@refack refack removed their assignment Oct 12, 2018
BaochengSu pushed a commit to BaochengSu/node that referenced this issue 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. macos Issues and PRs related to the macOS platform / OSX.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants