ibmdb / node-ibm_db

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

Podman build fail with Apple M1 chip (same Dockerfile works on other Windows & Mac systems) #932

Closed sbohner14335 closed 1 year ago

sbohner14335 commented 1 year ago

Dockerfile:

FROM node:18
WORKDIR /app
COPY . /app/pmt2.0
WORKDIR /app/pmt2.0

RUN apt-get update
RUN apt-get -y install locales gcc

RUN npm install
RUN npm run build

# we generate this index.html in the backend/index.js
# if we leave it in dist, it will take priority and break the site. 
RUN rm /app/pmt2.0/dist/index.html

# fix locales for character encoding bug in ibm_db package
# FROM node:16 uses debian 10, which has this issue
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
    locale-gen
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en  
ENV LC_ALL en_US.UTF-8     

EXPOSE 8080
CMD ["node", "backend/index.js"]

Output

STEP 7/15: RUN npm install
npm notice 
npm notice New major version of npm available! 8.19.4 -> 9.7.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.7.2>
npm notice Run `npm install -g npm@9.7.2` to update!
npm notice 
npm ERR! code 1
npm ERR! path /app/pmt2.0/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.20.1
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 /app/pmt2.0/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! 
100.00% | 23705934 bytes downloaded out of 23705934 bytes.
npm ERR! 
npm ERR! Downloading and extraction of DB2 ODBC CLI Driver completed successfully.
npm ERR! 
npm ERR! make: Entering directory '/app/pmt2.0/node_modules/ibm_db/build'
npm ERR!   CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
npm ERR! make: Leaving directory '/app/pmt2.0/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.1.0
npm ERR! gyp info using node@16.20.1 | linux | arm64
npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.20.1/node-v16.20.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.20.1/node-v16.20.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.20.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.20.1/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/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   '/app/pmt2.0/node_modules/ibm_db/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.cache/node-gyp/16.20.1/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=/root/.cache/node-gyp/16.20.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.20.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/app/pmt2.0/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!  #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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 6.3.6-200.fc38.aarch64
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/app/pmt2.0/node_modules/ibm_db/installer/clidriver"
npm ERR! gyp ERR! cwd /app/pmt2.0/node_modules/ibm_db
npm ERR! gyp ERR! node -v v16.20.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok 
npm ERR! 
npm ERR!     at ChildProcess.exithandler (node:child_process:402:12)
npm ERR!     at ChildProcess.emit (node:events:513:28)
npm ERR!     at maybeClose (node:internal/child_process:1100:16)
npm ERR!     at Process.ChildProcess._handle.onexit (node:internal/child_process:304: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! }

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-06-26T19_17_01_542Z-debug-0.log
Error: building at STEP "RUN npm install": while running runtime: exit status 1
bimalkjha commented 1 year ago

@sbohner14335 Please follow these documented steps to install ibm_db on M1 chip system: https://github.com/ibmdb/node-ibm_db/blob/master/INSTALL.md#m1chip Make sure you have installed x64 version (Intel only) on node.js so that during installation time, ibm_db should print arch=x64 or arch=amd64. ibm_db do not work for arch=arm64. Thanks.