Project

General

Profile

Actions

Bug #5346

closed

Kepler 2.2r3 Mac OS 64-bit Matlab demo fails with 'no suitable image found'

Added by Christopher Brooks about 13 years ago. Updated almost 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
actors
Target version:
Start date:
03/08/2011
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5346

Description

Under the Kepler-2.2r3 dmg installer, Mac OS X 10.5 with 64bit Java,
The Matlab demo at
Help > Kepler Documentation -> background information about Ptolemy
> Documentation -> Complete list of demos -> SDF -> Matlab
fails.

My ~/.MacOSX/environment.plist contains:

{
"DYLD_LIBRARY_PATH" = "/Users/cxh/ptII/vendors/misc/dbxml-2.5.16/install/lib:/Applications/MATLA\
B_R2009b.app/sys/os/maci64/:/Applications/MATLAB_R2009b.app/sys/os/maci";
"New item" = "";
PATH = "/Users/cxh/ptII/vendors/misc/dbxml-2.5.16/install/bin:/Users/cxh/bin:/Users/cxh/ptII/bin\
:/usr/local/apache-maven/bin:/opt/subversion/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbi\
n:/usr/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/usr/local/texlive/2007/bin";
}

Tools -> Check System Variables says:

java.version = 1.6.0_22
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) 64-Bit Server VM

The error is:

ptolemy.kernel.util.IllegalActionException: There was a problem invoking the Ptolemy II Matlab interface.
The interface has been tested under Linux, Mac OS X, and Windows.
The interface requires that Matlab be installed on the local machine and that the ptmatlab shared library available.
  • Under Linux, you must have the LD_LIBRARY_PATH environment variable set to include the directories that contain libmx.so and libptmatlab.so.
  • Under Mac OS X, you must have the DYLD_LIBRARY_PATH environment variable set to include the directories that contain libmx.dylib and libptmatlab.jnilib.
  • Under Windows, you must have your PATH set to include the Matlab bin/win32 or equivalent directory so that libmex.dll is found and the directory that contains libptmatlab.dll. In addition, if you are running under Windows from the Cygwin bash prompt, then you must start Vergil with the -jni argument: $PTII/bin/vergil -jni. For details, see $PTII/jni/package.html.
    Refer to $PTII/ptolemy/matlab/makefile for more information.
    in .MatlabExpression.MatlabExpression
    Because:
    /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at ptolemy.matlab.Expression.preinitialize(Expression.java:263)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)
    Caused by: java.lang.UnsatisfiedLinkError: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    ... 9 more
    Caused by: java.lang.UnsatisfiedLinkError: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)

Files

libptmatlab.jnilib (57.4 KB) libptmatlab.jnilib Christopher Brooks, 03/17/2011 11:09 AM
Actions #1

Updated by jianwu jianwu about 13 years ago

I can run Matlab actor on my mac 10.6 64bit machine. My java is 1.6 64bit, and my matlab is R2010a 64 bit.

Christopher, is your matlab 64 bit or 32 bit? Your mac is 32bit?

Actions #2

Updated by Christopher Brooks about 13 years ago

I'm running Mac OS 10.5.8.
I have a 32-bit Java 1.5 JVM
and a 64-bit Java 1.6 JVM

I'm not sure if my Matlab is 32-bit or 64-bit.
I have maci and maci64 libraries:
/Applications/MATLAB_R2009b.app//bin/maci
/Applications/MATLAB_R2009b.app//bin/maci64

Here's my jvm info:
bash-3.2$ /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java -version
java version "1.5.0_26"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_26-b03-376-9M3263)
Java HotSpot(TM) Client VM (build 1.5.0_26-156, mixed mode, sharing)
bash-3.2$ /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-9M3263)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)

/Applications/Kepler-2.2rc3/Kepler.app/Contents/Info.plist
says:
<key>JVMVersion</key>
<string>1.6+</string>

Actions #3

Updated by jianwu jianwu about 13 years ago

I can see '64-bit(maci64)' in the figure if I click 'help->About MATLAB'. So if you do not have it, it should be 32 bit?

Actions #4

Updated by Daniel Crawl about 13 years ago

Looks like your DYLD_LIBRARY_PATH is missing /Applications/MATLAB_R2009b.app/bin/maci64 for 64bit and /Applications/MATLAB_R2009b.app/bin/maci for 32bit.

Actions #5

Updated by Christopher Brooks about 13 years ago

I'm having Matlab licensing problems, but when I run
$PTII/bin/vergil $PTII/ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml
I get a Matlab splash screen that wants my licensing info.

I can't tell if my Matlab is 32 or 64 bit right now. I'll work on that.

My ~/.MacOSX/environment.plist is {
"DYLD_LIBRARY_PATH" = "/Users/cxh/ptII/vendors/misc/dbxml-2.5.16/install/lib:/Applications/MATLAB_R2009b.app/bin/maci:/Applications/MATLAB_R2009b.app/bin/maci64:/Applications/MATLAB_R2009b.app/sys/os/maci";
PATH = "/Users/cxh/ptII/vendors/misc/dbxml-2.5.16/install/bin:/Users/cxh/bin:/Users/cxh/ptII/bin:/usr/local/apache-maven/bin:/opt/subversion/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/usr/local/texlive/2007/bin";
}

DYLD_LIBRARY_PATH in my bash process is:

bash-3.2$ echo $DYLD_LIBRARY_PATH
/Users/cxh/ptII/vendors/misc/dbxml-2.5.16/install/lib:/Applications/jprofiler5_2_4/bin/macos:/Applications/MATLAB_R2009b.app//bin/maci/:/Applications/MATLAB_R2009b.app//bin/maci64/:/Users/cxh/ptII/lib/Users/cxh/ptII/lib:/Applications/MATLAB_R2009b.app/sys/os/maci/:/Applications/MATLAB_R2009b.app/sys/os/maci64

Interestingly, in Ptolemy under $PTII/bin/vergil
View ->JVM Properties yields the following value for
java.library.path

java.library.path = /Users/cxh/ptII/lib:/Users/cxh/ptII/vendors/misc/dbxml-2.5.16/install/lib:/Applications/jprofiler5_2_4/bin/macos:/Applications/MATLAB_R2009b.app//bin/maci/:/Applications/MATLAB_R2009b.app//bin/maci64/:/Users/cxh/ptII/lib/Users/cxh/ptII/lib:/Applications/MATLAB_R2009b.app/sys/os/maci/:/Applications/MATLAB_R2009b.app/sys/os/maci64:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

However, when I run "ant run" in the development tree, I java.library.path
is:

java.library.path = /Users/cxh/src/kepler/r/lib:/Users/cxh/src/kepler/common/lib:/Users/cxh/src/kepler/common/lib/ptolemy/matlab

Kepler-2.2rc3 has this value:

java.library.path = /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/r-2.2.0/lib:/Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib:/Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab:/Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/ptolemy-8.1.0/lib/ptolemy-lib

What's odd is that the DYLD_LIBRARY_PATH settings from .MacOSX/environment.plist
are not included in the value of java.library.path. Perhaps these
lines in

./build-area/src/org/kepler/build/Run.java:

java.createJvmarg()
.setLine("-Djava.library.path=\"" + new LibPath() + "\"");
are causing problems?

I don't know why this would work for Jianwu and not for me.

It is my impression that JNI needs to have access to the Matlab
shared libraries some how. Usually this is done by setting DY_LDLIBRARY_PATH
under Mac OS X, and this value gets propagated to java.library.path.
However, I believe that the JVM looks in other directories for shared
libraries. I'm not sure what directories this would be for Mac OS X.

Does the Matlab interface work for anyone under Mac OS 10.5?

I have some other tasks to which I must attend, but I can see about
narrowing down the .MacOSX/environment.plist settings sometime over the weekend.

Actions #6

Updated by jianwu jianwu about 13 years ago

Try to be clear about my tests. If I use kepler.sh to start Kepler, the matlab demo workflow pointed by Christopher runs correctly. But if I double-click kepler.app to start, I can not run it (exception message is as follows). I think it is because I only set DYLD_LIBRARY_PATH in my batch environment (namely ~/.bash_profile), not ~/.MacOSX/environment.plist environment.

kepler:Java jianwu$ echo $DYLD_LIBRARY_PATH
/Applications/MATLAB64/MATLAB_R2010a/MATLAB_R2010a.app/bin/maci64

Error for starting Kepler by double-clicking kepler.app:

