Native Library bluecove_arm not available
Asked Answered
D

2

6

I am trying to compile/run a program that uses the BlueCove libraries on a BeagleBone Black running Ubuntu. However I keep getting this error when running:

Native Library bluecove_arm not available
javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available
at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:381)
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:429)
at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020)
at java.security.AccessController.doPrivileged(Native Method)
at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018)
at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011)
at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75)
at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
at edit.rit.ce.whud.DataServer.bluetoothHandler(DataServer.java:16)
at edit.rit.ce.whud.GUI.main(GUI.java:153)

I know this isn't an issue with the code, since I can run the code with the BlueCove libraries on a x64 bit Linux computer running Mint (which is based off Ubuntu). I have searched online for several solutions and can't find one that solves my problem. I have already recompiled the bluecove-gpl-2.1.0 libraries for ARM using this method

http://www.raspberrypi.org/forums/viewtopic.php?f=81&t=58758

and have tried compiling/running the code both through the terminal and NetBeans IDE.

Is there some other step I need to do to make this work? Why does it keep saying Bluecove library isn't available even after I recompiled it for ARM?

Diella answered 17/4, 2014 at 19:43 Comment(0)
D
4

This is for future reference for anyone coming upon this question:

Check out the answer provided by MyRevel over on the raspberry pi forums. It worked like a charm! :)

For the sake of spreading a working solution thats easy to follow, and because this question is the first result that appears in google, I am reposting the steps from the answer mentioned above (I've made some slight modifications but the effect is the same):

Download bluecove-2.1.0.jar and bluecove-gpl-2.1.0-sources.tar.gz from http://code.google.com/p/bluecove/downloads/list or http://sourceforge.net/projects/bluecove/files/BlueCove/2.1.0/.

On the RPi, using the terminal or SSH:

Create a place to do the compilation and extract the source files:

`mkdir -p ~/temp/bluecove/target/`
`cd ~/temp`
`tar xf bluecove-gpl-2.1.0-sources.tar.gz`
`mv ~/Downloads/bluecove-2.1.0.jar ~/temp/bluecove/target/bluecove-2.1.0.jar`

Now folder temp includes two folders: bluecove-gpl-2.1.0 and bluecove.

Modify build.xml:

nano ~/temp/bluecove-gpl-2.1.0/build.xml

Delete text '-SNAPSHOT' on line 12 of build.xml:
from: <property name="product_version" value="2.1.0-SNAPSHOT"/>
to:   <property name="product_version" value="2.1.0"/>

Save file: `Ctrl+X` then `Y` and `Enter`.

Install bluetooth packages and packages required for compilation:

sudo apt-get update && apt-get upgrade && apt-get autoremove
sudo apt-get install bluetooth bluez-utils blueman
sudo apt-get install libbluetooth-dev   # BlueZ development package needed for compilation later
sudo apt-get install ant

Connect Bluetooth dongle and test if Bluetooth OK:

/etc/init.d/bluetooth status    # check to see whether the bluetooth is live
hcitool scan                    # show any devices in range of the dongle
sudo service bluetooth start    # start the bluetooth service if required

Start compilation:

cd ~/temp/bluecove-gpl-2.1.0
ant all

When successfully compiled you can find the required gpl jar in:

~/temp/bluecove-gpl-2.1.0/target/bluecove-gpl-2.1.0.jar

Finally...

Move the generated file, bluecove-gpl-2.1.0.jar, together with the downloaded file, bluecove-2.1.0.jar, into your java build path libraries directory of your java development program.

Running your java program with the bluecove libraries can be done like so:

java  -cp  /path/to/MyJavaProgram.jar:/path/to/bluecove_libs/  myjavaprogram.MyJavaProgram

The -cp switch allows us to specify a list of files and directories to include. Each directory and file is delimited with a colon (:).

In this case we are wanting to include MyJavaProgram.jar, and all the files in the bluecove_libs directory.

The final parameter tells java which package and class main() should be executed from.

Note that /path/to/bluecove_libs/ will contain the following files:

  • bluecove-gpl-2.1.0.jar -> the file we compiled above
  • bluecove-2.1.0.jar -> the file we downloaded from the web
Dolph answered 30/10, 2014 at 6:38 Comment(2)
Do you care to elaborate on which part didn't work and what errors you got? At least that way I get a chance to improve the answer for others.Dolph
Of course. The original error wasn't solved at all. I did all the steps and imported the new jar into my project. Then I generated an executable jar for my project, it contains all libs including both bluecove jars and classpath is set correctly in MANIFEST. I tried running the project using the java -cp as instructed and same result.Hinge
D
0

About "Is there some other step I need to do to make this work? Why does it keep saying Bluecove library isn't available even after I recompiled it for ARM?"

I found the same issue when I tried to compile under Ubuntu. The reason was in gcc compiler. It has different default parameters for different versions.

I had to do the following change in build.xml for bluecove-gpl-2.1.1-SNAPSHOT.jar

1) <property name=»bluecove.native.linker.options» value=»-nodefaultlibs«/>

=>

<property name=»bluecove.native.linker.options» value=»»/>

2) <arg value=»-Wl,-soname,libbluecove${library_sufix}-${product_version}»/>

=>

<arg value=»-Wl,—no-as-needed,-soname,libbluecove${library_sufix}-${product_version}»/>

3) <arg value=»-L${libs-universal}»/>

<arg value=»-lbluetooth»/>

<arg line=»${bluecove.native.linker.options}»/>

<arg value=»-Wl,-soname,libbluecove${library_sufix}-${product_version}»/>

=>

<arg value=»-L${libs-universal}»/>

<arg line=»${bluecove.native.linker.options}»/>

<arg value=»-Wl,—no-as-needed,-soname,libbluecove${library_sufix}- ${product_version}»/>

<arg value=»-lbluetooth»/>

http://privateblog.by/raspberry-pi-kak-rabotat-s-bluetooth-na-java/

Dryclean answered 6/1, 2017 at 3:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.