ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
188 stars 151 forks source link

Running on Docker: fatal error: sqlcli1.h: No such file or directory #900

Closed na-tasja closed 1 year ago

na-tasja commented 1 year ago

Hi there,

I'm raising an issue as a bug report, but really this is an ask for help as I'm stumped on trying to get this running.

I am running a node express app that uses ibm_db, running in a Docker container.

On installation, I get this error:

npm ERR! code 1
npm ERR! path /runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db
npm ERR! command failed
npm ERR! command sh -c node installer/driverInstall.js
npm ERR! platform = linux, arch = arm64, node.js version = v16.16.0
npm ERR! make version =GNU Make 4.2.1
npm ERR! 
npm ERR! ****************************************
npm ERR! You are downloading a package which includes the Node.js module for IBM DB2/Informix.  The module is licensed under the Apache License 2.0. The package also includes IBM ODBC and CLI Driver from IBM, which is automatically downloaded as the node module is installed on your system/device. The license agreement to the IBM ODBC and CLI Driver is available in /runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db/installer/clidriver. Check for additional dependencies, which may come with their own license agreement(s). Your use of the components of the package and dependencies constitutes your acceptance of their respective license agreements. If you do not accept the terms of any license agreement(s), then delete the relevant component(s) from your device.
npm ERR! ****************************************
npm ERR! 
npm ERR! Downloading DB2 ODBC CLI Driver from https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxia32_odbc_cli.tar.gz ...
npm ERR! 
npm ERR! 
0.03% | 8192 bytes downloaded out of 23418799 bytes.

...gets to 100%

npm ERR! Downloading and extraction of DB2 ODBC CLI Driver completed successfully.
npm ERR! 
npm ERR! make: Entering directory '/runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db/build'
npm ERR!   CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
npm ERR! make: Leaving directory '/runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db/build'
npm ERR! 
npm ERR! Error: Command failed: node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | linux | arm64
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/opt/hostedtoolcache/node/16.16.0/arm64/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   '/runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/opt/hostedtoolcache/node/16.16.0/arm64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/runner/.cache/node-gyp/16.16.0/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/runner/.cache/node-gyp/16.16.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/opt/hostedtoolcache/node/16.16.0/arm64/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/runner/.cache/node-gyp/16.16.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/odbc.cpp:29:
npm ERR! ../src/odbc.h:27:10: fatal error: sqlcli1.h: No such file or directory
npm ERR!    27 | #include <sqlcli1.h>
npm ERR!       |          ^~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [odbc_bindings.target.mk:114: Release/obj.target/odbc_bindings/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.onExit (/opt/hostedtoolcache/node/16.16.0/arm64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.4.219-126.411.amzn2.aarch64
npm ERR! gyp ERR! command "/opt/hostedtoolcache/node/16.16.0/arm64/bin/node" "/opt/hostedtoolcache/node/16.16.0/arm64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db/installer/clidriver"
npm ERR! gyp ERR! cwd /runner/_work/ips-db2-connector/ips-db2-connector/node_modules/ibm_db
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok 
npm ERR! 
npm ERR!     at ChildProcess.exithandler (node:child_process:398:12)
npm ERR!     at ChildProcess.emit (node:events:527:28)
npm ERR!     at maybeClose (node:internal/child_process:1092:16)
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR!   code: 1,
npm ERR!   killed: false,
npm ERR!   signal: null,
npm ERR!   cmd: 'node-gyp configure build  --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"'
npm ERR! }

I believe the problem is here?

 ../src/odbc.h:27:10: fatal error: sqlcli1.h: No such file or directory

I was wondering if there were anything else I needed to do to get this running in my docker container?

Thanks,

N

bimalkjha commented 1 year ago

@na-tasja You mentioned "Docker image using: amd64/node:16", but in the install output of ibm_db, we can see: "platform = linux, arch = arm64, node.js version = v16.16.0". i.e. you are using arm64 flavor of node.js not amd64. Just search for arm64 in Readme.md file and you'll see all info about it. arm64 architecture is not supported by ibm_db. You need to install Intel-only version of node.js and then install ibm_db. ibm_db works only with Intel/x64 version of node.js. Thanks.

na-tasja commented 1 year ago

Thanks for your help - I've managed to get it working in docker now :)