ptolemy.kernel.util.IllegalActionException: There was a problem invoking the Ptolemy II Matlab interface.
The interface has been tested under Linux, Mac OS X, and Windows.
The interface requires that Matlab be installed on the local machine and that the ptmatlab shared library available.
  • Under Linux, you must have the LD_LIBRARY_PATH environment variable set to include the directories that contain libmx.so and libptmatlab.so.
  • Under Mac OS X, you must have the DYLD_LIBRARY_PATH environment variable set to include the directories that contain libmx.dylib and libptmatlab.jnilib.
  • Under Windows, you must have your PATH set to include the Matlab bin/win32 or equivalent directory so that libmex.dll is found and the directory that contains libptmatlab.dll. In addition, if you are running under Windows from the Cygwin bash prompt, then you must start Vergil with the -jni argument: $PTII/bin/vergil -jni. For details, see $PTII/jni/package.html.
    Refer to $PTII/ptolemy/matlab/makefile for more information.
    in .MatlabExpression.MatlabExpression
    Because:
    /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: Library not loaded: @loader_path/libeng.dylib Referenced from: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib Reason: image not found
    at ptolemy.matlab.Expression.preinitialize(Expression.java:263)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)
    Caused by: java.lang.UnsatisfiedLinkError: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: Library not loaded: @loader_path/libeng.dylib Referenced from: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib Reason: image not found
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    ... 9 more
    Caused by: java.lang.UnsatisfiedLinkError: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: Library not loaded: @loader_path/libeng.dylib Referenced from: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib Reason: image not found
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)
Actions #7

Updated by Christopher Brooks about 13 years ago

Ok, I have my Matlab license situation fixed.
I'm running a 64bit Matlab R2009b with Mac OS 10.5.8 and
java.version = 1.6.0_22

Under Ptolemy, this command works, the plot appears
$PTII/bin/vergil ~/ptII/ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml

View -> JVM Properties says:

java.library.path = /Users/cxh/ptII/lib:/Applications/MATLAB_R2009b.app/bin/maci64:/Applications/jprofiler5_2_4/bin/macos:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

Note that /Applications/MATLAB_R2009b.app/bin/maci64 is in the path

Kepler devel run with "ant run" fails when
I do Help > Kepler Documentation -> background information on Ptolemy
>Documentation -> Complete List of Demos -> SDF -> Matlab Expression.

The error is

ptolemy.kernel.util.IllegalActionException: There was a problem invoking the Ptolemy II Matlab interface.
The interface has been tested under Linux, Mac OS X, and Windows.
The interface requires that Matlab be installed on the local machine and that the ptmatlab shared library available.
  • Under Linux, you must have the LD_LIBRARY_PATH environment variable set to include the directories that contain libmx.so and libptmatlab.so.
  • Under Mac OS X, you must have the DYLD_LIBRARY_PATH environment variable set to include the directories that contain libmx.dylib and libptmatlab.jnilib.
  • Under Windows, you must have your PATH set to include the Matlab bin/win32 or equivalent directory so that libmex.dll is found and the directory that contains libptmatlab.dll. In addition, if you are running under Windows from the Cygwin bash prompt, then you must start Vergil with the -jni argument: $PTII/bin/vergil -jni. For details, see $PTII/jni/package.html.
    Refer to $PTII/ptolemy/matlab/makefile for more information.
    in .MatlabExpression.MatlabExpression
    Because:
    /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at ptolemy.matlab.Expression.preinitialize(Expression.java:263)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1736)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)
    Caused by: java.lang.UnsatisfiedLinkError: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    ... 9 more
    Caused by: java.lang.UnsatisfiedLinkError: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1736)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)

In this version of Kepler, the java.library.path does not
include the Matlab directory:

java.library.path = /Users/cxh/src/kepler/r/lib:/Users/cxh/src/kepler/common/lib:/Users/cxh/src/kepler/common/lib/ptolemy/matlab

Interestingly, when I do
cp /Users/cxh/ptII/lib/libptmatlab.jnilib /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib

then
ant run-only -Dworkflow=../ptolemy/src/ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml
works!

So, it looks like kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib
does not work on my Mac OS X 10.5.8

From the stacktrace above:
/Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022

Searching the net for "unknown required load command 0x80000022"
results in some possible issues with CFLAGS.
I'm not sure how kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib
is generated, but that would be the place to start.

Kepler-2.2rc3

Help > Kepler Documentation -> background information on Ptolemy
>Documentation -> Complete List of Demos -> SDF -> Matlab Expression.

I got basically the same stacktrace as above:

/Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022

One issue is that there are to libptmatlab.jnilib files in Kepler-2.2rc3:
59005405 128 rw-r--r- 1 cxh admin 61472 Feb 28 21:12 ./Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib
59006098 120 rw-r--r- 1 cxh admin 58728 Feb 28 21:12 ./Resources/Java/ptolemy-8.1.0/lib/ptolemy-lib/libptmatlab.jnilib

If I do:

cp ~/ptII/ptolemy/matlab/libptmatlab.jnilib ./Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib

Then the MatlabExpression demo works under Kepler-2.2rc3.

