Skip to content
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

ONNXRuntime JAVA JNI build failure #4755

Closed
quantum-fusion opened this issue Aug 11, 2020 · 5 comments
Closed

ONNXRuntime JAVA JNI build failure #4755

quantum-fusion opened this issue Aug 11, 2020 · 5 comments
Labels
api:Java issues related to the Java API build build issues; typically submitted using template

Comments

@quantum-fusion
Copy link

Describe the bug
A clear and concise description of what the bug is.

The problem is that the build for the java JNI run time is failing.

I used the instructions from ./java/README.txt

Building

Use the main project's build instructions with the --build_java option.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: 1.4.0
  • Python version: 3.8.3

To Reproduce

  • Describe steps/code to reproduce the behavior.
  • Attach the ONNX model to the issue (where applicable) to expedite investigation.

./build.sh --config RelWithDebInfo --build_shared_lib --parallel --build_java

(venv) (base) MacBook-Pro:~/onnxruntime quantum-fusion$ ./build.sh --config RelWithDebInfo --build_shared_lib --parallel --build_java
2020-08-11 06:11:39,314 Build [DEBUG] - Defaulting to running update, build [and test for native builds].
2020-08-11 06:11:39,315 Build [INFO] - Build started
2020-08-11 06:11:39,315 Build [DEBUG] - Running subprocess in '/Users/hottelet/onnxruntime'
['git', 'submodule', 'sync', '--recursive']
Synchronizing submodule url for 'cmake/external/FeaturizersLibrary'
Synchronizing submodule url for 'cmake/external/FeaturizersLibrary/src/3rdParty/eigen'
Synchronizing submodule url for 'cmake/external/FeaturizersLibrary/src/3rdParty/re2'
Synchronizing submodule url for 'cmake/external/SafeInt/safeint'
Synchronizing submodule url for 'cmake/external/cub'
Synchronizing submodule url for 'cmake/external/cxxopts'
Synchronizing submodule url for 'cmake/external/date'
Synchronizing submodule url for 'cmake/external/eigen'
Synchronizing submodule url for 'cmake/external/gemmlowp'
Synchronizing submodule url for 'cmake/external/googletest'
Synchronizing submodule url for 'cmake/external/horovod'
Synchronizing submodule url for 'cmake/external/horovod/third_party/HTTPRequest'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/assert'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/config'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/core'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/detail'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/iterator'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/lockfree'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/mpl'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/parameter'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/predef'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/preprocessor'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/static_assert'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/type_traits'
Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/utility'
Synchronizing submodule url for 'cmake/external/horovod/third_party/eigen'
Synchronizing submodule url for 'cmake/external/horovod/third_party/flatbuffers'
Synchronizing submodule url for 'cmake/external/horovod/third_party/gloo'
Synchronizing submodule url for 'cmake/external/horovod/third_party/lbfgs'
Synchronizing submodule url for 'cmake/external/json'
Synchronizing submodule url for 'cmake/external/libprotobuf-mutator'
Synchronizing submodule url for 'cmake/external/mimalloc'
Synchronizing submodule url for 'cmake/external/nsync'
Synchronizing submodule url for 'cmake/external/onnx'
Synchronizing submodule url for 'cmake/external/onnx/third_party/benchmark'
Synchronizing submodule url for 'cmake/external/onnx/third_party/pybind11'
Synchronizing submodule url for 'cmake/external/onnx/third_party/pybind11/tools/clang'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11'
Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang'
Synchronizing submodule url for 'cmake/external/protobuf'
Synchronizing submodule url for 'cmake/external/protobuf/third_party/benchmark'
Synchronizing submodule url for 'cmake/external/protobuf/third_party/googletest'
Synchronizing submodule url for 'cmake/external/re2'
Synchronizing submodule url for 'cmake/external/tensorboard'
Synchronizing submodule url for 'cmake/external/tvm'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/HalideIR'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/dlpack'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/dmlc-core'
Synchronizing submodule url for 'cmake/external/tvm/3rdparty/rang'
Synchronizing submodule url for 'cmake/external/wil'
Synchronizing submodule url for 'server/external/spdlog'
2020-08-11 06:11:40,885 Build [DEBUG] - Subprocess completed. Return code=0
2020-08-11 06:11:40,885 Build [DEBUG] - Running subprocess in '/Users/hottelet/onnxruntime'
['git', 'submodule', 'update', '--init', '--recursive']
2020-08-11 06:11:46,857 Build [DEBUG] - Subprocess completed. Return code=0
2020-08-11 06:11:46,857 Build [INFO] - Generating CMake build tree
2020-08-11 06:11:46,857 Build [DEBUG] - Running subprocess in '/Users/hottelet/onnxruntime/build/Linux/RelWithDebInfo'
['/usr/local/Cellar/cmake/3.17.0_1/bin/cmake', '/Users/hottelet/onnxruntime/cmake', '-Donnxruntime_RUN_ONNX_TESTS=OFF', '-Donnxruntime_BUILD_WINML_TESTS=ON', '-Donnxruntime_GENERATE_TEST_REPORTS=ON', '-Donnxruntime_DEV_MODE=ON', '-DPYTHON_EXECUTABLE=/Users/hottelet/venv/bin/python3', '-Donnxruntime_USE_CUDA=OFF', '-Donnxruntime_CUDNN_HOME=', '-Donnxruntime_USE_FEATURIZERS=OFF', '-Donnxruntime_CUDA_HOME=', '-Donnxruntime_USE_JEMALLOC=OFF', '-Donnxruntime_USE_MIMALLOC_STL_ALLOCATOR=OFF', '-Donnxruntime_USE_MIMALLOC_ARENA_ALLOCATOR=OFF', '-Donnxruntime_ENABLE_PYTHON=OFF', '-Donnxruntime_BUILD_CSHARP=OFF', '-Donnxruntime_BUILD_JAVA=ON', '-Donnxruntime_BUILD_NODEJS=OFF', '-Donnxruntime_BUILD_SHARED_LIB=ON', '-Donnxruntime_USE_EIGEN_FOR_BLAS=ON', '-Donnxruntime_USE_OPENBLAS=OFF', '-Donnxruntime_USE_DNNL=OFF', '-Donnxruntime_USE_MKLML=OFF', '-Donnxruntime_USE_NGRAPH=OFF', '-Donnxruntime_USE_OPENVINO=OFF', '-Donnxruntime_USE_OPENVINO_MYRIAD=OFF', '-Donnxruntime_USE_OPENVINO_GPU_FP32=OFF', '-Donnxruntime_USE_OPENVINO_GPU_FP16=OFF', '-Donnxruntime_USE_OPENVINO_CPU_FP32=OFF', '-Donnxruntime_USE_OPENVINO_VAD_M=OFF', '-Donnxruntime_USE_OPENVINO_VAD_F=OFF', '-Donnxruntime_USE_OPENVINO_BINARY=OFF', '-Donnxruntime_USE_NNAPI_BUILTIN=OFF', '-Donnxruntime_USE_RKNPU=OFF', '-Donnxruntime_USE_OPENMP=OFF', '-Donnxruntime_USE_TVM=OFF', '-Donnxruntime_USE_LLVM=OFF', '-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF', '-Donnxruntime_USE_VITISAI=OFF', '-Donnxruntime_USE_NUPHAR=OFF', '-Donnxruntime_USE_TENSORRT=OFF', '-Donnxruntime_TENSORRT_HOME=', '-Donnxruntime_USE_MIGRAPHX=OFF', '-Donnxruntime_MIGRAPHX_HOME=', '-Donnxruntime_CROSS_COMPILING=OFF', '-Donnxruntime_DISABLE_CONTRIB_OPS=OFF', '-Donnxruntime_DISABLE_ML_OPS=OFF', '-Donnxruntime_DISABLE_RTTI=OFF', '-Donnxruntime_MSVC_STATIC_RUNTIME=OFF', '-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=OFF', '-Donnxruntime_USE_DML=OFF', '-Donnxruntime_USE_WINML=OFF', '-Donnxruntime_BUILD_FOR_WINDOWS_STORE=OFF', '-Donnxruntime_USE_TELEMETRY=OFF', '-Donnxruntime_ENABLE_LTO=OFF', '-Donnxruntime_USE_ACL=OFF', '-Donnxruntime_USE_ACL_1902=OFF', '-Donnxruntime_USE_ACL_1905=OFF', '-Donnxruntime_USE_ACL_1908=OFF', '-Donnxruntime_USE_ARMNN=OFF', '-Donnxruntime_ARMNN_RELU_USE_CPU=ON', '-Donnxruntime_ARMNN_BN_USE_CPU=ON', '-Donnxruntime_ENABLE_NVTX_PROFILE=OFF', '-Donnxruntime_ENABLE_TRAINING=OFF', '-Donnxruntime_USE_HOROVOD=OFF', '-Donnxruntime_BUILD_BENCHMARKS=OFF', '-Donnxruntime_PYBIND_EXPORT_OPSCHEMA=OFF', '-Donnxruntime_ENABLE_MEMLEAK_CHECKER=OFF', '-DCMAKE_BUILD_TYPE=RelWithDebInfo']
Adding flags for Mac builds
Use gtest from submodule
-- Found PythonInterp: /Users/hottelet/venv/bin/python3 (found version "3.8.3")
-- Found PythonInterp: /Users/hottelet/venv/bin/python3 (found suitable version "3.8.3", minimum required is "3.4")
Use protobuf from submodule

