-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java install failing with : /usr/bin/ld: cannot find -ljvm #567
Comments
In my experience, the last compatible Node version with node-java v0.12.2 is v16.19.0. |
@posenato But it was working with Node 18.12.1 with OpenJdk 11, it is only with Open Jdk 17 it is failing. |
I just solve this problem. This problem is cause by the script find_java_libdir.sh . You can cloen the rep and open the find_java_libdir.sh, change to line: to if [[ "${java_version}" =~ (6|8) && "${os}" != "zos" ]]; then and if [[ "${os}" == "linux" && ! "${java_version}" =~ (6|7|8) ]]; then to if [[ "${os}" == "linux" && ! "${java_version}" =~ (6|8) ]]; then |
If you're in macOS: I have solved it by installing the openJDK from brew with: and following the command instructions: For the system Java wrappers to find this JDK, symlink it with If you need to have openjdk@8 first in your PATH, run: For compilers to find openjdk@8 you may need to set: |
We are using
node -v v18.12.1
node-gyp -v v9.1.0
on oraclelinux8-openjdk17.0.5
and getting the following error:
07:11:26 /usr/bin/ld: cannot find -ljvm
07:11:26 collect2: error: ld returned 1 exit status
07:11:26 make: *** [nodejavabridge_bindings.target.mk:155: Release/obj.target/nodejavabridge_bindings.node] Error 1
07:11:26 make: Leaving directory '/usr/src/app/Content_Connect/node_modules/java/build'
07:11:26 gyp ERR! build error
07:11:26 gyp ERR! stack Error:
make
failed with exit code: 2Anyone faced similar issue? This works fine with JDK 11 but is failing with JDK 17.
Any help is appreciated.
Below is the full log.
make: Entering directory '/usr/src/app/Content_Connect/node_modules/java/build'
07:11:26 CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
07:11:26 In file included from ../src/java.h:9,
07:11:26 from ../src/java.cpp:1:
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker)':*
07:11:26 ../node_modules/nan/nan.h:2294:62: warning: cast between incompatible function types from 'void (uv_work_t)' {aka 'void (uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (uv_work_s*, int)'} [-Wcast-function-type]*
07:11:26 , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
07:11:26 ^
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Localv8::ObjectTemplate, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)':
07:11:26 ../node_modules/nan/nan.h:2542:16: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, v8::Localv8::AccessorSignature, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
07:11:26 , signature);
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-function.h:15,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:33,
07:11:26 from ../src/java.h:5,
07:11:26 from ../src/java.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-template.h:838:8: note: declared here
07:11:26 void SetAccessor(
07:11:26 ^~~~~~~~~~~
07:11:26 CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
07:11:26 In file included from ../src/utils.h:12,
07:11:26 from ../src/methodCallBaton.h:5,
07:11:26 from ../src/javaObject.h:10,
07:11:26 from ../src/javaObject.cpp:1:
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker)':*
07:11:26 ../node_modules/nan/nan.h:2294:62: warning: cast between incompatible function types from 'void (uv_work_t)' {aka 'void (uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (uv_work_s*, int)'} [-Wcast-function-type]*
07:11:26 , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
07:11:26 ^
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Localv8::ObjectTemplate, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)':
07:11:26 ../node_modules/nan/nan.h:2542:16: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, v8::Localv8::AccessorSignature, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
07:11:26 , signature);
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-function.h:15,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:33,
07:11:26 from ../src/javaObject.h:5,
07:11:26 from ../src/javaObject.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-template.h:838:8: note: declared here
07:11:26 void SetAccessor(
07:11:26 ^~~~~~~~~~~
07:11:26 CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
07:11:26 CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
07:11:26 In file included from ../src/utils.h:12,
07:11:26 from ../src/methodCallBaton.h:5,
07:11:26 from ../src/methodCallBaton.cpp:2:
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker)':*
07:11:26 ../node_modules/nan/nan.h:2294:62: warning: cast between incompatible function types from 'void (uv_work_t)' {aka 'void (uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (uv_work_s*, int)'} [-Wcast-function-type]*
07:11:26 , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
07:11:26 ^
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Localv8::ObjectTemplate, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)':
07:11:26 ../node_modules/nan/nan.h:2542:16: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, v8::Localv8::AccessorSignature, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
07:11:26 , signature);
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-function.h:15,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:33,
07:11:26 from ../src/utils.h:6,
07:11:26 from ../src/methodCallBaton.h:5,
07:11:26 from ../src/methodCallBaton.cpp:2:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-template.h:838:8: note: declared here
07:11:26 void SetAccessor(
07:11:26 ^~~~~~~~~~~
07:11:26 CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
07:11:26 In file included from ../src/java.h:9,
07:11:26 from ../src/nodeJavaBridge.cpp:2:
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker)':*
07:11:26 ../node_modules/nan/nan.h:2294:62: warning: cast between incompatible function types from 'void (uv_work_t)' {aka 'void (uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (uv_work_s*, int)'} [-Wcast-function-type]*
07:11:26 , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
07:11:26 ^
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Localv8::ObjectTemplate, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)':
07:11:26 ../node_modules/nan/nan.h:2542:16: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, v8::Localv8::AccessorSignature, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
07:11:26 , signature);
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-function.h:15,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:33,
07:11:26 from ../src/java.h:5,
07:11:26 from ../src/nodeJavaBridge.cpp:2:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-template.h:838:8: note: declared here
07:11:26 void SetAccessor(
07:11:26 ^~~~~~~~~~~
07:11:26 In file included from ../src/java.h:6,
07:11:26 from ../src/nodeJavaBridge.cpp:2:
07:11:26 ../src/nodeJavaBridge.cpp: At global scope:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/node.h:976:43: warning: cast between incompatible function types from 'void (v8::Localv8::Object)' to 'node::addon_register_func' {aka 'void (v8::Localv8::Object, v8::Localv8::Value, void)'} [-Wcast-function-type]*
07:11:26 (node::addon_register_func) (regfunc), *
07:11:26 ^
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/node.h:1010:3: note: in expansion of macro 'NODE_MODULE_X'
07:11:26 NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
07:11:26 ^~~~~~~~~~~~~
07:11:26 ../src/nodeJavaBridge.cpp:11:3: note: in expansion of macro 'NODE_MODULE'
07:11:26 NODE_MODULE(nodejavabridge_bindings, init);
07:11:26 ^~~~~~~~~~~
07:11:26 CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
07:11:26 In file included from ../src/utils.h:12,
07:11:26 from ../src/utils.cpp:1:
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker)':
07:11:26 ../node_modules/nan/nan.h:2294:62: warning: cast between incompatible function types from 'void (uv_work_t)' {aka 'void (uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (uv_work_s*, int)'} [-Wcast-function-type]*
07:11:26 , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
07:11:26 ^
07:11:26 ../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Localv8::ObjectTemplate, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)':
07:11:26 ../node_modules/nan/nan.h:2542:16: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute, v8::Localv8::AccessorSignature, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
07:11:26 , signature);
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-function.h:15,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:33,
07:11:26 from ../src/utils.h:6,
07:11:26 from ../src/utils.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-template.h:838:8: note: declared here
07:11:26 void SetAccessor(
07:11:26 ^~~~~~~~~~~
07:11:26 ../src/utils.cpp: In function 'v8::Localv8::Value javaExceptionToV8(Java, JNIEnv*, jthrowable, const string&)':*
07:11:26 ../src/utils.cpp:455:128: warning: ignoring return value of 'v8::Maybe v8::Object::Set(v8::Localv8::Context, v8::Localv8::Value, v8::Localv8::Value)', declared with attribute warn_unused_result [-Wunused-result]
07:11:26 ((v8::Object)v8ex)->Set(Nan::GetCurrentContext(), Nan::Newv8::String("cause").ToLocalChecked(), javaToV8(java, env, ex));
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-array-buffer.h:13,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:24,
07:11:26 from ../src/utils.h:6,
07:11:26 from ../src/utils.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-object.h:244:37: note: declared here
07:11:26 V8_WARN_UNUSED_RESULT Maybe Set(Local context,
07:11:26 ^~~
07:11:26 ../src/utils.cpp: In function 'v8::Localv8::Value javaArrayToV8(Java, JNIEnv*, jobjectArray)':*
07:11:26 ../src/utils.cpp:648:76: warning: ignoring return value of 'v8::Maybe v8::Object::Set(v8::Localv8::Context, uint32_t, v8::Localv8::Value)', declared with attribute warn_unused_result [-Wunused-result]
07:11:26 result->Set(Nan::GetCurrentContext(), i, JavaObject::New(java, obj));
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-array-buffer.h:13,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:24,
07:11:26 from ../src/utils.h:6,
07:11:26 from ../src/utils.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-object.h:247:37: note: declared here
07:11:26 V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
07:11:26 ^~~
07:11:26 ../src/utils.cpp:658:54: warning: ignoring return value of 'v8::Maybe v8::Object::Set(v8::Localv8::Context, uint32_t, v8::Localv8::Value)', declared with attribute warn_unused_result [-Wunused-result]
07:11:26 result->Set(Nan::GetCurrentContext(), i, item);
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-array-buffer.h:13,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:24,
07:11:26 from ../src/utils.h:6,
07:11:26 from ../src/utils.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-object.h:247:37: note: declared here
07:11:26 V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
07:11:26 ^~~
07:11:26 ../src/utils.cpp: In function 'v8::Localv8::Value javaToV8(Java, JNIEnv*, jobject, DynamicProxyData*)':*
07:11:26 ../src/utils.cpp:721:168: warning: ignoring return value of 'v8::Maybe v8::Object::Set(v8::Localv8::Context, v8::Localv8::Value, v8::Localv8::Value)', declared with attribute warn_unused_result [-Wunused-result]
07:11:26 v8ResultNumberObject->Set(Nan::GetCurrentContext(), Nan::Newv8::String("longValue").ToLocalChecked(), Nan::Newv8::String(strValue.c_str()).ToLocalChecked());
07:11:26 ^
07:11:26 In file included from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-array-buffer.h:13,
07:11:26 from /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8.h:24,
07:11:26 from ../src/utils.h:6,
07:11:26 from ../src/utils.cpp:1:
07:11:26 /home/ccadmin/.cache/node-gyp/18.12.1/include/node/v8-object.h:244:37: note: declared here
07:11:26 V8_WARN_UNUSED_RESULT Maybe Set(Local context,
07:11:26 ^~~
07:11:26 SOLINK_MODULE(target) Release/obj.target/nodejavabridge_bindings.node
07:11:26 /usr/bin/ld: cannot find -ljvm
07:11:26 collect2: error: ld returned 1 exit status
07:11:26 make: *** [nodejavabridge_bindings.target.mk:155: Release/obj.target/nodejavabridge_bindings.node] Error 1
07:11:26 make: Leaving directory '/usr/src/app/Content_Connect/node_modules/java/build'
07:11:26 gyp ERR! build error
07:11:26 gyp ERR! stack Error:
make
failed with exit code: 207:11:26 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
07:11:26 gyp ERR! stack at ChildProcess.emit (node:events:513:28)
07:11:26 gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
07:11:26 gyp ERR! System Linux 3.10.0-862.14.4.el7.x86_64
07:11:26 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
07:11:26 gyp ERR! cwd /usr/src/app/Content_Connect/node_modules/java
07:11:26 gyp ERR! node -v v18.12.1
07:11:26 gyp ERR! node-gyp -v v9.1.0
07:11:26 gyp ERR! not ok
The text was updated successfully, but these errors were encountered: