Skip to content

the original C code do not compile with the current node binary. - #533

Open
UrielCh wants to merge 1 commit into
nodejs:mainfrom
UrielCh:main
Open

the original C code do not compile with the current node binary.#533
UrielCh wants to merge 1 commit into
nodejs:mainfrom
UrielCh:main

Conversation

@UrielCh

@UrielChUrielCh commented Sep 6, 2024

Copy link
Copy Markdown

I would like to add some github action to test all examples.
but I need the codebase to works first.

@UrielCh

Copy link
Copy Markdown
Author

}

// Free the per-addon-instance data.
static void addon_getting_unloaded(napi_env env, void* data, void* hint) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

napi_env should be the preferred type. Would you mind elaborating on the errors to be fixed?

@UrielCh

Copy link
Copy Markdown
Author

Running on a ARM Mac:

node --version
v20.16.0
cmake --version
cmake version 3.30.2
 npm run test

error from test script:
failed to install:
/Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi
/Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napi
failed tests:
/Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_with_object_wrap/node-addon-api

Error in 5-async-work/async_work_thread_safe_function/napi

testing: /Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.16.0 | darwin | arm64
gyp info find Python using Python version 3.12.5 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"
gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12
gyp info spawn args [
gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/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/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/uriel/Library/Caches/node-gyp/20.16.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/uriel/Library/Caches/node-gyp/20.16.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/uriel/Library/Caches/node-gyp/20.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
../binding.c:228:20: error: incompatible functionpointer types passing 'void (napi_env, void *, void *)' (aka 'void (struct napi_env__ *, void *, void *)') to parameter of type'node_api_nogc_finalize' (aka 'void (*)(const struct napi_env__ *, void *, void *)') [-Wincompatible-function-pointer-types]
addon_getting_unloaded,
^~~~~~~~~~~~~~~~~~~~~~
/Users/uriel/Library/Caches/node-gyp/20.16.0/include/node/js_native_api.h:324:69: note: passing argument to parameter 'finalize_cb' here
node_api_nogc_finalize finalize_cb,
^
1 error generated.
make: *** [Release/obj.target/binding/binding.o] Error 1
gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 23.5.0
gyp ERR!command"/Users/uriel/.nvm/versions/node/v20.16.0/bin/node""/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js""rebuild"
gyp ERR! cwd /Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi
gyp ERR! node -v v20.16.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok npm error code 1
npm error path /Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi
npm error command failed
npm error command sh -c node-gyp rebuild
npm error A complete log of this run can be found in: /Users/uriel/.npm/_logs/2024-09-06T14_36_36_496Z-debug-0.log
Error: Command failed: npm install
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.16.0 | darwin | arm64
gyp info find Python using Python version 3.12.5 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"
gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12
gyp info spawn args [
gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/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/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/uriel/Library/Caches/node-gyp/20.16.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/uriel/Library/Caches/node-gyp/20.16.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/uriel/Library/Caches/node-gyp/20.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
../binding.c:228:20: error: incompatible functionpointer types passing 'void (napi_env, void *, void *)' (aka 'void (struct napi_env__ *, void *, void *)') to parameter of type'node_api_nogc_finalize' (aka 'void (*)(const struct napi_env__ *, void *, void *)') [-Wincompatible-function-pointer-types]
addon_getting_unloaded,
^~~~~~~~~~~~~~~~~~~~~~
/Users/uriel/Library/Caches/node-gyp/20.16.0/include/node/js_native_api.h:324:69: note: passing argument to parameter 'finalize_cb' here
node_api_nogc_finalize finalize_cb,
^
1 error generated.
make: *** [Release/obj.target/binding/binding.o] Error 1
gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 23.5.0
gyp ERR!command"/Users/uriel/.nvm/versions/node/v20.16.0/bin/node""/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js""rebuild"
gyp ERR! cwd /Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi
gyp ERR! node -v v20.16.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok npm error code 1
npm error path /Users/uriel/src/node-addon-examples-org/src/5-async-work/async_work_thread_safe_function/napi
npm error command failed
npm error command sh -c node-gyp rebuild
npm error A complete log of this run can be found in: /Users/uriel/.npm/_logs/2024-09-06T14_36_36_496Z-debug-0.log
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at Object.<anonymous> (/Users/uriel/src/node-addon-examples-org/test_all.js:46:20)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
status: 1,
signal: null,
output: [
null,
<Buffer 0a 3e 20 61 73 79 6e 63 5f 77 6f 72 6b 5f 74 68 72 65 61 64 5f 73 61 66 65 5f 66 75 6e 63 74 69 6f 6e 40 30 2e 30 2e 30 20 69 6e 73 74 61 6c 6c 0a 3e ... 70 more bytes>,
<Buffer 67 79 70 20 69 6e 66 6f 20 69 74 20 77 6f 72 6b 65 64 20 69 66 20 69 74 20 65 6e 64 73 20 77 69 74 68 20 6f 6b 0a 67 79 70 20 69 6e 66 6f 20 75 73 69 ... 3425 more bytes>
],
pid: 91847,
stdout: <Buffer 0a 3e 20 61 73 79 6e 63 5f 77 6f 72 6b 5f 74 68 72 65 61 64 5f 73 61 66 65 5f 66 75 6e 63 74 69 6f 6e 40 30 2e 30 2e 30 20 69 6e 73 74 61 6c 6c 0a 3e ... 70 more bytes>,
stderr: <Buffer 67 79 70 20 69 6e 66 6f 20 69 74 20 77 6f 72 6b 65 64 20 69 66 20 69 74 20 65 6e 64 73 20 77 69 74 68 20 6f 6b 0a 67 79 70 20 69 6e 66 6f 20 75 73 69 ... 3425 more bytes>
}

Error in 6-threadsafe-function/thread_safe_function_round_trip/napi

gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.16.0 | darwin | arm64
gyp info find Python using Python version 3.12.5 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"
gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12
gyp info spawn args [
gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/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/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napi/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/uriel/Library/Caches/node-gyp/20.16.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/uriel/Library/Caches/node-gyp/20.16.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/uriel/Library/Caches/node-gyp/20.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napi',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
../round_trip.c:371:20: error: incompatible functionpointer types passing 'void (napi_env, void *, void *)' (aka 'void (struct napi_env__ *, void *, void *)') to parameter of type'node_api_nogc_finalize' (aka 'void (*)(const struct napi_env__ *, void *, void *)') [-Wincompatible-function-pointer-types]
addon_is_unloading,
^~~~~~~~~~~~~~~~~~
../round_trip.c:10:10: note: expanded from macro 'CHECK'if((expr) ==0) { \ ^~~~/Users/uriel/Library/Caches/node-gyp/20.16.0/include/node/js_native_api.h:324:69: note: passing argument to parameter 'finalize_cb' here node_api_nogc_finalize finalize_cb, ^1 error generated.make: *** [Release/obj.target/round_trip/round_trip.o] Error 1gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2gyp ERR! stack at ChildProcess.<anonymous> (/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)gyp ERR! System Darwin 23.5.0gyp ERR! command "/Users/uriel/.nvm/versions/node/v20.16.0/bin/node" "/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"gyp ERR! cwd /Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napigyp ERR! node -v v20.16.0gyp ERR! node-gyp -v v10.1.0gyp ERR! not ok npm error code 1npm error path /Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napinpm error command failednpm error command sh -c node-gyp rebuildnpm error A complete log of this run can be found in: /Users/uriel/.npm/_logs/2024-09-06T14_37_00_448Z-debug-0.logError: Command failed: npm installgyp info it worked if it ends with okgyp info using node-gyp@10.1.0gyp info using node@20.16.0 | darwin | arm64gyp info find Python using Python version 3.12.5 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12gyp info spawn args [gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/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/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napi/build/config.gypi',gyp info spawn args '-I',gyp info spawn args '/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',gyp info spawn args '-I',gyp info spawn args '/Users/uriel/Library/Caches/node-gyp/20.16.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/uriel/Library/Caches/node-gyp/20.16.0',gyp info spawn args '-Dnode_gyp_dir=/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp',gyp info spawn args '-Dnode_lib_file=/Users/uriel/Library/Caches/node-gyp/20.16.0/<(target_arch)/node.lib',gyp info spawn args '-Dmodule_root_dir=/Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napi',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 spawn makegyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]../round_trip.c:371:20: error: incompatible function pointer types passing 'void (napi_env, void *, void *)' (aka 'void (struct napi_env__ *, void *, void *)') to parameter of type 'node_api_nogc_finalize' (aka 'void (*)(const struct napi_env__ *, void *, void *)') [-Wincompatible-function-pointer-types] addon_is_unloading, ^~~~~~~~~~~~~~~~~~../round_trip.c:10:10: note: expanded from macro 'CHECK' if ((expr) == 0) { \ ^~~~/Users/uriel/Library/Caches/node-gyp/20.16.0/include/node/js_native_api.h:324:69: note: passing argument to parameter 'finalize_cb' here node_api_nogc_finalize finalize_cb, ^1 error generated.make: *** [Release/obj.target/round_trip/round_trip.o] Error 1gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2gyp ERR! stack at ChildProcess.<anonymous> (/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)gyp ERR! System Darwin 23.5.0gyp ERR! command "/Users/uriel/.nvm/versions/node/v20.16.0/bin/node" "/Users/uriel/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"gyp ERR! cwd /Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napigyp ERR! node -v v20.16.0gyp ERR! node-gyp -v v10.1.0gyp ERR! not ok npm error code 1npm error path /Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_round_trip/napinpm error command failednpm error command sh -c node-gyp rebuildnpm error A complete log of this run can be found in: /Users/uriel/.npm/_logs/2024-09-06T14_37_00_448Z-debug-0.log at genericNodeError (node:internal/errors:984:15) at wrappedFn (node:internal/errors:538:14) at checkExecSyncError (node:child_process:890:11) at execSync (node:child_process:962:15) at Object.<anonymous> (/Users/uriel/src/node-addon-examples-org/test_all.js:46:20) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) { status: 1, signal: null, output: [ null, <Buffer 0a 3e 207468726561645f 736166655f 66756e 6374696f 6e 5f 726f 756e 645f 7472697040302e 302e 3020696e 7374616c 6c 0a 3e ... 76 more bytes>, <Buffer 67797020696e 666f 20697420776f 726b 656420696620697420656e 64732077697468206f 6b 0a 67797020696e 666f 20757369 ... 3558 more bytes> ], pid: 94266, stdout: <Buffer 0a 3e 207468726561645f 736166655f 66756e 6374696f 6e 5f 726f 756e 645f 7472697040302e 302e 3020696e 7374616c 6c 0a 3e ... 76 more bytes>, stderr: <Buffer 67797020696e 666f 20697420776f 726b 656420696620697420656e 64732077697468206f 6b 0a 67797020696e 666f 20757369 ... 3558 more bytes>}

Error in 6-threadsafe-function/thread_safe_function_with_object_wrap/node-addon-api

...
...
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module '/Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_with_object_wrap/node-addon-api/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.16.0
Error: Command failed: node index.js
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module '/Users/uriel/src/node-addon-examples-org/src/6-threadsafe-function/thread_safe_function_with_object_wrap/node-addon-api/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.16.0
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at Object.<anonymous> (/Users/uriel/src/node-addon-examples-org/test_all.js:67:20)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
status: 1,
signal: null,
output: [
null,
<Buffer >,
<Buffer 6e 6f 64 65 3a 69 6e 74 65 72 6e 61 6c 2f 6d 6f 64 75 6c 65 73 2f 63 6a 73 2f 6c 6f 61 64 65 72 3a 31 31 34 38 0a 20 20 74 68 72 6f 77 20 65 72 72 3b ... 507 more bytes>
],
pid: 94709,
stdout: <Buffer >,
stderr: <Buffer 6e 6f 64 65 3a 69 6e 74 65 72 6e 61 6c 2f 6d 6f 64 75 6c 65 73 2f 63 6a 73 2f 6c 6f 61 64 65 72 3a 31 31 34 38 0a 20 20 74 68 72 6f 77 20 65 72 72 3b ... 507 more bytes>
}

here a node index.js is call but no node.js file exists.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@UrielCh@legendecas