hyperledger-iroha / iroha-dco

Iroha - A simple, decentralized ledger
http://iroha.tech
Apache License 2.0
988 stars 297 forks source link

Cannot load shared libraries libleveldb.so.1 via JNI in CircleCI #168

Closed motxx closed 7 years ago

motxx commented 7 years ago

In feature/api branch, I created test file java_vm_test, which calls java function of test/smart_contract/Test/Test.java. Test.java loads libDomainRepository.so and calls C++ function by using JNI. Then, it accesses leveldb database. In my local environment, java_vm_test worked correctly, but in docker in CircleCI, an error such as the following occurred:

/usr/local/iroha/test_bin/java_vm_test: error while loading shared libraries: libleveldb.so.1: cannot open shared object file: No such file or directory

Do you have any good solutions?

Warchant commented 7 years ago

Send link to build in circleci here.

motxx commented 7 years ago

Oh, sorry.... this is circle ci link. https://circleci.com/gh/hyperledger/iroha/1294?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

I try to fix using ssh(circle ci).
current branch: https://github.com/hyperledger/iroha/tree/feature/api

takemiyamakoto commented 7 years ago

Is this a problem with circle ci's cache?

motxx commented 7 years ago

Same result as building without cache.

satellitex commented 7 years ago

c++: warning: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64: linker input file unused because linking not done compile 時に怪しいエラーがありました


docker run -it --name iroha -v \'pwd\':/opt/iroha hyperledger/iroha-dev /bin/bash で入った後、 iroha を build して実行したところ /usr/local/iroha/test_bin/java_vm_test: error while loading shared libraries: libleveldb.so.1: cannot open shared object file: No such file or directory が出ない代わりに以下のエラーが発生しました。( Test.class は作成されています )

root@9f7b1cd854e7:/opt/iroha/build# ./test_bin/java_vm_test
Running main() from gtest_main.cc
[==========] Running 7 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 7 tests from SmartContract
[ RUN      ] SmartContract.InitializeVM
-Djava.class.path=/opt/iroha/smart_contract -Djava.library.path=/opt/iroha/build/lib -Djava.security.policy=/opt/iroha/core/infra/smart_contract/jvm/java.policy.txt -Djava.security.manager test.Test
could not found class : test.Test
[       OK ] SmartContract.InitializeVM (70 ms)
[ RUN      ] SmartContract.Invoke_JAVA_function
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f86d0da6d9b, pid=1629, tid=0x00007f86d1221740
#
# JRE version: OpenJDK Runtime Environment (8.0_121-b13) (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
# Java VM: OpenJDK 64-Bit Server VM (25.121-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libDomainRepository.so+0x87d9b]  smart_contract::execFunction(std::unique_ptr<smart_contract::JavaContext, std::default_delete<smart_contract::JavaContext> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)+0x2e
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/iroha/build/hs_err_pid1629.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)
motxx commented 7 years ago
motxx commented 7 years ago

Now, fixed. leveldb shared libraries used by JNI were not there in docker. rsync is required.