-- 3.11.3.0
-- Java Build is enabled
-- Using gradle: /usr/local/bin/gradle
-- Running Java tests
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/hottelet/onnxruntime/build/Linux/RelWithDebInfo
2020-08-11 06:11:49,416 Build [DEBUG] - Subprocess completed. Return code=0
2020-08-11 06:11:49,416 Build [INFO] - Building targets for RelWithDebInfo configuration
2020-08-11 06:11:49,417 Build [DEBUG] - Running subprocess in '/Users/hottelet/onnxruntime'
['/usr/local/Cellar/cmake/3.17.0_1/bin/cmake', '--build', '/Users/hottelet/onnxruntime/build/Linux/RelWithDebInfo', '--config', 'RelWithDebInfo', '--', '-j16']
Scanning dependencies of target pep8_check
Checking python scripts for PEP8 conformance using flake8
[ 0%] Built target onnxruntime_generate_def
[ 0%] Built target gtest
[ 1%] Generating /Users/hottelet/onnxruntime/java/build/libs/onnxruntime.jar
[ 1%] Built target onnxruntime_mocked_allocator
[ 2%] Built target custom_op_library
[ 3%] Built target re2
[ 10%] Built target libprotobuf-lite
[ 11%] Built target onnxruntime_mlas
[ 15%] Built target nsync_cpp
[ 23%] Built target libprotobuf
[ 23%] Built target gmock
[ 33%] Built target libprotoc
[ 33%] Built target protoc
[ 34%] Built target onnx_proto
Scanning dependencies of target onnx_test_data_proto
Scanning dependencies of target onnxruntime_util
Scanning dependencies of target onnxruntime_common
Scanning dependencies of target onnxruntime_session
Scanning dependencies of target onnxruntime_test_utils
Scanning dependencies of target onnxruntime_graph
Scanning dependencies of target onnxruntime_optimizer
Scanning dependencies of target onnxruntime_framework
[ 34%] Building CXX object CMakeFiles/onnx_test_data_proto.dir/tml.pb.cc.o
[ 34%] Building CXX object onnx/CMakeFiles/onnx.dir//external/onnx/onnx/checker.cc.o
[ 34%] Building CXX object onnx/CMakeFiles/onnx.dir/
/external/onnx/onnx/common/assertions.cc.o
[ 35%] Building CXX object onnx/CMakeFiles/onnx.dir//external/onnx/onnx/common/interned_strings.cc.o
[ 35%] Building CXX object onnx/CMakeFiles/onnx.dir/
/external/onnx/onnx/common/ir_pb_converter.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_test_utils.dir/Users/hottelet/onnxruntime/onnxruntime/test/util/compare_ortvalue.cc.o
[ 35%] Building CXX object onnx/CMakeFiles/onnx.dir//external/onnx/onnx/common/status.cc.o
[ 35%] Building CXX object onnx/CMakeFiles/onnx.dir/
/external/onnx/onnx/common/model_helpers.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_common.dir/Users/hottelet/onnxruntime/onnxruntime/core/common/cpuid_info.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_util.dir/Users/hottelet/onnxruntime/onnxruntime/core/profile/profile.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_graph.dir/Users/hottelet/onnxruntime/onnxruntime/core/graph/contrib_ops/attn_lstm_schema_defs.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_session.dir/Users/hottelet/onnxruntime/onnxruntime/core/session/IOBinding.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_optimizer.dir/Users/hottelet/onnxruntime/onnxruntime/core/optimizer/attention_fusion.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_framework.dir/Users/hottelet/onnxruntime/onnxruntime/core/framework/allocation_planner.cc.o
[ 35%] Building CXX object CMakeFiles/onnxruntime_util.dir/Users/hottelet/onnxruntime/onnxruntime/core/util/gemmlowp_common.cc.o

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/hottelet/onnxruntime/java/build.gradle' line: 32

  • What went wrong:
    A problem occurred evaluating root project 'onnxruntime'.

