IBM / node-odbc

ODBC bindings for node
MIT License
146 stars 76 forks source link

[BUG] Pre-built binaries not installable - Need prebuilt PPC64 linux releases odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz #392

Open phpdave opened 3 months ago

phpdave commented 3 months ago

Describe your system

Describe the bug When running npm install on a Power Linux RHEL9 host it can't download pre-built binaries because their are none for linux ppc64. Trying to build it locally is also having issues with

error: invalid conversion from ‘napi_finalize’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]

Expected behavior Expectation was that there would be pre-built binaries for PowerPC Linux and wouldnt need to install gcc, make, g++. The hassles to get sql.h from unixODBC-devel using subscription-manager repos --enable codeready-builder-for-rhel-9-ppcle-rpms https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/package_manifest/index#CodeReadyLinuxBuilder-repository https://access.redhat.com/articles/4348511

To Reproduce Steps to reproduce the behavior:

  1. On a RHEL9 PPC computer run npm install with node-odbc in the package.json file

Additional context

Here's the error message

npm ERR! code 1
npm ERR! path /home/the_user/the_project/server_side_code/node_modules/odbc
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! make: Entering directory '/home/the_user/the_project/server_side_code/node_modules/odbc/build'
npm ERR!   CXX(target) Release/obj.target/odbc/src/odbc.o
npm ERR! make: Leaving directory '/home/the_user/the_project/server_side_code/node_modules/odbc/build'
npm ERR! Failed to execute '/home/the_user/.nvm/versions/node/v18.20.2/bin/node /home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11
npm ERR! node-pre-gyp info using node@18.20.2 | linux | ppc64
npm ERR! node-pre-gyp info check checked for "/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for odbc@2.4.8 and node@18.20.2 (node-v108 ABI, glibc) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@18.20.2 | linux | ppc64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@18.20.2 | linux | ppc64
npm ERR! gyp info find Python using Python version 3.9.18 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.20.2/node-v18.20.2-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.20.2/node-v18.20.2-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v18.20.2/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.20.2/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/the_user/the_project/server_side_code/node_modules/odbc/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/the_user/.cache/node-gyp/18.20.2/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/the_user/.cache/node-gyp/18.20.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/the_user/.cache/node-gyp/18.20.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/the_user/the_project/server_side_code/node_modules/odbc',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@18.20.2 | linux | ppc64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi.h:2725,
npm ERR!                  from ../src/odbc.h:27,
npm ERR!                  from ../src/odbc.cpp:22:
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h: In instantiation of ‘napi_status Napi::details::AttachData(napi_env, napi_value, FreeType*, napi_finalize, void*) [with FreeType = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_value = napi_value__*; napi_finalize = void (*)(napi_env__*, void*, void*)]’:
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h:1965:39:   required from ‘napi_status Napi::CreateFunction(napi_env, const char*, napi_callback, CbData*, napi_value__**) [with CbData = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_callback = napi_value__* (*)(napi_env__*, napi_callback_info__*); napi_value = napi_value__*]’
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h:2021:38:   required from ‘static Napi::Function Napi::Function::New(napi_env, Callable, const char*, void*) [with Callable = Napi::Value (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]’
npm ERR! ../src/odbc.cpp:148:45:   required from here
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h:63:47: error: invalid conversion from ‘napi_finalize’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]
npm ERR!    63 |   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm ERR!       |                                               ^~~~~~~~~
npm ERR!       |                                               |
npm ERR!       |                                               napi_finalize {aka void (*)(napi_env__*, void*, void*)}
npm ERR! In file included from /home/the_user/.cache/node-gyp/18.20.2/include/node/node_api.h:12,
npm ERR!                  from /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi.h:4,
npm ERR!                  from ../src/odbc.h:27,
npm ERR!                  from ../src/odbc.cpp:22:
npm ERR! /home/the_user/.cache/node-gyp/18.20.2/include/node/js_native_api.h:516:43: note:   initializing argument 4 of ‘napi_status napi_add_finalizer(napi_env, napi_value, void*, node_api_nogc_finalize, void*, napi_ref__**)’
npm ERR!   516 |                    node_api_nogc_finalize finalize_cb,
npm ERR!       |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
npm ERR! make: *** [odbc.target.mk:133: Release/obj.target/odbc/src/odbc.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 5.14.0-427.24.1.el9_4.ppc64le
npm ERR! gyp ERR! command "/home/the_user/.nvm/versions/node/v18.20.2/bin/node" "/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node" "--module_name=odbc" "--module_path=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
npm ERR! gyp ERR! cwd /home/the_user/the_project/server_side_code/node_modules/odbc
npm ERR! gyp ERR! node -v v18.20.2
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/home/the_user/.nvm/versions/node/v18.20.2/bin/node /home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/the_user/the_project/server_side_code/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Linux 5.14.0-427.24.1.el9_4.ppc64le
npm ERR! node-pre-gyp ERR! command "/home/the_user/.nvm/versions/node/v18.20.2/bin/node" "/home/the_user/the_project/server_side_code/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/the_user/the_project/server_side_code/node_modules/odbc
npm ERR! node-pre-gyp ERR! node -v v18.20.2
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /home/the_user/.npm/_logs/2024-07-28T20_20_44_555Z-debug-0.log
cblair-dev commented 2 months ago

I also get a very similar error on my windows 11 machine. Did you have any luck figuring out the issue?

I can post my error log as well if it helps. It looks very similar to yours though.

phpdave commented 2 months ago

@cblair-dev since you are running it from windows I would of expected it to grab the odbc-v2.4.8-win32-x64-napi-v6.tar.gz on this page https://github.com/markdirish/node-odbc/releases

image

cblair-dev commented 2 months ago

@phpdave thanks for the quick reply. Here is my error report. It appears that it is trying to grab that file, but fails because of not being able to verify the first certificate? Not sure I know what that means.

edit - the code wrap makes the formatting word wrap for some reason, leaving it without for now

124 verbose node v18.20.4 125 verbose npm v10.7.0 126 error code 1 127 error path C:\vuetest2\node_modules\odbc 128 error command failed 129 error command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build 130 error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\user\AppData\Roaming\nvm\v18.20.4\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6\odbc.node --module_name=odbc --module_path=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) 131 error node-pre-gyp info it worked if it ends with ok 131 error node-pre-gyp info using node-pre-gyp@1.0.11 131 error node-pre-gyp info using node@18.20.4 | win32 | x64 131 error node-pre-gyp info check checked for "C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6\odbc.node" (not found) 131 error node-pre-gyp http GET https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-win32-x64-napi-v6.tar.gz 131 error node-pre-gyp ERR! install request to https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-win32-x64-napi-v6.tar.gz failed, reason: unable to verify the first certificate 131 error node-pre-gyp WARN Pre-built binaries not installable for odbc@2.4.8 and node@18.20.4 (node-v108 ABI, unknown) (falling back to source compile with node-gyp) 131 error node-pre-gyp WARN Hit error request to https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-win32-x64-napi-v6.tar.gz failed, reason: unable to verify the first certificate 131 error gyp info it worked if it ends with ok 131 error gyp info using node-gyp@10.1.0 131 error gyp info using node@18.20.4 | win32 | x64 131 error gyp info ok 131 error gyp info it worked if it ends with ok 131 error gyp info using node-gyp@10.1.0 131 error gyp info using node@18.20.4 | win32 | x64 131 error gyp info find Python using Python version 3.11.2 found at "C:\Python311\python.exe" 131 error gyp http GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz 131 error gyp http fetch GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz attempt 1 failed with UNABLE_TO_VERIFY_LEAF_SIGNATURE 131 error gyp WARN install got an error, rolling back install 131 error gyp ERR! configure error 131 error gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz failed, reason: unable to verify the first certificate 131 error gyp ERR! stack at ClientRequest. (C:\Users\user\AppData\Roaming\nvm\v18.20.4\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14) 131 error gyp ERR! stack at ClientRequest.emit (node:events:517:28) 131 error gyp ERR! stack at _destroy (node:_http_client:882:13) 131 error gyp ERR! stack at onSocketNT (node:_http_client:902:5) 131 error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:83:21) 131 error gyp ERR! System Windows_NT 10.0.22621 131 error gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\user\AppData\Roaming\nvm\v18.20.4\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6\odbc.node" "--module_name=odbc" "--module_path=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" 131 error gyp ERR! cwd C:\vuetest2\node_modules\odbc 131 error gyp ERR! node -v v18.20.4 131 error gyp ERR! node-gyp -v v10.1.0 131 error gyp ERR! not ok 131 error node-pre-gyp ERR! build error 131 error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\user\AppData\Roaming\nvm\v18.20.4\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6\odbc.node --module_name=odbc --module_path=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) 131 error node-pre-gyp ERR! stack at ChildProcess. (C:\vuetest2\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) 131 error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:517:28) 131 error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16) 131 error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:303:5) 131 error node-pre-gyp ERR! System Windows_NT 10.0.22621 131 error node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\vuetest2\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" 131 error node-pre-gyp ERR! cwd C:\vuetest2\node_modules\odbc 131 error node-pre-gyp ERR! node -v v18.20.4 131 error node-pre-gyp ERR! node-pre-gyp -v v1.0.11 131 error node-pre-gyp ERR! not ok 132 verbose exit 1 133 verbose code 1 134 silly unfinished npm timer reify 1722542964681 135 silly unfinished npm timer reify:build 1722542965274 136 silly unfinished npm timer build 1722542965274 137 silly unfinished npm timer build:deps 1722542965274 138 silly unfinished npm timer build:run:install 1722542965276 139 silly unfinished npm timer build:run:install:node_modules/odbc 1722542965276 140 error A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2024-08-01T20_09_24_298Z-debug-0.log

