Bug #3233
closedfinalize ptolemy matlab actor for 1.0 release
0%
Description
For 1.0 release, we decided to use the Ptolemy matlab actor. The following needs to be done:
- use TextArea for expression
- check documentation
- add demo workflows
- compile and check-in ptmatlab lib for all platforms
Files
Updated by Daniel Crawl over 16 years ago
I updated the KAR file to use TextStyle for the expression parameter, but the KAR parser ignores it. (If I add the same XML for a TextStyle attribute to a workflow containing the actor, it works). So ptolemy.matlab.Expression needs attached patch.
Updated by Daniel Crawl over 16 years ago
UtilityFunctions.loadLibrary() fails to find the jni library on Linux. Please apply the attached patch.
Updated by Daniel Crawl over 16 years ago
Updated by Christopher Brooks over 16 years ago
I'm just back from running a workshop yesterday.
I can patch these on Wed, 4/23, so I'm taking this bug. I'll reassign
the bug when I'm done.
However, there is some instability with the Matlab interface and with JNI
in general. Under Cygwin, it is best if a C program launches Java
is Java is to use JNI with gcc. See $PTII/jni/package.htm
So, under Windows, there are two ptmatlab.dll files, one compiled with
Cygwin and one compiled with MSVC.
I'd like to spend some time and make sure Matlab actually works.
Updated by Christopher Brooks over 16 years ago
I replaced the kepler/lib/ptmatlab.dll with the $PTII/lib/ptmatlab.dll_msvc
because the previous ptmatlab.dll gave me the following when I tried
to run the MatlabExpression demo.
ptolemy.kernel.util.IllegalActionException: There was a problem invoking the Ptolemy II Matlab interface.
The interface has been tested under Windows and Linux.
The interface requires that Matlab be installed on the local machine and that the ptmatlab shared library available.
Refer to $PTII/ptolemy/matlab/makefile for more information.
in .MatlabExpression.MatlabExpression
Because:
Did not find 'ptolemy/matlab/ptmatlab' in path, searched user.home (c:\cxh\src\kepler) user.dir (C:\Documents and Settings\cxh) and the classpath for 'ptolemy/matlab/ptmatlab.dll', but that was not found either.
The Java classpath was: c:\cxh\src\kepler\build\classes;c:\cxh\src\kepler\build\src;c:\cxh\src\kepler;c:\cxh\src\kepler\configs;c:\cxh\src\kepler\lib;c:\cxh\src\kepler\lib\images;c:\cxh\src\kepler\build\kepler-icons.jar;c:\cxh\ptII\lib\diva.jar;c:\cxh\ptII\build\ptolemy-doc.jar;c:\cxh\ptII\build\classes;c:\cxh\ptII\build\src
In addition, loadLibrary("ptmatlab") was called, the exception for the loadLibrary() call was: java.lang.UnsatisfiedLinkError: C:\WINDOWS\system32\ptmatlab.dll: Can't load this .dll (machine code=0x701) on a IA 32-bit platform
at ptolemy.matlab.Expression.preinitialize(Expression.java:205)
at ptolemy.actor.Director.preinitialize(Director.java:865)
at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:527)
at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1103)
at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:913)
at ptolemy.actor.Manager.initialize(Manager.java:578)
at ptolemy.actor.Manager.execute(Manager.java:321)
at ptolemy.actor.Manager.run(Manager.java:1071)
at ptolemy.actor.Manager$3.run(Manager.java:1112)
Caused by: java.lang.UnsatisfiedLinkError: Did not find 'ptolemy/matlab/ptmatlab' in path, searched user.home (c:\cxh\src\kepler) user.dir (C:\Documents and Settings\cxh) and the classpath for 'ptolemy/matlab/ptmatlab.dll', but that was not found either.
The Java classpath was: c:\cxh\src\kepler\build\classes;c:\cxh\src\kepler\build\src;c:\cxh\src\kepler;c:\cxh\src\kepler\configs;c:\cxh\src\kepler\lib;c:\cxh\src\kepler\lib\images;c:\cxh\src\kepler\build\kepler-icons.jar;c:\cxh\ptII\lib\diva.jar;c:\cxh\ptII\build\ptolemy-doc.jar;c:\cxh\ptII\build\classes;c:\cxh\ptII\build\src
In addition, loadLibrary("ptmatlab") was called, the exception for the loadLibrary() call was: java.lang.UnsatisfiedLinkError: C:\WINDOWS\system32\ptmatlab.dll: Can't load this .dll (machine code=0x701) on a IA 32-bit platform
at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:923)
at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
at ptolemy.matlab.Expression.preinitialize(Expression.java:202)
... 8 more
Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: ptolemy/matlab/ptmatlab
at java.lang.Runtime.load0(Runtime.java:767)
at java.lang.System.load(System.java:1005)
at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:807)
... 10 more
Caused by: java.lang.UnsatisfiedLinkError: Did not find 'ptolemy/matlab/ptmatlab' in path, searched user.home (c:\cxh\src\kepler) user.dir (C:\Documents and Settings\cxh) and the classpath for 'ptolemy/matlab/ptmatlab.dll', but that was not found either.
The Java classpath was: c:\cxh\src\kepler\build\classes;c:\cxh\src\kepler\build\src;c:\cxh\src\kepler;c:\cxh\src\kepler\configs;c:\cxh\src\kepler\lib;c:\cxh\src\kepler\lib\images;c:\cxh\src\kepler\build\kepler-icons.jar;c:\cxh\ptII\lib\diva.jar;c:\cxh\ptII\build\ptolemy-doc.jar;c:\cxh\ptII\build\classes;c:\cxh\ptII\build\src
In addition, loadLibrary("ptmatlab") was called, the exception for the loadLibrary() call was: java.lang.UnsatisfiedLinkError: C:\WINDOWS\system32\ptmatlab.dll: Can't load this .dll (machine code=0x701) on a IA 32-bit platform
at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:923)
at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
at ptolemy.matlab.Expression.preinitialize(Expression.java:202)
at ptolemy.actor.Director.preinitialize(Director.java:865)
at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:527)
at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1103)
at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:913)
at ptolemy.actor.Manager.initialize(Manager.java:578)
at ptolemy.actor.Manager.execute(Manager.java:321)
at ptolemy.actor.Manager.run(Manager.java:1071)
at ptolemy.actor.Manager$3.run(Manager.java:1112)
Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: ptolemy/matlab/ptmatlab
at java.lang.Runtime.load0(Runtime.java:767)
at java.lang.System.load(System.java:1005)
at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:807)
... 10 more
I also updated the demo to include a little more info about JNI.
I also updated build.xml so that kepler.sh works under Cygwin
The one remaining thing is that kepler/lib/ptmatlab.dll has the wrong
permissions, it needs to be changed to executable.
cxh@DOPLAP35 ~/src/kepler-1.0.0
$ rm lib/ptmatlab.dll
cxh@DOPLAP35 ~/src/kepler-1.0.0
$ cvs update lib/ptmatlab.dll
cvs update: warning: lib/ptmatlab.dll was lost
U lib/ptmatlab.dll
cxh@DOPLAP35 ~/src/kepler-1.0.0
$ ls l lib/ptmatlab.dll 1 cxh Administrators 53356 Apr 23 15:31 lib/ptmatlab.dll
-rw-r--r-
cxh@DOPLAP35 ~/src/kepler-1.0.0
The solution is to log on to the CVS server and do
chmod a+x lib/ptmatlab.dll.
I suggest fixing the permissions for the java and other
files in the cvs repository
chmod -R a+rX .
find . -name "*.dll,v" -exec chmod a-x {} \;
find . -name "*.java,v" -exec chmod a-x {} \;
find . -name "*.htm,v" -exec chmod a-x {} \;
find . -name "*.html,v" -exec chmod a-x {} \;
find . -name "*makefile,v" -exec chmod a-x {} \;
find . -name "*.tcl,v" -exec chmod a-x {} \;
find . -name "*.xml,v" -exec chmod a-x {} \;
I'm assigning this to Chad because either he can access the CVS
repository and make kepler/lib/ptmatlab.dll executable, or he
knows someone who can.
Once the permissions on ptmatlab.dll are changed, this bug can be closed.
Updated by Daniel Crawl over 16 years ago
FYI, I had no problems with ptmatlab.dll on cygwin.
Was your c:\windows\system32\ptmatlab.dll was the same version from Kepler CVS?
Updated by Chad Berkley over 16 years ago
I updated the repository so that ptmatlab.dll is executable. I'm moving Christopher's other suggestions for permission changes to a new bug.
Updated by Christopher Brooks over 16 years ago
I'm not sure what's up with c:/Windows/System32/ptmatlab.dll.
The file I have is
$ ls -l c:/Windows/System32/ptmatlab.dll
-rwxrwxrwx 1 cxh Administrators 53248 Apr 23 15:24
c:/Windows/System32/ptmatlab.
dll
It was the same as the one that was checked in at 1.1 of ptmatlab.dll.
However, running the Kepler MatlabExpression.xml demo caused Kepler to
hang during the load of ptmatlab.dll for me when Kepler was invoked
under Cygwin (via kepler.sh). I also had errors under DOS with Kepler.bat.
Concerning cygwin, it matters how recent cygwin and gcc are. Newer versions
cause problems, older versions work. See $PTII/jni/package.html.
I'll include the output of cygcheck -s as an attachment.
Does the current ptmatlab.dll work for you?
BTW - any idea why c:/Windows/System32/ptmatlab.dll exists?
I think it shows up during the loadLibary() call
by Java, but I have not looked into it. In general, I feel it is very
poor that any dlls end up in c:/Windows/System32. It is poor because it
is a security hole, it is poor because it means that multiple users can't
share a machine. I guess this is a Windows/Java botch.
BTW - The version that was in CVS was much smaller.
Also, it looks like ptmatlab.dll was not checked in with -kb, so it
could get corrupted.
$ cvs status ptmatlab.dll
===================================================================
File: ptmatlab.dll Status: Up-to-date
Working revision: 1.2
Repository revision: 1.2 /cvs/kepler/lib/ptmatlab.dll,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
Compare this with garp.dll
$ cvs status garp.dll
===================================================================
File: garp.dll Status: Up-to-date
Working revision: 1.2
Repository revision: 1.2 /cvs/kepler/lib/garp.dll,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: -kb
Updated by Christopher Brooks over 16 years ago
This is the cygcheck -s output from my machine.
Updated by Christopher Brooks over 16 years ago
I fixed the cvs -kb problem of ptmatlab.dll in the devel head and release branch.
Updated by Daniel Crawl over 16 years ago
Sorry, I forgot to add -kb. I added it to the linux and mac versions.
The current ptmatlab.dll works for me, both in windows and cygwin.
I agree that putting libraries into /windows/system32/ is bad.
Anyone know when $KEPLER/lib/cplibs.bat is executed? Can we remove it?
Updated by Chad Berkley over 16 years ago
cplibs.bat/sh is run by the installer. If it doesn't run, the libraries for the gdal stuff don't work. I'm open to suggestions for making it work without copying files to system32.
Updated by Christopher Brooks over 16 years ago
I'm closing the Matlab bug because I opened bug# 3242
"dlls should not go in c:/Windows/System32"