Node: xcrun error when building master

Created on 20 Apr 2017  ·  25Comments  ·  Source: nodejs/node

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
build macos

All 25 comments

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.

@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?

(I meen that whole patched area )

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

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.

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

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

[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

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

screen shot 2017-04-26 at 09 51 41
I got it too

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

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.

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

This is still a thing, right?

This is still a thing, right?

Yep, just confirmed on master.

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

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

@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 '/'

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:

@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?

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.

@bnoordhuis making a PR for nodejs/node.

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

It didn't.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Icemic picture Icemic  ·  3Comments

akdor1154 picture akdor1154  ·  3Comments

dfahlander picture dfahlander  ·  3Comments

filipesilvaa picture filipesilvaa  ·  3Comments

willnwhite picture willnwhite  ·  3Comments