ibmdb / node-ibm_db

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

I'm getting error '../src/odbc.h:27:10: fatal error: sqlcli1.h: No such file or directory' during Installation in Docker #868

Closed vic-ibm closed 2 years ago

vic-ibm commented 2 years ago

Hi, I'm trying to install ibm_db but it appears to be failing at the command 'node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"'

This is my Dockerfile: FROM registry.cirrus.ibm.com/public/nodejs-14:latest USER root RUN su - RUN yum install sudo -y WORKDIR /home/node/app COPY package*.json ./ RUN sudo npm install COPY . . RUN npm run build CMD [ "npm","start" ]

This is the error log i get during Docker build.

10 13.85 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 ...

10 13.85

100.00% | 23418799 bytes downloaded out of 23418799 bytes.

10 26.68

10 26.68 Downloading and extraction of DB2 ODBC CLI Driver completed successfully.

10 26.68

10 28.26 make: Entering directory '/home/node/app/node_modules/ibm_db/build'

10 28.26 CXX(target) Release/obj.target/odbc_bindings/src/odbc.o

10 28.26 make: Leaving directory '/home/node/app/node_modules/ibm_db/build'

10 28.26

10 28.26 Error: Command failed: node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"

10 28.26 In file included from ../src/odbc.cpp:29:

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

10 28.26 #include

10 28.26 ^~~

10 28.26 compilation terminated.

10 28.26 make: *** [odbc_bindings.target.mk:108: Release/obj.target/odbc_bindings/src/odbc.o] Error 1

10 28.26 gyp ERR! build error

10 28.26 gyp ERR! stack Error: make failed with exit code: 2

10 28.26 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)

10 28.26 gyp ERR! stack at ChildProcess.emit (events.js:400:28)

10 28.26 gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)

10 28.26 gyp ERR! System Linux 5.10.104-linuxkit

10 28.26 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/home/node/app/node_modules/ibm_db/installer/clidriver"

10 28.26 gyp ERR! cwd /home/node/app/node_modules/ibm_db

10 28.26 gyp ERR! node -v v14.18.2

10 28.26 gyp ERR! node-gyp -v v5.1.0

10 28.26 gyp ERR! not ok

10 28.26

10 28.26 at ChildProcess.exithandler (child_process.js:383:12)

10 28.26 at ChildProcess.emit (events.js:400:28)

10 28.26 at maybeClose (internal/child_process.js:1058:16)

10 28.26 at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) {

10 28.26 killed: false,

10 28.26 code: 1,

10 28.26 signal: null,

10 28.26 cmd: 'node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"'

10 28.26 }

bimalkjha commented 2 years ago

@vic-ibm It seems you are trying to install ibm_db on a 32bit Linux OS or 32bit node.js is installed. Because, the pasted error mentions that ibm_db is trying to download linuxia32_odbc_cli.tar.gz and 32bit platform is not supported by ibm_db. Please check the starting output of npm install ibm_db command. You can see the platform as output. Need to correct env from your side. If still unable to resolve the issue, please share complete output of npm install ibm_db from start and not only the error part. Thanks.

vic-ibm commented 2 years ago

I'm trying to install it on my M1 Chip Macbook, maybe that's what's causing the issue.

Here is the entire log of npm install

11 [7/9] RUN sudo npm install

11 sha256:f212bb44439252367cc155d161feec2725a972a91452f3ef1306ad1ef5ca95c7

11 0.517 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

11 14.14

11 14.14 > ibm_db@2.8.1 install /home/node/app/node_modules/ibm_db

11 14.14 > node installer/driverInstall.js

11 14.14

11 14.20 platform = linux, arch = arm64, node.js version = v14.18.2

11 14.21 make version =GNU Make 4.2.1

11 14.25

11 14.25 ****

11 14.25 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 /home/node/app/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.

11 14.25 ****

11 14.25

11 14.25 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 ...

11 14.25

100.00% | 23418799 bytes downloaded out of 23418799 bytes.

11 39.61

11 39.61 Downloading and extraction of DB2 ODBC CLI Driver completed successfully.

11 39.61

11 41.17 make: Entering directory '/home/node/app/node_modules/ibm_db/build'

11 41.17 CXX(target) Release/obj.target/odbc_bindings/src/odbc.o

11 41.17 make: Leaving directory '/home/node/app/node_modules/ibm_db/build'

11 41.17

11 41.17 Error: Command failed: node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"

11 41.17 In file included from ../src/odbc.cpp:29:

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

11 41.17 #include

11 41.17 ^~~

11 41.17 compilation terminated.

11 41.17 make: *** [odbc_bindings.target.mk:108: Release/obj.target/odbc_bindings/src/odbc.o] Error 1

11 41.17 gyp ERR! build error

11 41.17 gyp ERR! stack Error: make failed with exit code: 2

11 41.17 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)

11 41.17 gyp ERR! stack at ChildProcess.emit (events.js:400:28)

11 41.17 gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)

11 41.17 gyp ERR! System Linux 5.10.104-linuxkit

11 41.17 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/home/node/app/node_modules/ibm_db/installer/clidriver"

11 41.17 gyp ERR! cwd /home/node/app/node_modules/ibm_db

11 41.17 gyp ERR! node -v v14.18.2

11 41.17 gyp ERR! node-gyp -v v5.1.0

11 41.17 gyp ERR! not ok

11 41.17

11 41.17 at ChildProcess.exithandler (child_process.js:383:12)

11 41.17 at ChildProcess.emit (events.js:400:28)

11 41.17 at maybeClose (internal/child_process.js:1058:16)

11 41.17 at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) {

11 41.17 killed: false,

11 41.17 code: 1,

11 41.17 signal: null,

11 41.17 cmd: 'node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"'

11 41.17 }

11 41.64 npm WARN parts-classification-process-etl@1.0.0 No description

11 41.65 npm WARN parts-classification-process-etl@1.0.0 No repository field.

11 41.67 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):

11 41.67 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})

11 41.67

11 41.69 npm ERR! code ELIFECYCLE

11 41.69 npm ERR! errno 1

11 41.69 npm ERR! ibm_db@2.8.1 install: node installer/driverInstall.js

11 41.69 npm ERR! Exit status 1

11 41.69 npm ERR!

11 41.69 npm ERR! Failed at the ibm_db@2.8.1 install script.

11 41.69 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

11 41.74

11 41.74 npm ERR! A complete log of this run can be found in:

11 41.74 npm ERR! /root/.npm/_logs/2022-06-28T16_25_58_328Z-debug.log

11 ERROR: executor failed running [/bin/sh -c sudo npm install]: exit code: 1

bimalkjha commented 2 years ago

@vic-ibm You need to use x64 version of node.js on M1 Chip system to install ibm_db. So, download and install https://nodejs.org/dist/v17.6.0/node-v17.6.0-darwin-x64.tar.gz or replace the installed nodejs directory with this one and then install ibm_db. It works for me. Thanks.

vic-ibm commented 2 years ago

I'm already using x64 node.js and am able to use the library outside of Docker. The issue only arises while trying to build the image on Docker Desktop at the step where my build tries to install the ibm_db library. I was able to build the image on another non M1 Chip machine.

vic-ibm commented 2 years ago

Apparently you need to emulate an Intel x64 image to make the build work. I was able to make the build work on my M1 Chip Macbook by running the following command:

docker build . --platform linux/amd64