You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clangd complains for Unknown argument: '-arch arm64' [drv_unknown_argument]
The reason is that this c flag: "-arch arm64" is quoted in the generated compile_commands.json (as specified in common.py as it contains space). Clang compiler expects two separate argvs elements, not just single element quoted.
The possible solution to this is not to apply gyp.common.EncodePOSIXShellList function for c/cc flags in gyp/pylib/gyp/generator/compile_commands_json.py. I guess that should be fine, do we ever need to quote/escape compiler flags?
Node Version: v20.0.0
Platform: Darwin THEUSER-M-FHVK 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
Compiler:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
THEUSER-M-FHVK:node-binding theuser$ node-gyp -- configure -f=gyp.generator.compile_commands_json.py
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@20.2.0 | darwin | arm64
gyp info find Python using Python version 3.11.3 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
gyp http GET https://nodejs.org/download/release/v20.2.0/node-v20.2.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v20.2.0/node-v20.2.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v20.2.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v20.2.0/SHASUMS256.txt
gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11
gyp info spawn args [
gyp info spawn args '/opt/homebrew/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f=gyp.generator.compile_commands_json.py',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/theuser/Documents/node-binding/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/opt/homebrew/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/theuser/Library/Caches/node-gyp/20.2.0/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/theuser/Library/Caches/node-gyp/20.2.0',
gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/theuser/Library/Caches/node-gyp/20.2.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/theuser/Documents/node-binding',
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 ]
gyp info ok
Running this to create
compile_commands.json
:clangd complains for
Unknown argument: '-arch arm64' [drv_unknown_argument]
The reason is that this c flag: "-arch arm64" is quoted in the generated compile_commands.json (as specified in common.py as it contains space). Clang compiler expects two separate argvs elements, not just single element quoted.
The possible solution to this is not to apply
gyp.common.EncodePOSIXShellList
function for c/cc flags ingyp/pylib/gyp/generator/compile_commands_json.py
. I guess that should be fine, do we ever need to quote/escape compiler flags?v20.0.0
Darwin THEUSER-M-FHVK 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
node-gyp -- configure -f=gyp.generator.compile_commands_json.py
Verbose output (from npm or node-gyp):
This is the file generated:
The text was updated successfully, but these errors were encountered: