IBM / nodejs-idb-connector

A JavaScript (Node.js) library for communicating with Db2 for IBM i, with support for queries, procedures, and much more. Uses traditional callback-style syntax
MIT License
38 stars 23 forks source link

Build from source is failing since release 1.2.19 #182

Closed richardm90 closed 5 months ago

richardm90 commented 5 months ago

Describe the bug

I'm performing some testing on the package and have been adding some additional debug output statements to the source and so compile the package from source.

I was attempting some testing on a clean installation and found the build from source is now failing since 1.2.19. It works fine on 1.2.18.

To Reproduce

git clone git@github.com:IBM/nodejs-idb-connector.git
cd nodejs-idb-connector
npm install --build-from-source

The following works.

git clone git@github.com:IBM/nodejs-idb-connector.git
cd nodejs-idb-connector
git checkout tags/1.2.18
npm install --build-from-source

This is the console output from the build.

> idb-connector@1.2.19 install
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using @1.0.11
node-pre-gyp info using node@18.18.2 | os400 | ppc64
node-pre-gyp info build requesting source compile
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@18.18.2 | os400 | ppc64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@18.18.2 | os400 | ppc64
gyp info find Python using Python version 3.9.18 found at "/QOpenSys/pkgs/bin/python3"
gyp info spawn /QOpenSys/pkgs/bin/python3
gyp info spawn args [
gyp info spawn args   '/QOpenSys/pkgs/lib/nodejs18/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   '/home/richard/sandpit/nodejs-idb-connector/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/QOpenSys/pkgs/lib/nodejs18/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/RICHARD/.cache/node-gyp/18.18.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/RICHARD/.cache/node-gyp/18.18.2',
gyp info spawn args   '-Dnode_exp_file=/QOpenSys/pkgs/lib/nodejs18/include/node/node.exp',
gyp info spawn args   '-Dnode_gyp_dir=/QOpenSys/pkgs/lib/nodejs18/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/RICHARD/.cache/node-gyp/18.18.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/richard/sandpit/nodejs-idb-connector',
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 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@18.18.2 | os400 | ppc64
gyp info spawn gmake
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gmake: Entering directory '/home/richard/sandpit/nodejs-idb-connector/build'
  CXX(target) Release/obj.target/db2ia/src/db2ia/db2ia.o
gmake: g++: No such file or directory
gmake: *** [db2ia.target.mk:136: Release/obj.target/db2ia/src/db2ia/db2ia.o] Error 127
gmake: Leaving directory '/home/richard/sandpit/nodejs-idb-connector/build'
gyp ERR! build error 
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/QOpenSys/pkgs/lib/nodejs18/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
gyp ERR! System OS400 7.5
gyp ERR! command "/QOpenSys/pkgs/lib/nodejs18/bin/node" "/QOpenSys/pkgs/lib/nodejs18/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/richard/sandpit/nodejs-idb-connector/lib/binding/Release/napi3-ibmi-ppc64/db2ia.node" "--module_name=db2ia" "--module_path=/home/richard/sandpit/nodejs-idb-connector/lib/binding/Release/napi3-ibmi-ppc64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /home/richard/sandpit/nodejs-idb-connector
gyp ERR! node -v v18.18.2
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/QOpenSys/pkgs/lib/nodejs18/bin/node /QOpenSys/pkgs/lib/nodejs18/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/richard/sandpit/nodejs-idb-connector/lib/binding/Release/napi3-ibmi-ppc64/db2ia.node --module_name=db2ia --module_path=/home/richard/sandpit/nodejs-idb-connector/lib/binding/Release/napi3-ibmi-ppc64 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/richard/sandpit/nodejs-idb-connector/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
node-pre-gyp ERR! System OS400 7.5
node-pre-gyp ERR! command "/QOpenSys/pkgs/lib/nodejs18/bin/node" "/home/richard/sandpit/nodejs-idb-connector/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/richard/sandpit/nodejs-idb-connector
node-pre-gyp ERR! node -v v18.18.2
node-pre-gyp ERR!  -v v1.0.11
node-pre-gyp ERR! not ok 
Failed to execute '/QOpenSys/pkgs/lib/nodejs18/bin/node /QOpenSys/pkgs/lib/nodejs18/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/richard/sandpit/nodejs-idb-connector/lib/binding/Release/napi3-ibmi-ppc64/db2ia.node --module_name=db2ia --module_path=/home/richard/sandpit/nodejs-idb-connector/lib/binding/Release/napi3-ibmi-ppc64 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! code 1
npm ERR! path /home/richard/sandpit/nodejs-idb-connector
npm ERR! command failed
npm ERR! command /QOpenSys/pkgs/bin/bash -c node-pre-gyp install --fallback-to-build

npm ERR! A complete log of this run can be found in: /home/RICHARD/.npm/_logs/2024-02-07T08_41_10_536Z-debug-0.log
kadler commented 5 months ago

The relevant error from the log is this line: gmake: g++: No such file or directory

It's saying that you do not have the gcc-cplusplus package installed or that you don't have /QOpenSys/pkgs/bin on your PATH. I don't know how 1.2.18 would have made any difference here, though. The code has always been C++ and would have required the C++ compiler be installed.

Do you have gcc-cplusplus package installed? If you run which g++ what is the output?

richardm90 commented 5 months ago

Apologies, completely my fault.

I've got some symbolic links for gcc and g++ pointing to gcc-10 and g++-10 and haven't yet updated my .profile to include the relevant directory in PATH. I must have forgotten to manually update PATH after starting a new ssh session.

I've just tried it again and all good.

Thanks