Could not find method java() for arguments [build_d2sga7li9vj1uors92zmxp804$_run_closure2@48a46518] on root project 'onnxruntime' of type org.gradle.api.Project.

Additional context
Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.

@Craigacp
Copy link
Contributor

What version of Gradle do you have installed?

@quantum-fusion
Copy link
Author

@Craigacp see transcript below it is Gradle 4.9

gradle --version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/local/Cellar/gradle/4.9/libexec/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release


Gradle 4.9

Build time: 2018-07-16 08:14:03 UTC
Revision: efcf8c1cf533b03c70f394f270f46a174c738efc

Kotlin DSL: 0.18.4
Kotlin: 1.2.41
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 14 (Oracle Corporation 14+36-1461)
OS: Mac OS X 10.15.6 x86_64

@Craigacp
Copy link
Contributor

As noted in the build docs you need gradle 6.1 or newer to build it.

@hariharans29 hariharans29 added api:Java issues related to the Java API build build issues; typically submitted using template labels Aug 11, 2020
@quantum-fusion
Copy link
Author

gradle -v


Gradle 6.6

Build time: 2020-08-10 22:06:19 UTC
Revision: d119144684a0c301aea027b79857815659e431b9

Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 14 (Oracle Corporation 14+36-1461)
OS: Mac OS X 10.15.6 x86_64

