Install fails on RHEL 7.5 server running on ppc64le architecture due to two related issues.
$ npm install java
> java@0.10.0 install /home/node/node_modules/java
> node-gyp rebuild
./find_java_libdir.sh: line 63: lib_dir: unbound variable
gyp: Call to './find_java_libdir.sh ppc64 linux' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/apps/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 3.10.0-862.2.3.el7.ppc64le
gyp ERR! command "/apps/node/bin/node" "/apps/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node/node_modules/java
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/node/package.json'
npm WARN node No description
npm WARN node No repository field.
npm WARN node No README data
npm WARN node No license field.
I fixed the line 63: lib_dir: unbound variable error by changing
local lib_dir
to
local lib_dir=""
I got the configure to complete by adding a condition to find_java_libdir.sh for ppc64le.
elif [[ "${os}" == "linux" ]] && [[ "${target_arch}" == "ppc64le" || "${target_arch}" == "ppcle" ]]; then
if [[ -d ${jre_dir}/ppc64le/classic ]]; then lib_dir="${jre_dir}"/ppc64le/classic; else lib_dir="${jre_dir}"/ppc64le/server; fi
I tried adding the necessary condition to the binding.gyp file for ppc64le but node-gyp just seemed to ignore the condition.
['uname_m=="ppc64le"', {
'target_arch': 'ppc64le'
}],
Then I tried altering the existing ppc64 condition but that was also being ignored by node-gyp.
['uname_m=="ppc64"', {
'target_arch': 'ppc64le'
}],
The target_arch was being passed as ppc64 no matter what changes I tried making to the binding.gyp conditions.
error: Can't find lib dir for linux ppc64, java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-7.b10.el7.ppc64le
gyp: Call to './find_java_libdir.sh ppc64 linux' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
I eventually found that I could override the target_arch variable within node-gyp and, along with my other changes, the configure and build completed.
# node-gyp configure build --target_arch=ppc64le
gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.1 | linux | ppc64
gyp info spawn /bin/python2
gyp info spawn args [ '/apps/node/lib/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 '/apps/nodeapps/node-java/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/apps/node/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.node-gyp/8.11.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/8.11.1',
gyp info spawn args '-Dnode_gyp_dir=/apps/node/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.node-gyp/8.11.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/apps/nodeapps/node-java',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/apps/nodeapps/node-java/build'
CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
SOLINK_MODULE(target) Release/obj.target/nodejavabridge_bindings.node
COPY Release/nodejavabridge_bindings.node
make: Leaving directory `/apps/nodeapps/node-java/build'
gyp info ok
I have the changes committed in a fork but still wasn't able to get the binding.gyp to work as intended. Perhaps someone else who knows more about node-gyp can figure something out.
Install fails on RHEL 7.5 server running on ppc64le architecture due to two related issues.
I fixed the
line 63: lib_dir: unbound variableerror by changinglocal lib_dirto
local lib_dir=""I got the configure to complete by adding a condition to find_java_libdir.sh for ppc64le.
I tried adding the necessary condition to the binding.gyp file for ppc64le but node-gyp just seemed to ignore the condition.
Then I tried altering the existing ppc64 condition but that was also being ignored by node-gyp.
The target_arch was being passed as ppc64 no matter what changes I tried making to the binding.gyp conditions.
I eventually found that I could override the target_arch variable within node-gyp and, along with my other changes, the configure and build completed.
I have the changes committed in a fork but still wasn't able to get the binding.gyp to work as intended. Perhaps someone else who knows more about node-gyp can figure something out.