0

I'm on IBM AIX 7.1, installed ibm jdk at /usr/ibm-java-ppc64-71

I have to run the command npm install java --javahome=$JAVA_HOME otherwise it stucks saying there is undefined variable 'javahome'.

Here are my Env Vars:

export LD_LIBRARY_PATH=/usr/lib:/opt/freeware/lib64
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/ibm-java-ppc64-71/jre/bin:/usr/ibm-java-ppc64-71/bin:/elmec/node/bin
export JAVA_HOME=/usr/ibm-java-ppc64-71

But the problem is that it throws the errors as the title said:

gyp verb node-gyp root Finding node root directory
gyp verb node-gyp root in build directory, root = /elmec/node/include/node
gyp verb node-gyp configure node.exp Checking: /elmec/node/include/node/out/Release/node.exp
gyp verb node-gyp configure node.exp Checking: /elmec/node/include/node/include/node/node.exp
gyp verb node-gyp configure node.exp Checking: /elmec/node/include/node/node.exp
gyp info node-gyp configure node.exp copying "node.exp" from /elmec/node/include/node/node.exp to /.node-gyp/0.12.7/node.exp
gyp verb build dir attempting to create "build" dir: /elmec/node_apps/node_modules/java/build
gyp verb build dir "build" dir needed to be created? /elmec/node_apps/node_modules/java/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /elmec/node_apps/node_modules/java/build/config.gypi
gyp verb config.gypi checking for gypi file: /elmec/node_apps/node_modules/java/config.gypi
gyp verb common.gypi checking for gypi file: /elmec/node_apps/node_modules/java/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn python2
gyp info spawn args [ '/elmec/node/lib/node_modules/npm/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   '/elmec/node_apps/node_modules/java/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/elmec/node/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/.node-gyp/0.12.7/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/.node-gyp/0.12.7',
gyp info spawn args   '-Dmodule_root_dir=/elmec/node_apps/node_modules/java',
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 verb command build []
gyp verb build type Release
gyp verb architecture ppc64
gyp verb node dev dir /.node-gyp/0.12.7
gyp verb `which` succeeded for `gmake` /usr/bin/gmake
gyp info spawn gmake
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
gmake: Entering directory '/elmec/node_apps/node_modules/java/build'
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/ibm-java-ppc64-71/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/java.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/java.o ../src/java.cpp
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/ibm-java-ppc64-71/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/javaObject.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/javaObject.o ../src/javaObject.cpp
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/ibm-java-ppc64-71/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/javaScope.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/javaScope.o ../src/javaScope.cpp
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/ibm-java-ppc64-71/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o ../src/methodCallBaton.cpp
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/ibm-java-ppc64-71/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o ../src/nodeJavaBridge.cpp
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/ibm-java-ppc64-71/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/utils.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/utils.o ../src/utils.cpp
  g++ -Wl,-bM:sre -Wl,-bnoentry -Wl,-bexpfull -shared -Wl,-bimport:/.node-gyp/0.12.7/node.exp -pthread -maix64  -o Release/obj.target/nodejavabridge_bindings.node Release/obj.target/nodejavabridge_bindings/src/java.o Release/obj.target/nodejavabridge_bindings/src/javaObject.o Release/obj.target/nodejavabridge_bindings/src/javaScope.o Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o Release/obj.target/nodejavabridge_bindings/src/utils.o
ld: 0711-317 ERROR: Undefined symbol: .JNI_GetDefaultJavaVMInitArgs
ld: 0711-317 ERROR: Undefined symbol: .JNI_CreateJavaVM
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
nodejavabridge_bindings.target.mk:132: recipe for target 'Release/obj.target/nodejavabridge_bindings.node' failed
gmake: *** [Release/obj.target/nodejavabridge_bindings.node] Error 1
gmake: Leaving directory '/elmec/node_apps/node_modules/java/build'
gyp ERR! build error
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/elmec/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System AIX 1
gyp ERR! command "node" "/elmec/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /elmec/node_apps/node_modules/java
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm verb unsafe-perm in lifecycle false
npm info java@0.5.4 Failed to exec install script
npm verb unlock done using /.npm/_locks/java-4a9b752fb6bea515.lock for /elmec/node_apps/node_modules/java
npm verb stack Error: java@0.5.4 install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/elmec/node/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
npm verb stack     at EventEmitter.emit (events.js:110:17)
npm verb stack     at ChildProcess.<anonymous> (/elmec/node/lib/node_modules/npm/lib/utils/spawn.js:24:14)
npm verb stack     at ChildProcess.emit (events.js:110:17)
npm verb stack     at maybeClose (child_process.js:1015:16)
npm verb stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
npm verb pkgid java@0.5.4
npm verb cwd /elmec/node_apps
npm ERR! AIX 1
npm ERR! argv "/elmec/node/bin/node" "/elmec/node/bin/npm" "install" "--verbose" "java" "--javahome=/usr/ibm-java-ppc64-71"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! java@0.5.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.5.4 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the java package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls java
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]
npm verb unbuild node_modules/java
npm info preuninstall java@0.5.4
npm info uninstall java@0.5.4
npm verb unbuild rmStuff java@0.5.4 from /elmec/node_apps/node_modules
npm info postuninstall java@0.5.4
npm verb gentlyRm don't care about contents; nuking /elmec/node_apps/node_modules/java

npm ERR! Please include the following file with any support request:
npm ERR!     /elmec/node_apps/npm-debug.log

Here it is the JAVA dir structure enter image description here

EDIT1: @ankhzet If i put my JAVA_HOME to point at /bin I get this other error:

gyp verb `which` succeeded for `gmake` /usr/bin/gmake
gyp info spawn gmake
gypgmake: Entering directory '/elmec/node_apps/node_modules/jt400/node_modules/java/build'
 info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
  g++ '-DNODE_GYP_MODULE_NAME=nodejavabridge_bindings' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__LITTLE_ENDIAN=1234' '-D__BIG_ENDIAN=4321' '-D__BYTE_ORDER=__BIG_ENDIAN' '-D__FLOAT_WORD_ORDER=__BIG_ENDIAN' '-DBUILDING_NODE_EXTENSION' -I/.node-gyp/0.12.7/src -I/.node-gyp/0.12.7/deps/uv/include -I/.node-gyp/0.12.7/deps/v8/include -I/usr/java5/jre/include -I../node_modules/nan  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -O3 -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/nodejavabridge_bindings/src/java.o.d.raw  -c -o Release/obj.target/nodejavabridge_bindings/src/java.o ../src/java.cpp
In file included from ../src/java.cpp:1:0:
../src/java.h:7:17: fatal error: jni.h: No such file or directory
 #include <jni.h>

EDIT2: @Zsigmond Lőrinczy

Sorry but i can't understand what you asked me to do. I can point to you the repo of the npm package: https://github.com/joeferner/node-java

EDIT3: I updated my IBM JDK with the latest fix downloaded from FixCentral. I'm thinking the system is missing libjvm.so I tried to add the position of the library both to LIBPATH and LD_LIBRARY_PATH but it's still not working.

export LIBPATH=/usr/lib:/opt/freeware/lib64:/usr/ibm-java-ppc64-71/jre/bin:/usr/ibm-java-ppc64-71/jre/bin/classic:/usr/ibm-java-ppc64-71/include:/usr/ibm-java-ppc64-71/jre/lib/ppc64/classic:/usr/ibm-java-ppc64-71/include/aix
export LD_LIBRARY_PATH=$LIBPATH

EDIT4: I've just run nm -X64 /usr/ibm-java-ppc64-71/jre/bin/classic/libjvm.so and here is the output (as you can see it contains the 2 symbols) enter image description here

The fact is that libjvm.so is present even at the path /usr/ibm-java-ppc64-71/jre/bin/j9vm/libjvm.so

Better or worse, libjvm.so is present in all those paths: enter image description here

Axel92Dev
  • 197
  • 1
  • 15
  • Shouldn't `JAVA_HOME` point to location of `java`s executables? Like `/usr/ibm-java-ppc64-71/bin` or `/usr/ibm-java-ppc64-71/bin/client`? – ankhzet Aug 25 '15 at 15:02
  • Does LD_LIBRARY_PATH do anything in AIX? I always used LIBPATH in AIX. – Zsigmond Lőrinczy Aug 25 '15 at 15:02
  • `ERROR: Undefined symbol: .JNI_GetDefaultJavaVMInitArgs` looks like linker doesn't found `jvm.so/jvm.dll`, so, probably, something wrong with paths. – ankhzet Aug 25 '15 at 15:22
  • I would try sg like this (this should be added to file nodejavabridge_bindings.target.mk): Release/obj.target/nodejavabridge_bindings.node: ${JAVA_HOME}/jre/bin/j9vm/libjvm.so – Zsigmond Lőrinczy Aug 25 '15 at 15:23
  • @ZsigmondLőrinczy see my edit2 OP, thank you – Axel92Dev Aug 25 '15 at 16:24
  • @ankhzet see my edit1 OP, thank you – Axel92Dev Aug 25 '15 at 16:25
  • Downloaded it, but I still have two little questions: What is 'npm', and where the file 'nodejavabridge_bindings.target.mk' comes from? – Zsigmond Lőrinczy Aug 25 '15 at 17:25
  • @ZsigmondLőrinczy, `npm` is `node` (node.js) package manager. – ankhzet Aug 25 '15 at 17:41
  • @Axel92Dev, are you using [this](https://www.npmjs.com/package/java) link for installation? Also, which version of JDK have you installed? Because [here](https://github.com/joeferner/node-java/issues/90#issuecomment-45613235) is noticed, that `Oracle's JDK doesn't advertise itself as supporting JNI` and requires some tweaks – ankhzet Aug 25 '15 at 17:52
  • You seem to use too many exotic software. Maybe you should upload file 'nodejavabridge_bindings.target.mk' somewhere so I that I could have a look at it. – Zsigmond Lőrinczy Aug 25 '15 at 18:28
  • @ankhzet modified OP – Axel92Dev Aug 28 '15 at 10:03
  • I don't think AIX linker would use environments variables like LIBPATH or LD_LIBRARY_PATH... Use options -L and -l **gcc ... -L${JAVA_HOME}/jre/bin/j9vm -ljvm** – Zsigmond Lőrinczy Aug 28 '15 at 18:26
  • @Axel92Dev, I just figured out, that linker doesn't yells about `i'm not finding libjvm.so`, but `i'm not finding symbol .JNI_GetDefaultJavaVMInitArgs inside libjvm.so`. So, find all `libjvm.so` binaries on yours machine, and search them with any text editor for occurrences of `JNI_GetDefaultJavaVMInitArgs` and `JNI_CreateJavaVM` substrings. If they isn't there - then provided JDK doesn't support JNI. – ankhzet Aug 28 '15 at 19:44
  • @ankhzet see edit 4, thank you – Axel92Dev Sep 01 '15 at 06:56
  • And all of them contains needed symbols? – ankhzet Sep 01 '15 at 12:50

0 Answers0