trouble getting viptos started

trouble getting viptos started

Post by cxh » Sat, 17 Nov 2007 06:07:39


i Wahid

jni.h is part of Java.

It looks like your build is not finding the Java include files.

On a random linux box, my jni.h is in:

cxh@dgc3:~$ ls /usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/
jawt.h jdwpTransport.h jni.h jvmdi.h jvmpi.h jvmti.h linux


On another box, I have:

-bash-3.1$ ls /usr/java/jdk1.6.0/include
classfile_constants.h jawt.h jdwpTransport.h jni.h jvmti.h linux


You could trying running configure:
cd $PTII
./configure


Under Linux, you should see something like:

checking for the proper JNI architecture... 'linux'
checking for the proper JNI architecture include directory... /usr/java/jdk1.6.0/jre/../include/linux
checking for the proper JNI architecture... 'i386'
checking for the proper JNI architecture lib directory... /usr/java/jdk1.6.0/jre/lib/linux
checking for if the -mno-cygwin flag is available... ''
checking for the proper shared library cc flag... ''
checking for the proper shared library link flag... ''
checking for the proper shared library prefix... 'lib'
checking for the proper shared library suffix... 'so'
checking for JNI libraries needed to link JNI... ''

Do you see something similar?

You could try testing out just the JNI part of Ptolemy
instead of trying in conjunction with PtinyOS.


http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII6.0/ptII/ptolemy/domains/ptinyos/doc/installation.htm

suggests trying the following for Windows, but you could try it
for Linux:

cd $PTII
./configure
make

cd $PTII/jni/test
make


Using JNI is very difficult, it combines the worst of Java and
the worst of C. You might find it helpful to look at the
Java tutorial so that you understand why jni.h is necessary etc.

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html

_Christopher

--------