kadler commented 2 months ago

@cblair-dev something is wrong with your setup and is a completely separate problem

failed, reason: unable to verify the first certificate

It tries to download the prebuilt binary, but fails due to HTTPS certificate validation failure. Then it falls back to building it, but that also fails because of HTTP certificate validation failure downloading the nodejs headers.

Do you have a corporate HTTPS proxy of some kind? If so you may need to add its certificate to your CA trust (not sure how to do that on Windows) or disable validation in npm.

cblair-dev commented 2 months ago

@kadler this is what I am reading as well when researching this issue.

I am currently in talks with our IT department to see if they are aware of what would be causing it.

kadler commented 2 months ago

@phpdave the current pre-built binaries rely on GitHub Actions to build, which does not support Power. We would need to find another CI vendor that has support for Power or figure out a way to cross-compile from the x86 Linux runner provided by GH.

cblair-dev commented 2 months ago

@kadler, the one thing that is making me confused more than anything is that if I just remove odbc from my package.json, delete my node_modules, and rebuild it, I have zero issues.

If it is a certificate issue, wouldn't I get a similar error with all of the libraries I try to download?

phpdave commented 2 months ago

FWIW - might be a strict typing issue in c++ with the changes made in node.js core forcing a strict type node_api_nogc_finalize now and complaining about using the non garbage collection type napi_finalize. Something that seems to have been done around 18.20.2 to 18.20.3

