Using the fantom driver on Mac OS X, intel architecture

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: Using the fantom driver on Mac OS X, intel architecture

Post by lizard381 »

javajunkie wrote:Look at both the README and the script itself.

If you are building on Snow Leopard, you will have to change the script as from Java 6 rev 3, jni.h is in the Java Developer package (/System/Library/Frameworks/JavaVM.framework/Headers).

I tested a Snow Leopard build and have it in the script but you have to comment out leopard and enable SL. Have a look at the OSX.sh and the notes should be clear.

Shawn
:oops: After a good night's sleep I realised that I hadn't corrected the fantom home variable is OSX.sh, that got rid of all the errors and allowed me to run build_OSX.sh, but now I'm still getting a bluecove error when trying to compile my test program (I'm using eclipse). The error is:

Code: Select all

Native Library bluecove not available
Exception in thread "main" lejos.pc.comm.NXTCommException: Open of NXT failed: BlueCove library bluecove not available
	at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:127)
	at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:133)
	at BT_PC.main(BT_PC.java:15)
Any thoughts on fixes? I'm pretty sure I've done all the eclipse set up though I may have missed something.

I'm hoping to be able to carry over what I learn from getting this to work in lejos to getting this to work in C++.
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
javajunkie
Posts: 3
Joined: 09 Dec 2010, 08:47

Re: Using the fantom driver on Mac OS X, intel architecture

Post by javajunkie »

lizard381 wrote:

:oops: After a good night's sleep I realised that I hadn't corrected the fantom home variable is OSX.sh, that got rid of all the errors and allowed me to run build_OSX.sh, but now I'm still getting a bluecove error when trying to compile my test program (I'm using eclipse). The error is:

Code: Select all

Native Library bluecove not available
Exception in thread "main" lejos.pc.comm.NXTCommException: Open of NXT failed: BlueCove library bluecove not available
	at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:127)
	at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:133)
	at BT_PC.main(BT_PC.java:15)
Any thoughts on fixes? I'm pretty sure I've done all the eclipse set up though I may have missed something.

I'm hoping to be able to carry over what I learn from getting this to work in lejos to getting this to work in C++.
It looks like you are running the program and seeing a classpath issue because the BlueCove is not in your path. leJos needs BlueCove ...

Shawn
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: Using the fantom driver on Mac OS X, intel architecture

Post by lizard381 »

javajunkie wrote:
lizard381 wrote:

:oops: After a good night's sleep I realised that I hadn't corrected the fantom home variable is OSX.sh, that got rid of all the errors and allowed me to run build_OSX.sh, but now I'm still getting a bluecove error when trying to compile my test program (I'm using eclipse). The error is:

Code: Select all

Native Library bluecove not available
Exception in thread "main" lejos.pc.comm.NXTCommException: Open of NXT failed: BlueCove library bluecove not available
	at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:127)
	at lejos.pc.comm.NXTCommBluecove.open(NXTCommBluecove.java:133)
	at BT_PC.main(BT_PC.java:15)
Any thoughts on fixes? I'm pretty sure I've done all the eclipse set up though I may have missed something.

I'm hoping to be able to carry over what I learn from getting this to work in lejos to getting this to work in C++.
It looks like you are running the program and seeing a classpath issue because the BlueCove is not in your path. leJos needs BlueCove ...

Shawn
I've added BlueCove to the Java Build Path and added it to the PATH variable, so I don't understand how that could be the problem...
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
javajunkie
Posts: 3
Joined: 09 Dec 2010, 08:47

Re: Using the fantom driver on Mac OS X, intel architecture

Post by javajunkie »

lizard381 wrote: 
I've added BlueCove to the Java Build Path and added it to the PATH variable, so I don't understand how that could be the problem...
Well how are you launching your program?

The Java Build Path is only relevant for compiling which it does not seem you are doing here.

The PATH variable -- is that for your OS? If so, I suspect you are running the program from within eclipse but have not set up the run configuration to include the path.

I am not sure what is going wrong where, but am 99.999% sure that for whatever reason bluecove.jar is not available to lejos.pc.comm.NXTCommBluecove which needs it to open a connection.

Shawn
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: Using the fantom driver on Mac OS X, intel architecture

Post by gloomyandy »

One other thing to watch is that you must use a 32bit JVM for all of this (I'm sure Shawn can tell you how to do this). Have you tried running any of the leJOS command line tools (such as nxjbrowse), I would get these working first as that will prove that your system has things setup as you need them. You may want to try forcing just USB with nxjbrowse -u. Did you actually install leJOS on your Mac using the leJOS installer? Also do you really need to do all of this? I thought the main thing was for you to be able to build programs against the Lego SDK on your Mac... Finally if you really want to get Java working on your Mac you may be better off posting questions over on the leJOS forum. There are likely to be more Mac leJOS users that can help over there.

Andy
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: Using the fantom driver on Mac OS X, intel architecture

Post by lizard381 »

gloomyandy wrote:One other thing to watch is that you must use a 32bit JVM for all of this (I'm sure Shawn can tell you how to do this). Have you tried running any of the leJOS command line tools (such as nxjbrowse), I would get these working first as that will prove that your system has things setup as you need them. You may want to try forcing just USB with nxjbrowse -u. Did you actually install leJOS on your Mac using the leJOS installer? Also do you really need to do all of this? I thought the main thing was for you to be able to build programs against the Lego SDK on your Mac... Finally if you really want to get Java working on your Mac you may be better off posting questions over on the leJOS forum. There are likely to be more Mac leJOS users that can help over there.

Andy
javajunkie wrote:
lizard381 wrote: 
I've added BlueCove to the Java Build Path and added it to the PATH variable, so I don't understand how that could be the problem...
Well how are you launching your program?

The Java Build Path is only relevant for compiling which it does not seem you are doing here.

The PATH variable -- is that for your OS? If so, I suspect you are running the program from within eclipse but have not set up the run configuration to include the path.

I am not sure what is going wrong where, but am 99.999% sure that for whatever reason bluecove.jar is not available to lejos.pc.comm.NXTCommBluecove which needs it to open a connection.

Shawn
Thanks both of you :) . I solved the problem. It wasn't the path, I had to set the -d32 switch within eclipse in the preferences, once I did that I got rid of the error, I think I found the suggestion in one of the leJOS forums actually from someone else with the same error. I'd actually edited all the files in the bin to include the -d32 flag AND switched the mac settings to use 32 bit java in java preferences, but I still needed that extra step.

Kami
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: Using the fantom driver on Mac OS X, intel architecture

Post by lizard381 »

lizard381 wrote:
gloomyandy wrote:Hi,
I don't think there is a 64bit version of the SDK. For leJOS (which uses the Fantom driver on Mac and Windows), we use a 32bit jni (native code), library and hence can only run using a 32bit JVM. If it is of any use to you our Fantom interface is here:
http://lejos.svn.sourceforge.net/viewvc ... k/jfantom/
As you can see we have build files and some notes about OS X usage...

Andy
Actually I have problems just running build_OSX.sh, the same problems I'm now having when I try to compile anything linking to the fantom files, I get around 200 errors from the header files, with errors like " 'ViInt32' does not name a type", "'kStatusOffset' was not declared in this scope" or "expected initializer before 'nFANTOM100_iFile_openForWrite' ". I know this must be something silly I've done or have omitted to do in setting everything up.
I've finally gotten main.cpp to compile. Just for the record, I had to change the compile instructions quite a bit, to a 2 step process:
1. g++ -m32 -c -I ./include -I ~/fantom/includes/fantom -I /Library/Frameworks/VISA.framework/Versions/A/Headers -framework Fantom -dylib_file /Library/Frameworks/VISA.framework/Versions/A/VISA:/Library/Frameworks/VISA.framework/Versions/A/VISA main.cpp
2. g++ -m32 main.o -framework Fantom -dylib_file /Library/Frameworks/VISA.framework/Versions/A/VISA:/Library/Frameworks/VISA.framework/Versions/A/VISA -o main

It worked like a charm after that. It was the sweetest beep I ever heard that little NXT make :). gcc -m32 just wasn't working for me at all. I still haven't really gotten it to work in eclipse, but at least it's working from the terminal.
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 5 guests