Cannot build a native add-on on Mac BigSur
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.7k
- Forks
- 1.9k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Description
- Node Version:v12.22.6
- Platform: Darwin
- Compiler:
- Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin - Module: Just a empty c++ fil.e
Verbose output (from npm or node-gyp):
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/bin/node',
gyp verb cli '/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose'
gyp verb cli ]
gyp info using node-gyp@5.1.0
gyp info using node@12.22.6 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
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 "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - executable path is "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp verb find Python - executing "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" to get version
gyp verb find Python - version is "2.7.16"
gyp info find Python using Python version 2.7.16 found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp verb get node dir no --target version specified, falling back to host node version: 12.22.6
gyp verb command install [ '12.22.6' ]
gyp verb install input version string "12.22.6"
gyp verb install installing version: 12.22.6
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: 12.22.6
gyp verb build dir attempting to create "build" dir: /Users/nazarii_romankiv/Projects/os-toolbox/build
gyp verb build dir "build" dir needed to be created? /Users/nazarii_romankiv/Projects/os-toolbox/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/nazarii_romankiv/Projects/os-toolbox/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/nazarii_romankiv/Projects/os-toolbox/config.gypi
gyp verb common.gypi checking for gypi file: /Users/nazarii_romankiv/Projects/os-toolbox/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/nazarii_romankiv/Projects/os-toolbox/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/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/nazarii_romankiv/Library/Caches/node-gyp/12.22.6',
gyp info spawn args '-Dnode_gyp_dir=/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/nazarii_romankiv/Projects/os-toolbox',
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 verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
cc '-DNODE_GYP_MODULE_NAME=nothing' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/include/node -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/src -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/deps/openssl/config -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/deps/openssl/openssl/include -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/deps/uv/include -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/deps/zlib -I/Users/nazarii_romankiv/Library/Caches/node-gyp/12.22.6/deps/v8/include -O3 -gdwarf-2 -mmacosx-version-min=10.10 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/nothing/node_modules/node-addon-api/nothing.o.d.raw -c -o Release/obj.target/nothing/node_modules/node-addon-api/nothing.o ../node_modules/node-addon-api/nothing.c
rm -f Release/nothing.a && ./gyp-mac-tool filter-libtool libtool -static -o Release/nothing.a Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
c++ -bundle -undefined dynamic_lookup -Wl,-no_pie -Wl,-search_paths_first -mmacosx-version-min=10.10 -arch x86_64 -L./Release -stdlib=libc++ -o Release/os_toolbox.node Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/lib/strings.o Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/lib/arguments-validators.o Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/lib/export.o Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/mac/main.o Release/nothing.a
clang: error: no such file or directory: 'Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/lib/strings.o'
clang: error: no such file or directory: 'Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/lib/arguments-validators.o'
clang: error: no such file or directory: 'Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/lib/export.o'
clang: error: no such file or directory: 'Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/mac/main.o'
make: *** [Release/os_toolbox.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/bin/node" "/Users/nazarii_romankiv/.nvm/versions/node/v12.22.6/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose"
gyp ERR! cwd /Users/nazarii_romankiv/Projects/os-toolbox
gyp ERR! node -v v12.22.6
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @epic/os-toolbox@1.2.11 rebuild: `node-gyp rebuild "--verbose"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @epic/os-toolbox@1.2.11 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nazarii_romankiv/.npm/_logs/2021-09-15T17_57_29_060Z-debug.log
I am trying to build an addon for Mac, but it fails due to the fact that it for some reason cannot find the object files in the Release folder during the build.
Here is my config
{
"targets": [{
"target_name": "os_toolbox",
"cflags!": [ "-fno-exceptions"],
"cflags_cc!": [ "-fno-exceptions" ],
"defines": [ "NAPI_CPP_EXCEPTIONS", "NAPI_EXPERIMENTAL"],
"variables": {
"win_src": "<(module_root_dir)/cppsrc/win",
"linux_src": "<(module_root_dir)/cppsrc/linux",
"mac_src": "<(module_root_dir)/cppsrc/mac",
"shared_src": "<(module_root_dir)/cppsrc/lib"
},
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")"
],
"dependencies": [
"<!(node -p \"require('node-addon-api').gyp\")"
],
"sources": [
"<(shared_src)/strings.cpp",
"<(shared_src)/arguments-validators.cpp",
"<(shared_src)/export.cpp"
],
"conditions": [
[
"OS=='mac'",
{
"sources": [
"<(mac_src)/main.cpp"
],
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES",
}
}
],
]
}]
}
The error that looks odd is clang: error: no such file or directory: 'Release/obj.target/os_toolbox//Users/nazarii_romankiv/Projects/os-toolbox/cppsrc/mac/main.o'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing node-gyp rebuild --verbose with the shown binding.gyp configuration on macOS, then inspect the generated build/Makefile paths for the sources under cppsrc/lib and cppsrc/mac. Done means the native addon links successfully without looking for object files at absolute source paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, node.js, python
- Domain
- build-system, devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100