node-zookeeper icon indicating copy to clipboard operation
node-zookeeper copied to clipboard

Version 5.1.0 onwards does not install on Ubuntu 22.04

Open dreusel opened this issue 2 years ago • 3 comments

Describe the bug The native code fails to compile and link from version 5.1.0 onwards. The culprit seems to be an undefined reference to `FIPS_mode'

To Reproduce On a Ubuntu 22.04 machine, npm install zookeeper

Error Log

npm install [email protected]
npm ERR! code 1
npm ERR! path /xxx/node_modules/zookeeper
npm ERR! command failed
npm ERR! command sh /tmp/install-dd6ddfcd.sh
npm ERR! Decompressed file
npm ERR! 
npm ERR! > [email protected] build
npm ERR! > node-gyp-build
npm ERR! 
npm ERR! make: Entering directory '/xxx/node_modules/zookeeper/build'
npm ERR!   ACTION binding_gyp_libzk_target_build_zk_client_lib .
npm ERR!   CC       cli.o
npm ERR!   CC       zookeeper.lo
npm ERR!   CC       recordio.lo
npm ERR!   CC       zookeeper.jute.lo
npm ERR!   CC       zk_log.lo
npm ERR!   CC       zk_hashtable.lo
npm ERR!   CC       addrvec.lo
npm ERR!   CC       st_adaptor.lo
npm ERR!   CCLD     libzkst.la
npm ERR!   CC       hashtable_itr.lo
npm ERR!   CC       hashtable.lo
npm ERR!   CCLD     libhashtable.la
npm ERR!   CCLD     libzookeeper_st.la
npm ERR!   CCLD     cli_st
npm ERR! make: Leaving directory '/xxx/node_modules/zookeeper/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/xxx/.nvm/versions/node/v14.20.0/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   '/xxx/node_modules/zookeeper/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/xxx/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/xxx/.cache/node-gyp/14.20.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/xxx/.cache/node-gyp/14.20.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/xxx/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/xxx/.cache/node-gyp/14.20.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/xxx/node_modules/zookeeper',
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! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! /usr/bin/ld: ./.libs/libzookeeper_st.a(zookeeper.o): in function `init_ssl_for_socket':
npm ERR! zookeeper.c:(.text+0x5812): undefined reference to `FIPS_mode'
npm ERR! collect2: error: ld returned 1 exit status
npm ERR! make[2]: *** [Makefile:931: cli_st] Error 1
npm ERR! make[1]: *** [Makefile:752: all] Error 2
npm ERR! /xxx/node_modules/shelljs/src/common.js:401
npm ERR!       if (config.fatal) throw e;
npm ERR!                         ^
npm ERR! 
npm ERR! Error: exec: ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! /usr/bin/ld: ./.libs/libzookeeper_st.a(zookeeper.o): in function `init_ssl_for_socket':
npm ERR! zookeeper.c:(.text+0x5812): undefined reference to `FIPS_mode'
npm ERR! collect2: error: ld returned 1 exit status
npm ERR! make[2]: *** [Makefile:931: cli_st] Error 1
npm ERR! make[1]: *** [Makefile:752: all] Error 2
npm ERR! 
npm ERR!     at Object.error (/xxx/node_modules/shelljs/src/common.js:110:27)
npm ERR!     at execSync (/xxx/node_modules/shelljs/src/exec.js:120:12)
npm ERR!     at Object._exec (/xxx/node_modules/shelljs/src/exec.js:223:12)
npm ERR!     at Object.exec (/xxx/node_modules/shelljs/src/common.js:335:23)
npm ERR!     at exec (/xxx/node_modules/zookeeper/scripts/helper.js:4:23)
npm ERR!     at Object.<anonymous> (/xxx/node_modules/zookeeper/scripts/build.js:32:5)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:1085:14)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
npm ERR!     at Module.load (internal/modules/cjs/loader.js:950:32)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
npm ERR! make: *** [libzk.target.mk:13: .] 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 (/home/xxx/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
npm ERR! gyp ERR! System Linux 5.15.0-47-generic
npm ERR! gyp ERR! command "/home/xxx/.nvm/versions/node/v14.20.0/bin/node" "/home/xxx/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /xxx/node_modules/zookeeper
npm ERR! gyp ERR! node -v v14.20.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxx/.npm/_logs/2022-09-10T13_47_12_743Z-debug-0.log

Expected behavior The module installs

Desktop (please complete the following information):

  • OS: Ubuntu 22.04 x64
  • Node.js version: 14.20.0
  • C/C++ compiler and version: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0

Additional context I suspect the problem to be in the upstream zookeeper C client version used. I have tried to build it separately following the build instructions from the zookeeper website to further investigate the issue but those instructions seem to be outdated.

dreusel avatar Sep 10 '22 13:09 dreusel

Thank you for reporting! This project is running in a CI, using Ubuntu.

Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64

Starting container cimg/node:16.13.1
cimg/node:16.13.1:

I'll try to reproduce it with Ubuntu 22.04.

DavidVujic avatar Sep 10 '22 14:09 DavidVujic

It looks like it might have to do with the OpenSSL version installed. Could it be that Ubuntu 22.04 uses a new version of it, not supporting the FIPS thing? I will continue investigating.

DavidVujic avatar Sep 10 '22 14:09 DavidVujic

Indeed it seems that FIPS_mode function has been removed from newer openssl versions. This is what I have installed on my 22.04 machine:

ii  libssl-dev:amd64                           3.0.2-0ubuntu1.6                        amd64        Secure Sockets Layer toolkit - development files
ii  libssl1.0.0:amd64                          1.0.2n-1ubuntu5.10                      amd64        Secure Sockets Layer toolkit - shared libraries
ii  libssl3:amd64                              3.0.2-0ubuntu1.6                        amd64        Secure Sockets Layer toolkit - shared libraries

Several other machines where I don't have the issue run Ubuntu 18.04 and have the following openssl package version:

ii  openssl                            1.1.1-1ubuntu2.1~18.04.20                   amd64        Secure Sockets Layer toolkit - cryptographic utility

The man-page of fips_module on Ubuntu also confirms that these functions are no longer supported: https://manpages.ubuntu.com/manpages/jammy/man7/fips_module.7ssl.html

dreusel avatar Sep 13 '22 13:09 dreusel

Solved with #319 and #321 - a new version (v.5.5.0) is now published to npm.

DavidVujic avatar Sep 17 '22 17:09 DavidVujic