Might be related in node/src/js_native_api_types.h in core https://github.com/nodejs/node/blame/d1229eeca48ef349a8a9fc0748bc01789bdbce91/src/js_native_api_types.h#L154

or node-addon-api https://github.com/nodejs/node-addon-api/commit/40bcb09e6b82e7a1164cb3de56cb503d9b5a3d37

but im not really versed in node.js internals or c++ (been awhile)

mielvds commented 2 months ago

I get the same issue on my Apple M1 macbook:

npm error node-pre-gyp info using node-pre-gyp@1.0.11
npm error node-pre-gyp info using node@20.16.0 | darwin | arm64
npm error node-pre-gyp info check checked for "/Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/odbc/lib/bindings/napi-v6/odbc.node" (not found)
npm error node-pre-gyp http GET https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz
npm error node-pre-gyp ERR! install response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz 
npm error node-pre-gyp WARN Pre-built binaries not installable for odbc@2.4.8 and node@20.16.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) 
npm error node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz 
...

The build with node-gyp also fails:

npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error ../src/odbc.cpp:228:41: warning: comparison of array 'odbcError.state' not equal to a null pointer is always true [-Wtautological-pointer-compare]
npm error       Napi::String::New(env, (odbcError.state != NULL) ? (const char*)odbcError.state : "")
npm error                               ~~~~~~~~~~^~~~~    ~~~~
npm error In file included from ../src/odbc.cpp:22:
npm error In file included from ../src/odbc.h:27:
npm error In file included from /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi.h:2725:
npm error /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
npm error   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm error            ^~~~~~~~~~~~~~~~~~
npm error /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm error     status = Napi::details::AttachData(env, *result, data);
npm error                             ^
npm error /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm error   napi_status status = CreateFunction(env,
npm error                        ^
npm error ../src/odbc.cpp:148:42: note: in instantiation of function template specialization 'Napi::Function::New<Napi::Value (*)(const Napi::CallbackInfo &)>' requested here
npm error   exports.Set("connect", Napi::Function::New(env, ODBC::Connect));
npm error                                          ^
npm error /Users/mielvandersande/Library/Caches/node-gyp/20.16.0/include/node/js_native_api.h:520:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_nogc_finalize' (aka 'void (*)(const napi_env__ *, void *, void *)') for 4th argument
npm error napi_add_finalizer(napi_env env,
npm error ^
npm error 1 warning and 1 error generated.
npm error make: *** [Release/obj.target/odbc/src/odbc.o] Error 1
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/mielvandersande/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Darwin 23.5.0
...
mielvds commented 2 months ago

The node-gyp build does work with node version 21.5.0, so that seems to be another unrelated issue. See https://github.com/node-ffi-napi/node-ffi-napi/issues/267

phpdave commented 2 months ago

Note this issue also occurs on

OS: Linux 5.14.0-427.26.1.el9_4.ppc64le node: v20.16.0 (July 24, 2024) node-gyp: v10.1.0 (Mar 25, 2024)

> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h: In instantiation of ‘napi_status Napi::details::AttachData(napi_env, napi_value, FreeType*, napi_finalize, void*) [with FreeType = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_value = napi_value__*; napi_finalize = void (*)(napi_env__*, void*, void*)]’:
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h:1965:39:   required from ‘napi_status Napi::CreateFunction(napi_env, const char*, napi_callback, CbData*, napi_value__**) [with CbData = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_callback = napi_value__* (*)(napi_env__*, napi_callback_info__*); napi_value = napi_value__*]’
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h:2021:38:   required from ‘static Napi::Function Napi::Function::New(napi_env, Callable, const char*, void*) [with Callable = Napi::Value (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]’
> 1737 error ../src/odbc.cpp:148:45:   required from here
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h:63:47: error: invalid conversion from ‘napi_finalize’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]
> 1737 error    63 |   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
> 1737 error       |                                               ^~~~~~~~~
> 1737 error       |                                               |
> 1737 error       |                                               napi_finalize {aka void (*)(napi_env__*, void*, void*)}
> 1737 error In file included from /home/the_user/.cache/node-gyp/20.16.0/include/node/node_api.h:12,
> 1737 error                  from /www/the_project/server/node_modules/node-addon-api/napi.h:4,
> 1737 error                  from ../src/odbc.h:27,
> 1737 error                  from ../src/odbc.cpp:22:
> 1737 error /home/the_user/.cache/node-gyp/20.16.0/include/node/js_native_api.h:523:43: note:   initializing argument 4 of ‘napi_status napi_add_finalizer(napi_env, napi_value, void*, node_api_nogc_finalize, void*, napi_ref__**)’
> 1737 error   523 |                    node_api_nogc_finalize finalize_cb,
> 1737 error       |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> 1737 error make: *** [odbc.target.mk:128: Release/obj.target/odbc/src/odbc.o] Error 1
> 1737 error gyp ERR! build error
> 1737 error gyp ERR! stack Error: `make` failed with exit code: 2
> 1737 error gyp ERR! stack at ChildProcess.<anonymous> (/home/the_user/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
> 1737 error gyp ERR! System Linux 5.14.0-427.26.1.el9_4.ppc64le
> 1737 error gyp ERR! command "/home/the_user/.nvm/versions/node/v20.16.0/bin/node" "/home/the_user/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6/odbc.node" "--module_name=odbc" "--module_path=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
> 1737 error gyp ERR! cwd /www/the_project/server/node_modules/odbc
> 1737 error gyp ERR! node -v v20.16.0
> 1737 error gyp ERR! node-gyp -v v10.1.0
> 1737 error gyp ERR! not ok
> 1737 error node-pre-gyp ERR! build error
> 1737 error node-pre-gyp ERR! stack Error: Failed to execute '/home/the_user/.nvm/versions/node/v20.16.0/bin/node /home/the_user/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
> 1737 error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/www/the_project/server/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
> 1737 error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
> 1737 error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
> 1737 error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
> 1737 error node-pre-gyp ERR! System Linux 5.14.0-427.26.1.el9_4.ppc64le
> 1737 error node-pre-gyp ERR! command "/home/the_user/.nvm/versions/node/v20.16.0/bin/node" "/www/the_project/server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
> 1737 error node-pre-gyp ERR! cwd /www/the_project/server/node_modules/odbc
> 1737 error node-pre-gyp ERR! node -v v20.16.0
> 1737 error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
> 1737 error node-pre-gyp ERR! not ok

@mielvds - Glad to hear you got it working on node 21.5.0 (CPU: darwin-arm64) , do you know what version of node-gyp you were using?

phpdave commented 2 months ago

Note this issue doesn't occur on

OS: Linux 5.14.0-427.26.1.el9_4.ppc64le node: v22.6.0 (Aug 6, 2024)

kadler commented 2 months ago

I think this is a bug in node-addon-api. Looks like it was potentially fixed here: https://github.com/nodejs/node-addon-api/commit/40bcb09e6b82e7a1164cb3de56cb503d9b5a3d37#diff-cd0b229bcaf532206661e2ee1a603a7f60ac22ecfcb239920f6b42a34d909f34L68

kadler commented 2 months ago

This would likely also be fixed by the change made to remove NAPI_EXPERIMENTAL in #381, but a new release has not yet been released. Next week we'll be cleaning up some things and get a new npm release made.

kadler commented 2 months ago

Just confirmed that yes, prior to #381 the build files, while after it now succeeds.

phpdave commented 2 months ago

Thank you much @kadler ! you rock!

kadler commented 2 months ago

We've released version 2.4.9 which includes the NAPI_EXPERIMENTAL fix: https://www.npmjs.com/package/odbc/v/2.4.9