hi, please ignore my lat message. thanks to
tinyos floks, i have a vmware installation of tos
on xubuntu up and running. i installed vitps on
top and this is what i am getting when i run a
demo
(the starting error is about inability to find
jni.h):
---ptolemy.kernel.util.IllegalActionException:
Running "make -C
/usr/PTII/ptolemy/domains/ptinyos/demo/SenseToLeds/output
-f
_SenseToLeds_InWireless_MicaBoard_MicaCompositeActor0.mk
ptII" returned '2', which is a nonzero value,
which indicates an error.
Output:
make: Entering directory
`/usr/PTII/ptolemy/domains/ptinyos/demo/SenseToLeds/output'
mkdir -p build/ptII
compiling
_SenseToLeds_InWireless_MicaBoard_MicaCompositeActor0
to a ptII binary
ncc -E -o build/ptII/main.exe -g -O0
-I%T/lib/Counters -DCOMMAND_PORT=10584
-DEVENT_PORT=10585 -D_PTII_NODEID=0
"-I/usr/PTII/vendors/ptinyos/tinyos-1.x/contrib/ptII/ptinyos/beta/TOSSIM-pa
cket"
-I/usr/PTII/vendors/ptinyos/tinyos-1.x/tos/../contrib/ptII/ptinyos/tos/plat
form/ptII
-I/usr/PTII/vendors/ptinyos/tinyos-1.x/tos/../contrib/ptII/ptinyos/tos/type
s
-fnesc-nido-tosnodes=1000 -Wall -Wshadow
-DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=ptII
-fnesc-cfile=build/ptII/app.c -board=micasb
-DPLATFORM_PC
-DIDENT_PROGRAM_NAME=\"_SenseToLeds_In\"
-DIDENT_USER_ID=\"root\"
-DIDENT_HOSTNAME=\"wahid-desktop\"
-DIDENT_USER_HASH=0xcd0dd9e6L
-DIDENT_UNIX_TIME=0x473c2296L
-DIDENT_UID_HASH=0xa4a57787L
_SenseToLeds_InWireless_M
 
 
 

trouble getting viptos started

Post by hamishag » Sun, 18 Nov 2007 23:07:11

i chris,
thanks for your reply,and soory for bothering
further:
you were right. i have problem with jni itself.
the demos donot run correctly and making jni/test
returns an error:
jar" "-Dptolemy.ptII.dir=/usr/PTII"
tcl/lang/Shell alljtests.tcl
Error: dlopen("libjvm.so") failed with libjvm.so:
cannot open shared object file: No such file or
directory.
this is while i have that file in the following
locations:
find / |grep libjvm.so
/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/i386/client/libjvm.so
/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/i386/server/libjvm.so
/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/lib/i386/client/libjvm.so
/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/lib/i386/server/libjvm.so

and for your information :
1-$LD_LIBRARY_PATH=
/usr/lib/jvm/java-1.5.0-sun/jre/lib/i386
2-java -version=java version "1.6.0"
3-find / |grep jni.h :
/usr/lib/jvm/java-6-sun-1.6.0.00/include/jni.h
/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/include/jni.h
4- PTII/configure had some warnings:
a)was giving me a warning about not being able to
find 'unknown' jni architecture. in order to
remove the problem, i created a link known as
unknown to:
/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/i386
b)configure: WARNING: Could not find directory
'/usr/PTII/vendors/sun/javacc-4.0'. I first
installed javacc-4.0 and then created
/usr/PTII/vendors/sun/javacc-4.0/bin directory
myself and in there, i created two links to
jjtree and javacc the final output of ./configure
looks like this:

checking if $PTII ('/usr/PTII') has
backslashes... ok
'/usr/PTII' does not contain backslashes
checking if $PTII ('/usr/PTII') contains
"cygdrive"... ok
'/usr/PTII' does not contain cygdrive or
cygwin, which is right.
checking for find... /usr/bin/find
PTJAVA_DIR environment variable was not set,
so we search for the java compiler.
checking for javac... /usr/bin/javac
checking for the java runtime in /usr/bin...
/usr/bin/java
checking that you have the right java in your
path.... checking for java... /usr/bin/java
You have the right java in your path,
"/usr/bin/java"
= "/usr/bin/java"
checking for the java compiler in /usr/bin...
/usr/bin/javac
checking that you have the right javac in your
path.... checking for javac... (cached)
/usr/bin/javac
You have the right javac in your path,
"/usr/bin/javac"
= "/usr/bin/javac"
checking the Java compiler with a simple
compile... ok
checking the value of the java.version Property
... 1.6.0
checking the JDK version... ok, you are running
1.6.0
checking for java.home property by compiling a
test program ... ok
checking for java.home property by running a test
program ... /usr/lib/jvm/java-6-sun-1.6.0.00/jre
checking for the jar command in /usr/bin...
/usr/bin/jar
checking that /usr/bin/jar can handle -i...
/usr/bin/jar -i worked
checking for the proper CLASSPATH separator...
':'
/usr/PTII/mescal/views/simulation/model/UINT.H is
not present,
so we need not find Boost.
/usr/PTII/ptolemy/copernicus/c is not present,
so we need not find the CaffeineMark Kit.
/usr/PTII/ptolemy/caltrop is not present,
so we need not find the Cal, the actor
language.
/usr/PTII/ptolemy/chic is not present,
so we need not find Chic, the modular
verifier for
behavioral compatibility checking of software
and hardware components.
checking for Ptolemy subset of Colt, the
scientific computing lib...
/usr/PTII/lib/colt.jar
checkin
 
 
 

trouble getting viptos started

Post by cxh » Tue, 20 Nov 2007 13:09:18

i Wahid,

Running configure is not guessing the proper Java architecture.

Details below



You would need to set LD_LIBRARY_PATH to include
/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/i386/client
Under bash, try
export LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/i386/client;${LD_LIBRARY_PATH}

I'm not sure why this is not happening automatically for you.



Right, the problem here is that configure is not guessing
your architecture, which should be i386.

What does "uname -s" return for you?

If is is not "Linux", you could edit configure.in and find this
section:

--start--


AC_MSG_CHECKING([for the proper JNI architecture])
case "`uname -s`" in
CYGWIN_ME-*) PTJNI_ARCHITECTURE=win32;;
CYGWIN_NT-*) PTJNI_ARCHITECTURE=win32;;
CYGWIN_98-*) PTJNI_ARCHITECTURE=win32;;
Linux) PTJNI_ARCHITECTURE=linux;;
SunOS) PTJNI_ARCHITECTURE=solaris;;
Darwin) PTJNI_ARCHITECTURE=darwin
PTJNI_DIR=
AC_MSG_WARN([
The Ptolemy JNI facilty is not supported on MacOS
because Apple laid out the Java directory differently
than the Windows, Solaris and Linux Java directories.
As a result, the Ptolemy JNI facility will not work.]);
;;
*) PTJNI_ARCHITECTURE=unknown;;
esac
--end--

You would then insert what every "uname -s" return
and set PTJNI_ARCHITECTURE accordingly. For example,
if uname -s returned Kubuntu, you would insert

Kubuntu) PTJNI_ARCHITECTURE=i386

You might want to look in configure.in for other places we call
"uname -s".

You might need to do the same for uname -p if it does not
return something that ends with 86. See the section:
--start--
case "`uname -p`" in
*86) PTJNI_LIB_ARCHITECTURE=i386;;
sparc) PTJNI_LIB_ARCHITECTURE=sparc;;
unknown) if test $PTJNI_ARCHITECTURE = "win32"; then
PTJNI_LIB_ARCHITECTURE=i386
else
PTJNI_LIB_ARCHITECTURE=unknown
fi
;;
*) PTJNI_LIB_ARCHITECTURE=unknown;;
esac
--end--
Once you've made your edits, run
autoconf
./configure




It is not necessary to have jjtree and javacc, but
what what you've done sounds good.




_Christopher

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: XXXX@XXXXX.COM
 
 
 

trouble getting viptos started

Post by hamishag » Wed, 21 Nov 2007 18:19:42

hello again,
in the process of getting viptos started, i
realized that i have some problem in JNI. the
first error that i get is: "jni.h: no such file
or directory". i tried to run a jni demo
included in pt package and this is what i'm
getting.
i'll appreciate your kind help:
wahid@wahid:/usr/PTII/jni/demo/HelloWorld$ make
/usr/bin/gcc -shared \
\
"-I/usr/include" \
"-I/usr/include/linux" \
-o libHelloWorld.so \
HelloWorld.c
In file included from
/usr/include/_G_config.h:44,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from HelloWorld.c:2:
/usr/include/gconv.h:72: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/gconv.h:88: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/gconv.h:97: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/gconv.h:174: error: expected
specifier-qualifier-list before ize_t? In file included from /usr/include/stdio.h:72,
from HelloWorld.c:2:
/usr/include/libio.h:328: error: expected
specifier-qualifier-list before ize_t? /usr/include/libio.h:360: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/libio.h:369: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/libio.h:485: error: expected ??
?? ?? sm?or _attribute__?before
IO_sgetn? In file included from HelloWorld.c:2:
/usr/include/stdio.h:306: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:313: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:355: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:357: error: format string
argument not a string type
/usr/include/stdio.h:359: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:608: error: expected ??
?? ?? sm?or _attribute__?before read? /usr/include/stdio.h:614: error: expected ??
?? ?? sm?or _attribute__?before
write? /usr/include/stdio.h:636: error: expected ??
?? ?? sm?or _attribute__?before
read_unlocked? /usr/include/stdio.h:638: error: expected ??
?? ?? sm?or _attribute__?before
write_unlocked? In file included from HelloWorld.c:4:
HelloWorld.h:2:17: error: jni.h: No such file or
directory
In file included from HelloWorld.c:4:
HelloWorld.h:15: error: expected ?? ?? ??
sm?or _attribute__?before oid? HelloWorld.c:6: error: expected ?? ?? ??
sm?or _attribute__?before oid? make: *** [libHelloWorld.so] Error 1

wahid@wahid:/usr/PTII/jni/demo/HelloWorld$ ls
HelloWorld.c HelloWorld.class HelloWorld.h
HelloWorld.java makefile

thanks
wahid



____________________________________________________________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yqcomputer.com/

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: XXXX@XXXXX.COM
 
 
 

trouble getting viptos started

Post by cxh » Thu, 22 Nov 2007 00:34:30

i Wahid,

I suspect the problem is that your java is located
in /usr/bin/java and configure is not correctly finding
jni.h because it is not in /usr/include.
This can occur when /usr/bin/java is a link.

Fixing configure for this is non-trivial,
it means trying to follow the link, which is not easy.
Someday, I can have a fix for this.

Try something like this:

bash-3.00$ which java
/usr/bin/java
bash-3.00$ ls -l /usr/bin/java
lrwxrwxrwx 1 root other 16 Jun 21 2006 /usr/bin/java -> ../java/bin/java
bash-3.00$ ./configure --with-java=/usr/java


I'm not sure what the errors around gconv.h are.
It looks like
Make sure that a simple non-jni program compiles
correctly.


bash-3.00$ cat h.c
#include <stdio.h>
main() {
printf("Hello World\n");
}
bash-3.00$ gcc h.c
bash-3.00$ ./a.out
Hello World
bash-3.00$

If you still have the gconv.h error with the
above program, try searching for the error message
on the net.

_Christopher
--------

hello again,
in the process of getting viptos started, i
realized that i have some problem in JNI. the
first error that i get is: "jni.h: no such file
or directory". i tried to run a jni demo
included in pt package and this is what i'm
getting.
i'll appreciate your kind help:
wahid@wahid:/usr/PTII/jni/demo/HelloWorld$ make
/usr/bin/gcc -shared \
\
"-I/usr/include" \
"-I/usr/include/linux" \
-o libHelloWorld.so \
HelloWorld.c
In file included from
/usr/include/_G_config.h:44,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from HelloWorld.c:2:
/usr/include/gconv.h:72: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/gconv.h:88: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/gconv.h:97: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/gconv.h:174: error: expected
specifier-qualifier-list before ize_t? In file included from /usr/include/stdio.h:72,
from HelloWorld.c:2:
/usr/include/libio.h:328: error: expected
specifier-qualifier-list before ize_t? /usr/include/libio.h:360: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/libio.h:369: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/libio.h:485: error: expected ??
?? ?? sm?or _attribute__?before
IO_sgetn? In file included from HelloWorld.c:2:
/usr/include/stdio.h:306: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:313: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:355: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:357: error: format string
argument not a string type
/usr/include/stdio.h:359: error: expected
declaration specifiers or ?..?before ize_t? /usr/include/stdio.h:608: error: expected ??
?? ?? sm?or _attribute__?before read? /usr/include/stdio.h:614: error: expected ??
?? ?? sm?or _attribute__?before
write? /usr/include/stdio.h:636: error: expected ??
?? ?? sm?or _attribute__?before
read_unlocked? /usr/include/stdio.h:638: err