Building Bluecove to replace lejos distribution version

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Building Bluecove to replace lejos distribution version

Postby fieranmason » Fri Oct 28, 2011 6:30 pm

Hi,

I am trying to build bluecove to replace the version which is distributed with Lejos in order to attempt to resolve the kernel protection errors which have been coming up (I mentioned these in another thread). I was hoping that someone could provide some instruction on how to do this. So far I have downloaded the bluecove source, changed the run configuration for the build script to use jvm 1.5 and also included the -d32 flag when I run the build script which generated the bluecove snapshot jar. The problem is this

though with the originally distributed bluecove jar which came with lejos, my program runs fine, when I replace it with the snapshot I have built, I get the following error on std out

Native Library bluecove not available
Failed to connect

I call it an error because it is printed in read, while the rest of the output was in black.

Tips appreciated, as is all the help so far.

Fieran
fieranmason
Novice
 
Posts: 37
Joined: Wed Oct 05, 2011 8:32 pm

Re: Building Bluecove to replace lejos distribution version

Postby Shawn » Sat Oct 29, 2011 12:22 am

fieranmason wrote:Hi,

when I replace it with the snapshot I have built, I get the following error on std out

Native Library bluecove not available
Failed to connect



How did you replace it?

I'm guessing you just swapped jars but the new SNAPSHOT has a different name which means it isn't getting found. I'd either try ensuring the name is the same as the old jar (bluecove.jar) or explicitly adding it to your run - configuration classpath (assuming you are launching via eclipse).

Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Re: Building Bluecove to replace lejos distribution version

Postby skoehler » Sat Oct 29, 2011 6:22 pm

Shawn wrote:How did you replace it?


The shell scripts in recent leJOS versions put all *.jar files in the lib/pc folder in the classpath. Just make sure, that no more than one version of each JAR is in the lib/pc folder.
(Having both bluecove.jar and bluecove-2.1.1-SNAPSHOT.jar in the lib/pc folder would be wrong, for example.)

However, can you send me the necessary code to reproduce the error? I want to try for myself.

Also the error you're seeing is most likely due to the fact, that you didn't put the native bluecove library inside bluecove's JAR file.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Building Bluecove to replace lejos distribution version

Postby Shawn » Sat Oct 29, 2011 10:46 pm

skoehler wrote:
Shawn wrote:How did you replace it?


The shell scripts in recent leJOS versions put all *.jar files in the lib/pc folder in the classpath. Just make sure, that no more than one version of each JAR is in the lib/pc folder.
(Having both bluecove.jar and bluecove-2.1.1-SNAPSHOT.jar in the lib/pc folder would be wrong, for example.)


Good to know. It won't however update eclipse if you change the name of the jar. For instance, swapping blucove.jar with bluecove-2.1.1-SNAPSHOT.jar will give the following error:

"The archive: /lejos_nxj/lib/pc/3rdparty/bluecove.jar which is referenced by the classpath, does not exist.", even though bluecove-2.1.1-SNAPSHOT.jar is there. That would need to be configured within the run- configuration tab before launching your pc side program.

using lejos_nxj/bin/nxjpc to launch your pcside program definitately does find the bluecove-2.1.1-SNAPSHOT.jar so I would guess skeohler is right and maybe you didn't get the snapshot built correctly.

Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Re: Building Bluecove to replace lejos distribution version

Postby skoehler » Sat Oct 29, 2011 10:57 pm

Shawn wrote:
skoehler wrote:
Shawn wrote:How did you replace it?


The shell scripts in recent leJOS versions put all *.jar files in the lib/pc folder in the classpath. Just make sure, that no more than one version of each JAR is in the lib/pc folder.
(Having both bluecove.jar and bluecove-2.1.1-SNAPSHOT.jar in the lib/pc folder would be wrong, for example.)


Good to know. It won't however update eclipse if you change the name of the jar. For instance, swapping blucove.jar with bluecove-2.1.1-SNAPSHOT.jar will give the following error:

"The archive: /lejos_nxj/lib/pc/3rdparty/bluecove.jar which is referenced by the classpath, does not exist.", even though bluecove-2.1.1-SNAPSHOT.jar is there. That would need to be configured within the run- configuration tab before launching your pc side program.


When using the Eclipse plug-in, you might have to restart Eclipse so that the plug-in discovers the new JAR files. As far as I remember, I didn't manage to make it discover the changed when you press F5.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Building Bluecove to replace lejos distribution version

Postby fieranmason » Sat Oct 29, 2011 11:15 pm

What you do is to turn your project into a lejos project ... it already is one, but keep reading. When you do this is reconfigures your build path to be a brick lejos project to start, you then edit the configuration in eclipse using the wizard to make your project a pc project instead. This loads the jars ... all jars in the lib/pc/3rd party dir. Even if it has a different name, so long as the jars contain the same classes this works.

What do you mean by include the bluecove native libraries in the jar? Should I dig through the build.xml that comes with the bluecove source to sort out how to do this?

Thanks Fieran
fieranmason
Novice
 
Posts: 37
Joined: Wed Oct 05, 2011 8:32 pm

Re: Building Bluecove to replace lejos distribution version