I've attached my working version of libptmatlab.jnilib.

Actions #8

Updated by Christopher Brooks about 13 years ago

Ok, I have my Matlab license situation fixed.
I'm running a 64bit Matlab R2009b with Mac OS 10.5.8 and
java.version = 1.6.0_22

Under Ptolemy, this command works, the plot appears
$PTII/bin/vergil ~/ptII/ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml

View -> JVM Properties says:

java.library.path = /Users/cxh/ptII/lib:/Applications/MATLAB_R2009b.app/bin/maci64:/Applications/jprofiler5_2_4/bin/macos:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

Note that /Applications/MATLAB_R2009b.app/bin/maci64 is in the path

Kepler devel run with "ant run" fails when
I do Help > Kepler Documentation -> background information on Ptolemy
>Documentation -> Complete List of Demos -> SDF -> Matlab Expression.

The error is

ptolemy.kernel.util.IllegalActionException: There was a problem invoking the Ptolemy II Matlab interface.
The interface has been tested under Linux, Mac OS X, and Windows.
The interface requires that Matlab be installed on the local machine and that the ptmatlab shared library available.
  • Under Linux, you must have the LD_LIBRARY_PATH environment variable set to include the directories that contain libmx.so and libptmatlab.so.
  • Under Mac OS X, you must have the DYLD_LIBRARY_PATH environment variable set to include the directories that contain libmx.dylib and libptmatlab.jnilib.
  • Under Windows, you must have your PATH set to include the Matlab bin/win32 or equivalent directory so that libmex.dll is found and the directory that contains libptmatlab.dll. In addition, if you are running under Windows from the Cygwin bash prompt, then you must start Vergil with the -jni argument: $PTII/bin/vergil -jni. For details, see $PTII/jni/package.html.
    Refer to $PTII/ptolemy/matlab/makefile for more information.
    in .MatlabExpression.MatlabExpression
    Because:
    /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at ptolemy.matlab.Expression.preinitialize(Expression.java:263)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1736)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)
    Caused by: java.lang.UnsatisfiedLinkError: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    ... 9 more
    Caused by: java.lang.UnsatisfiedLinkError: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1020)
    at ptolemy.data.expr.UtilityFunctions._loadLibrary(UtilityFunctions.java:1985)
    at ptolemy.data.expr.UtilityFunctions.loadLibrary(UtilityFunctions.java:847)
    at ptolemy.matlab.Engine.<clinit>(Engine.java:176)
    at ptolemy.matlab.Expression.preinitialize(Expression.java:260)
    at ptolemy.actor.Director.preinitialize(Director.java:1010)
    at ptolemy.actor.Director.preinitialize(Director.java:991)
    at ptolemy.domains.sdf.kernel.SDFDirector.preinitialize(SDFDirector.java:647)
    at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1736)
    at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
    at ptolemy.actor.Manager.initialize(Manager.java:643)
    at ptolemy.actor.Manager.execute(Manager.java:340)
    at ptolemy.actor.Manager.run(Manager.java:1164)
    at ptolemy.actor.Manager$3.run(Manager.java:1217)

In this version of Kepler, the java.library.path does not
include the Matlab directory:

java.library.path = /Users/cxh/src/kepler/r/lib:/Users/cxh/src/kepler/common/lib:/Users/cxh/src/kepler/common/lib/ptolemy/matlab

Interestingly, when I do
cp /Users/cxh/ptII/lib/libptmatlab.jnilib /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib

then
ant run-only -Dworkflow=../ptolemy/src/ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml
works!

So, it looks like kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib
does not work on my Mac OS X 10.5.8

From the stacktrace above:
/Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Users/cxh/src/kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022

Searching the net for "unknown required load command 0x80000022"
results in some possible issues with CFLAGS.
I'm not sure how kepler/common/lib/ptolemy/matlab/libptmatlab.jnilib
is generated, but that would be the place to start.

Kepler-2.2rc3

Help > Kepler Documentation -> background information on Ptolemy
>Documentation -> Complete List of Demos -> SDF -> Matlab Expression.

I got basically the same stacktrace as above:

/Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: no suitable image found. Did find: /Applications/Kepler-2.2rc3/Kepler.app/Contents/Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib: unknown required load command 0x80000022

One issue is that there are to libptmatlab.jnilib files in Kepler-2.2rc3:
59005405 128 rw-r--r- 1 cxh admin 61472 Feb 28 21:12 ./Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib
59006098 120 rw-r--r- 1 cxh admin 58728 Feb 28 21:12 ./Resources/Java/ptolemy-8.1.0/lib/ptolemy-lib/libptmatlab.jnilib

If I do:

cp ~/ptII/ptolemy/matlab/libptmatlab.jnilib ./Resources/Java/common-2.2.0/lib/ptolemy/matlab/libptmatlab.jnilib

Then the MatlabExpression demo works under Kepler-2.2rc3.

Actions #9

Updated by jianwu jianwu almost 13 years ago

Christopher, I tried the libptmatlab.jnilib file you attached with Java 1.6 64 bit, Matlab R2010a 64 bit in Mac 10.6.7. The demo workflow works for me.

How did you get the file? in which environment? Dan and I made updates for the libptmatlab.jnilib file in current kepler 2.2 because Kepler always crash with old jnilib file in Mac 10.6. But I don't remember how we created the new file and whether we fired a bug and recorded our fixing for it.

Actions #10

Updated by Christopher Brooks almost 13 years ago

The attachment was built under Mac OS X 10.5.8 by running
cd $PTII/ptolemy/matlab
make clean
make

The commands were:
  1. Making 32 and 64 bit Universal Library libptmatlabUniversal.jnilib and then copying to libptmatlab.jnilib
    CLASSPATH="../.." "/usr/bin/javah" -jni -o ptmatlab.h ptolemy.matlab.Engine
    "/usr/bin/gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY -DPT_NO_MXGETNAME -DHAVE_MALLOC_SIZE \
    "-I/Applications/MATLAB_R2009b.app/extern/include" \
    "-I/System/Library/Frameworks/JavaVM.framework/Headers" \
    "-I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../include/darwin" \
    ptmatlab.cc -fno-exceptions -dynamiclib -o libptmatlab32.jnilib -L"/Applications/MATLAB_R2009b.app/bin/maci" -leng -lmx -lmex
    CLASSPATH="../.." "/usr/bin/javah" -jni -o ptmatlab.h ptolemy.matlab.Engine
    "/usr/bin/gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY -DPT_NO_MXGETNAME -DHAVE_MALLOC_SIZE -m64 \
    "-I/Applications/MATLAB_R2009b.app/extern/include" \
    "-I/System/Library/Frameworks/JavaVM.framework/Headers" \
    "-I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../include/darwin" \
    ptmatlab.cc -fno-exceptions -dynamiclib -o libptmatlab64.jnilib -L"/Applications/MATLAB_R2009b.app/bin/maci64" -leng -lmx -lmex;
  2. Creating libptmatlabUniversal.jnilib from libptmatlab32.jnilib libptmatlab64.jnilib
    lipo -create -arch i386 libptmatlab32.jnilib -arch x86_64 libptmatlab64.jnilib -o libptmatlabUniversal.jnilib
  3. The file command reports that libptmatlab.jnilib is:
    libptmatlab.jnilib: Mach-O universal binary with 2 architectures
    libptmatlab.jnilib (for architecture i386): Mach-O dynamically linked shared library i386
    libptmatlab.jnilib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64

Note that it was built with Matlab R2009b. There could be compatibility
issues between different versions of Matlab.

Also, I'm building with the 64-bit Java 1.6. Both 32-bit and 64-bit
versions of the library are generated, I have not tried the 32-bit version.

FWIW, it looks like Matlab is available for $115 for research use:
http://software.engineering.ucdavis.edu/

Actions #11

Updated by jianwu jianwu almost 13 years ago

I updated my DYLD_LIBRARY_PATH in ~/.MacOSX/environment.plist and run the workflow with Kepler.app and libptmatlab.jnilib attached by Christopher Brooks on Mac 10.6.7. It works for both java 1.6 32 bit and java 1.6 64 bit. So I think we can check Christopher's new lib in and close the bug.

Christopher, what do you think?

Actions #12

Updated by Christopher Brooks almost 13 years ago

Sure, I'm fine with shipping the dylib that is created as part of
the Ptolemy II build.

However, it would be good to know why the Kepler version of this
library is different from the ptII version.

If we don't know the difference, then future releases will have
the same problem.

Actions #13

Updated by jianwu jianwu almost 13 years ago

I've checked in Christopher's new lib and is closing the bug.

The reason why the Kepler version is different with PtII is probably Dan and I created the lib under Mac 10.6 and Christopher's is built under Mac 10.5.

Actions #14

Updated by jianwu jianwu almost 13 years ago

More info: my check in is at both Kepler 2.2 branch and Kepler trunk.

Actions #15

Updated by Redmine Admin about 11 years ago

Original Bugzilla ID was 5346

Actions

Also available in: Atom PDF