Open svagionitis opened 6 years ago
Hi @svagionitis, it might be that OH looks into a different folder for native libs. Could you please run this in the karaf console?
openhab> system:property | grep os.arch
os.arch=arm
openhab> system:property | grep os.name
org.osgi.framework.os.name=Linux
os.name=Linux
openhab> system:property | grep java.library.path
java.library.path=:/var/lib/openhab2/lib:/usr/share/openhab2/runtime/lib:/usr/java/packages/lib/arm:/lib:/usr/lib
Could you please post your output here? E.g.
os.arch=arm
os.name=Linux
java.library.path=:/var/lib/openhab2/lib:/usr/share/openhab2/runtime/lib:/usr/java/packages/lib/arm:/lib:/usr/lib
Make sure that you've put tinyb libs (both files) in one of those folders that specified in java.library.path
property. Also make sure you have only one version of tinyb there.
If that's not working, please enable DEBUG level for TnyB transport in the karaf console (you should be running the latest SNAPSHOT version of TinyB transport):
openhab> log:info DEBUG org.sputnikdev.bluetooth.manager.transport.tinyb
Restart your OH and capture the logs from the beginning. It should give you a better explanation (exception). Please post the result here so I could add support for your arch in the transport for everyone (or if you can you could contribute yourself, your help will be much appreciated ;) ).
Hi @vkolotov,
Thanks your reply. Next following what you requested
os.arch=aarch64
os.name=Linux
java.library.path=/usr/lib/jvm/openjre-8/lib/aarch64/server:/usr/lib/jvm/openjre-8/lib/aarch64:/usr/lib/jvm/openjre-8/../lib/aarch64::/opt/openhab2/userdata/lib:/opt/openhab2/runtime/lib:/usr/java/packages/lib/aarch64:/lib:/usr/lib
I can see that the tinyb libraries are located in the /usr/lib
which is included in the java.library.path
and in no other place.
I enabled the DEBUG actually for the whole OH :), but here it is the specific output for the tinyb bluetooth binding (I have used the released org.eclipse.smarthome.binding.bluetooth.transport.tinyb-1.1.1.jar
)
2018-03-30 11:44:21.449 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Adapter discovery job error
java.lang.RuntimeException: Native library is out of date. Please update the native library.
at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:317) [15:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.getDiscoveredAdapters(TinyBFactory.java:153) [15:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$AdapterDiscoveryJob.discoverAdapters(BluetoothManagerImpl.java:762) [16:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$AdapterDiscoveryJob.run(BluetoothManagerImpl.java:755) [16:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]
2018-03-30 11:44:21.507 [WARN ] [th.manager.impl.BluetoothManagerImpl] - Device discovery job error
java.lang.RuntimeException: Native library is out of date. Please update the native library.
at tinyb.BluetoothManager.getBluetoothManager(BluetoothManager.java:317) [15:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.getDiscoveredDevices(TinyBFactory.java:166) [15:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth.transport.tinyb:1.1.1]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.discoverDevices(BluetoothManagerImpl.java:668) [16:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerImpl$DeviceDiscoveryJob.run(BluetoothManagerImpl.java:661) [16:org.sputnikdev.org.eclipse.smarthome.binding.bluetooth:1.1.4]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]
I have used both v0.5.0 and v0.5.1 for the tinyb libraries and I get the same error.
Yes I could create a PR for this but it might take sometime because I am not so familiar with Java :).
Hi @svagionitis , I know what's that. This error means that tinyb.jar library and native libraries are of different versions. How do you build tinyb? Just make sure you build it from the master branch: https://github.com/intel-iot-devkit/tinyb/commits/master
The latest commit is https://github.com/intel-iot-devkit/tinyb/commit/ac6d3082d06183c860eea97f451d5a92022348e0
When you build tinyb lib, its build process generates a hashtag which is put into native lib and into MANIFEST.MF file of the java lib file. The tinyb binding (transport) repacks tinyb library into OSGi compatible java archive. The generated hashtag is moved into MANIFEST file of the binding here: https://github.com/sputnikdev/bluetooth-manager-tinyb/blob/629bf989c348f564b562afd3f2f78c9ffd3e59ed/src/main/resources/META-INF/MANIFEST.MF#L7
You need to make sure that this hashtag (Specification-Version
) matches to the tag of your tinyb native libs when you build them. It gets printed in your console when you build tinyb. As far as I can understand, that hashtag is based on git hash, that's why it is important that you build tinyb from the very last commit so hashtags are matched.
Hi @vkolotov,
That was the issue, that you described above. I was building the tinyb as described in the documentation though if I build from the master with the last commit the Specification-Version
is not in the format that you described, but it's 0.5
. Next following the output of the cmake
$ cmake -DBUILDJAVA=ON ../
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'glib-2.0>=2.40'
-- Found glib-2.0, version 2.48.2
-- Checking for module 'gio-2.0>=2.40'
-- Found gio-2.0, version 2.48.2
-- Checking for module 'gio-unix-2.0>=2.40'
-- Found gio-unix-2.0, version 2.48.2
INFO - libtinyb Version v0.5.1
-- Found Java: /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java (found version "1.8.0.162")
-- Found JNI: /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/libjawt.so
-- JNI_INCLUDE_DIRS=/usr/lib/jvm/java-1.8.0-openjdk-amd64/include;/usr/lib/jvm/java-1.8.0-openjdk-amd64/include/linux;/usr/lib/jvm/java-1.8.0-openjdk-amd64/include
-- JNI_LIBRARIES=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/libjawt.so;/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/server/libjvm.so
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /tinyb.git/build
$ cat java/manifest.txt
Manifest-Version: 1.0
Bundle-Date: 2018-04-05 15:07:22
Bundle-ManifestVersion: 2
Bundle-Name: tinyb
Bundle-SymbolicName: tinyb
Bundle-Version: 0.5.1
Export-Package: tinyb
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Name: tinyb/
Package-Title: tinyb
Package-Vendor: Intel Corp.
Package-Version: 0.5.1
Specification-Title: TinyB
Specification-Vendor: Intel Corp.
Specification-Version: 0.5
Now, I did a little of investigation of how to get the hashtag that you refer on your comment and I found out that if I use the following
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bef0609..9301b9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_
# Make a version file containing the current version from git.
include (GetGitRevisionDescription)
-git_describe (VERSION "--tags")
+git_describe (VERSION "")
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-HASH-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND")
message (WARNING " - Install git to compile a production libtinyb!")
then the cmake gives the following
$ cmake -DBUILDJAVA=ON ../
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'glib-2.0>=2.40'
-- Found glib-2.0, version 2.48.2
-- Checking for module 'gio-2.0>=2.40'
-- Found gio-2.0, version 2.48.2
-- Checking for module 'gio-unix-2.0>=2.40'
-- Found gio-unix-2.0, version 2.48.2
INFO - libtinyb Version v0.4.3-48-gac6d308
-- Found Java: /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java (found version "1.8.0.162")
-- Found JNI: /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/libjawt.so
-- JNI_INCLUDE_DIRS=/usr/lib/jvm/java-1.8.0-openjdk-amd64/include;/usr/lib/jvm/java-1.8.0-openjdk-amd64/include/linux;/usr/lib/jvm/java-1.8.0-openjdk-amd64/include
-- JNI_LIBRARIES=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/libjawt.so;/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/amd64/server/libjvm.so
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /tinyb.git/build
$ cat java/manifest.txt
Manifest-Version: 1.0
Bundle-Date: 2018-04-05 15:11:39
Bundle-ManifestVersion: 2
Bundle-Name: tinyb
Bundle-SymbolicName: tinyb
Bundle-Version: 0.4.3
Export-Package: tinyb
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Name: tinyb/
Package-Title: tinyb
Package-Vendor: Intel Corp.
Package-Version: 0.4.3
Specification-Title: TinyB
Specification-Vendor: Intel Corp.
Specification-Version: 0.4
Although the library version changed, to INFO - libtinyb Version v0.4.3-48-gac6d308
, the Specification-Version is 0.4
. I believe that there must be some change in the regexs that split the version into pieces, I will investigate further.
Regardless of the above, I was able to re-bundle the tinyb transport binding by changing this https://github.com/sputnikdev/bluetooth-manager-tinyb/blob/629bf989c348f564b562afd3f2f78c9ffd3e59ed/src/main/resources/META-INF/MANIFEST.MF#L7 to 0.5
. Now it's working fine, without any issues.
I believe you can close this issue. Thanks again for all your help.
Hey guys. I encountered the same problem with yours, but I run OH2 on ubuntu 16.04. I can not solve the bug:
Native library is out of date. Please update the native library.
My TinyB is the same as @svagionitis and I didn't use the Bluetooth Manager based on TinyB library. I installed the bluetooth binding from Paper UI. Also I don't understand what the native library you guys mentioned means. What I can only check is that the tinyB version of mine is 0.5.1.
Can anyone give me some advice? Thanks!
Hi @vkolotov,
First thanks for this bluetooth tinyb transport binding. I have the following issue:
I am building a custom image for a Raspberry Pi 3 using the
aarch64
machine architecture. The java version is the followingI can run openHAB2 with no issues. I have built the tinyb library v0.5.1 for the
aarch64
architecture and put it in the/usr/lib
directoryIn the openHAB2 addons directory I have put the
org.eclipse.smarthome.binding.bluetooth-1.1.4.jar
and theorg.eclipse.smarthome.binding.bluetooth.transport.tinyb-1.1.1.jar
files. I receive the following error:The same happens when I build the bluetooth tinyb transport binding myself,
org.eclipse.smarthome.binding.bluetooth.transport.tinyb-1.1.2-SNAPSHOT.jar
with the current master (using as dependency the current master of bluetooth manager tinyb.Maybe I am missing something, I am not sure what to do next. I would appreciate a little help.