@quantum-fusion
Copy link
Author

@Craigacp see test results.

7: > Task :compileTestJava
7: Note: /Users/hottelet/onnxruntime/java/src/test/java/ai/onnxruntime/OnnxMl.java uses or overrides a deprecated API.
7: Note: Recompile with -Xlint:deprecation for details.
7: Note: Some input files use unchecked or unsafe operations.
7: Note: Recompile with -Xlint:unchecked for details.
7:
7: > Task :processTestResources
7: > Task :testClasses
7:
7: > Task :test
7:
7: ai.onnxruntime.UtilTest > reshape4DTest() PASSED
7:
7: ai.onnxruntime.UtilTest > reshapeTest() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelSerialization() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputDOUBLE() PASSED
7:
7: ai.onnxruntime.InferenceTest > createSessionFromByteArray() PASSED
7:
7: ai.onnxruntime.InferenceTest > repeatedCloseTest() PASSED
7:
7: ai.onnxruntime.InferenceTest > testCUDA() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelSequenceOfMapIntFloat() PASSED
7:
7: ai.onnxruntime.InferenceTest > testExtraSessionOptions() PASSED
7:
7: ai.onnxruntime.InferenceTest > throwExtraInputs() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputFLOAT() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputINT16() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputINT32() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputINT64() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputBOOL() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelInputINT8() PASSED
7:
7: ai.onnxruntime.InferenceTest > throwWrongInputName() PASSED
7:
7: ai.onnxruntime.InferenceTest > throwWrongInputType() PASSED
7:
7: ai.onnxruntime.InferenceTest > testModelSequenceOfMapStringFloat() PASSED
7:
7: ai.onnxruntime.InferenceTest > testLoadCustomLibrary() PASSED
7:
7: ai.onnxruntime.InferenceTest > testAllPretrainedModels() SKIPPED
7:
7: ai.onnxruntime.InferenceTest > testRunOptions() PASSED
7:
7: ai.onnxruntime.InferenceTest > inferenceTest() PASSED
7:
7: ai.onnxruntime.InferenceTest > morePartialInputsTest() PASSED
7:
7: ai.onnxruntime.InferenceTest > testStringIdentity() PASSED
7:
7: ai.onnxruntime.InferenceTest > createSessionFromPath() PASSED
7:
7: ai.onnxruntime.InferenceTest > partialInputsTest() PASSED
7:
7: ai.onnxruntime.InferenceTest > testMultiThreads() PASSED
7:
7: > Task :check
7: > Task :cmakeCheck
7:
7: BUILD SUCCESSFUL in 28s
7: 7 actionable tasks: 6 executed, 1 up-to-date
7/7 Test #7: onnxruntime4j_test ..................... Passed 28.71 sec

100% tests passed, 0 tests failed out of 7

Total Test time (real) = 50.66 sec
2020-08-11 13:52:04,969 Build [DEBUG] - Subprocess completed. Return code=0
2020-08-11 13:52:04,969 Build [INFO] - Build complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:Java issues related to the Java API build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants