From a319ad29b3b35bd2bde876ca31754f935d6ff85b Mon Sep 17 00:00:00 2001 From: Mina Asham Date: Mon, 20 Jan 2020 08:49:31 +0000 Subject: [PATCH] Do not link onnxruntime jni output with JNI_LIBRARIES - Linking onnxruntime with JNI_LIBRARIES includes some unnecessary links to native libraries (e.g. libawt) which are not actually used or required by the output onnx library. This causes unsatisfied link exceptions when trying to load the onnx library without including these libraries. --- cmake/onnxruntime_java.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 1dc8ea16a0..5abda32675 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -54,7 +54,7 @@ file(GLOB onnxruntime4j_native_src add_library(onnxruntime4j_jni SHARED ${onnxruntime4j_native_src} ${onnxruntime4j_generated}) onnxruntime_add_include_to_target(onnxruntime4j_jni onnxruntime_session) target_include_directories(onnxruntime4j_jni PRIVATE ${REPO_ROOT}/include ${REPO_ROOT}/java/src/main/native) -target_link_libraries(onnxruntime4j_jni PUBLIC ${JNI_LIBRARIES} onnxruntime onnxruntime4j_generated) +target_link_libraries(onnxruntime4j_jni PUBLIC onnxruntime onnxruntime4j_generated) # Now the jar, jni binary and shared lib binary have been built, now to build the jar with the binaries added.