nodejs / nodejs/node-gyp

TypeError in xcodeproj_file.py

Open
#2,674 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

macOS 12.3.1
Python 3.8.9
node 14.19.3

It seems there is a typo in https://github.com/nodejs/node-gyp/blob/6f74c762fe3c19bdd20245cb5c02e2dfa65d9451/gyp/pylib/gyp/xcodeproj_file.py#L2993
parentheses missed after .lower

gyp info using node@14.19.3 | darwin | x64
gyp verb command configure [ '-f', 'xcode' ]
gyp verb download using dist-url https://electronjs.org/headers
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - executable path is "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
gyp verb find Python - executing "/Applications/Xcode.app/Contents/Developer/usr/bin/python3" to get version
gyp verb find Python - version is "3.8.9"
gyp info find Python using Python version 3.8.9 found at "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
gyp verb get node dir compiling against --target node version: 17.1.1
gyp verb command install [ '17.1.1' ]
gyp verb download using dist-url https://electronjs.org/headers
gyp verb install input version string "17.1.1"
gyp verb install installing version: 17.1.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 17.1.1
gyp verb build dir attempting to create "build" dir: /Users/lim/Projects/dvc-monorepo/tools/build
gyp verb build dir "build" dir needed to be created? Yes
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/lim/Projects/dvc-monorepo/tools/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/lim/Projects/dvc-monorepo/tools/config.gypi
gyp verb common.gypi checking for gypi file: /Users/lim/Projects/dvc-monorepo/tools/common.gypi
gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'xcode',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/lim/Projects/dvc-monorepo/tools/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/lim/Library/Caches/node-gyp/17.1.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/lim/Library/Caches/node-gyp/17.1.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/lim/Library/Caches/node-gyp/17.1.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/lim/Projects/dvc-monorepo/tools',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/gyp_main.py", line 45, in <module>
    sys.exit(gyp.script_main())
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 662, in script_main
    return main(sys.argv[1:])
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 654, in main
    return gyp_main(args)
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 639, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py", line 1336, in GenerateOutput
    xct.AddDependency(xcode_targets[dependency])
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py", line 2690, in AddDependency
    XCTarget.AddDependency(self, other)
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py", line 2389, in AddDependency
    other_project_ref = pbxproject.AddOrGetProjectReference(other_pbxproject)[1]
  File "/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py", line 2991, in AddOrGetProjectReference
    self._properties["projectReferences"] = sorted(
TypeError: '<' not supported between instances of 'builtin_function_or_method' and 'builtin_function_or_method'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/lim/.nvm/versions/node/v14.19.3/lib/node_modules/node-gyp/lib/configure.js:259:16)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 21.4.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open gyp/pylib/gyp/xcodeproj_file.py around line 2993 and inspect the .lower expression used while sorting projectReferences. Reproduce the reported configure path with the Xcode generator, then verify that the TypeError no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, python
Domain
build-system, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.