Postby fieranmason » Sat Oct 29, 2011 11:18 pm

Also,
I'm happy to send out code as its only a few files, but they are getting large so the forum would be a bad place to post them

and

./build-native-osx.sh
-bash: ./build-native-osx.sh: /bin/sh^M: bad interpreter: No such file or directory

that's what happens when I try and run the bluecove sh that's suppose to create my native libs
Fieran
Last edited by fieranmason on Sat Oct 29, 2011 11:31 pm, edited 1 time in total.
fieranmason
Novice
 
Posts: 37
Joined: Wed Oct 05, 2011 8:32 pm

Re: Building Bluecove to replace lejos distribution version

Postby skoehler » Sat Oct 29, 2011 11:19 pm

fieranmason wrote:What do you mean by include the bluecove native libraries in the jar? Should I dig through the build.xml that comes with the bluecove source to sort out how to do this?


I have no idea how they do it, but the original bluecove.jar contains a file called libbluecove.jnilib. The JAR you built does not contain that file. You need to build it as well. It's a shared library, like you create with a c compiler and a linker.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Building Bluecove to replace lejos distribution version

Postby fieranmason » Sat Oct 29, 2011 11:32 pm

I guess I'll have to do some more reading. Thanks skohler
fieranmason
Novice
 
Posts: 37
Joined: Wed Oct 05, 2011 8:32 pm

Re: Building Bluecove to replace lejos distribution version

Postby Shawn » Sat Oct 29, 2011 11:33 pm

fieranmason wrote:
What do you mean by include the bluecove native libraries in the jar? Should I dig through the build.xml that comes with the bluecove source to sort out how to do this?


Ant won't build them (unless you modify it). See http://code.google.com/p/bluecove/wiki/Documentation

Look for "Compilation" --> "On Mac OS X"

Actually those directions don't look so clear but ultimately I think something needs to call http://code.google.com/p/bluecove/source/browse/trunk/bluecove/build-native-osx.sh

Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Re: Building Bluecove to replace lejos distribution version

Postby skoehler » Wed Nov 02, 2011 8:22 am

fieranmason wrote:./build-native-osx.sh
-bash: ./build-native-osx.sh: /bin/sh^M: bad interpreter: No such file or directory

that's what happens when I try and run the bluecove sh that's suppose to create my native libs
Fieran


You should try converting the line endings of that file to unix.
skoehler
leJOS Team Member
 
Posts: 1448
Joined: Thu Oct 30, 2008 4:54 pm

Re: Building Bluecove to replace lejos distribution version

Postby fieranmason » Wed Nov 02, 2011 8:16 pm

Made it over that hurdle

anyone have any idea how to resolve these?

Bluecove/src/main/c/intelbth/OSXStackTest.mm: In function 'OpaqueIOBluetoothObjectRef* createTestDataElementSimple(jint, jlong, jbyte*, int)':
Bluecove/src/main/c/intelbth/OSXStackTest.mm:147: error: jump to case label
Bluecove/src/main/c/intelbth/OSXStackTest.mm:145: error: crosses initialization of 'IOBluetoothSDPDataElement* ds'
Bluecove/src/main/c/intelbth/OSXStackTest.mm:163: error: jump to case label
Bluecove/src/main/c/intelbth/OSXStackTest.mm:151: error: crosses initialization of 'NSString* newStrValue'
Bluecove/src/main/c/intelbth/OSXStackTest.mm:145: error: crosses initialization of 'IOBluetoothSDPDataElement* ds'
Bluecove/src/main/c/intelbth/OSXStackTest.mm: In constructor 'SimpleTestLoop::SimpleTestLoop()':
Bluecove/src/main/c/intelbth/OSXStackTest.mm:224: warning: deprecated conversion from string constant to 'char*'


they come up when I run build-native-osx.sh
fieranmason
Novice
 
Posts: 37
Joined: Wed Oct 05, 2011 8:32 pm

Re: Building Bluecove to replace lejos distribution version

Postby Shawn » Wed Nov 02, 2011 10:27 pm

fieranmason wrote:Made it over that hurdle

anyone have any idea how to resolve these?

Bluecove/src/main/c/intelbth/OSXStackTest.mm: In function 'OpaqueIOBluetoothObjectRef* createTestDataElementSimple(jint, jlong, jbyte*, int)':
...
Bluecove/src/main/c/intelbth/OSXStackTest.mm:224: warning: deprecated conversion from string constant to 'char*'


I noticed the docs say Maven builds it so I tried that.

I got an error
Code: Select all
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (compile-bluecove-jnilib-on-osx) on project bluecove: Command execution failed.


...but after looking at in in Xcode and switichng the SDK to 10.6 (it was set to 10.5 but for xcode 4 on Lion, that sdk is not on my machine)

It now builds via Maven, xcode or just by using the script

Code: Select all
./build-native-osx.sh
=== BUILD NATIVE TARGET bluecove OF PROJECT bluecove WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
** BUILD SUCCEEDED **
---- Created library ----
Copy Library to /Users/family/dev/bluecove-parent/bluecove/target/classes/


I don't have time to actually test it though so let us know how it goes.

Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff