Instructions to build Matlab JNI libraries in Kepler for Matlab actor
To run Matlab actor in Kepler, the Matlab JNI library sometimes needs to be rebuilt. This page explains how to create the Matlab libraries for users own environments.
Matlab JNI libraries are needed to run Matlab actor in Kepler. The matlab libraries in Kepler release may not work in Kepler under a certain combination of Java, Operating System and Matlab. If not, please try the following steps to build the library for your own environment.
For 64 bit windows, the first solution you can try is renaming $Kepler\common\lib\ptolemy\matlab\ptmatlab64.dll to ptmatlab.dll, and restart Kepler to see whether it works. For 64 bit Linux, please try renaming $Kepler\common\lib\libptmatlab64.so to libptmatlab.so, and restart Kepler to see whether it works.
Below are instructions for building the Matlab shared library. To use the Matlab interface, see Setting up Mac OS X to use the Matlab Interface.
Installing 32bit Mingw for 32bit Windows
The default gcc compiler shipped with Cygwin will produce .dll files that do not work properly. The solution is to install Mingw.
 Install Cygwin either from http://www.cygwin.com or from the Ptolemy distribution.
 Start Cygwin bash, create c:\mingw

mkdir c:/mingw cd c:/mingw
 Copy the mingwdl.sh script from http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite and paste it into an editor and create c:/mingw/mingwdl.sh
 Execute mingwdl.sh, which will download the binaries into c:/mingwdl.
bash mingwdl.sh
 Unzip the .tar.gz files
gunzip *.gz
 Uncompress the .tar.lzma files:
lzma d *.lzma
 untar the .tar files. Create a script called mingwuntar.sh:
#!/bin/sh tars=`ls *.tar` for tar in $tars do echo $tar tar xf $tar done
 Run mingwuntar.sh
bash mingwuntar.sh
 Add c:\mingw\bin to your Windows path Based on the Mingw instructions:
 Rightclick on "My Computer" and select "Properties".
 Click Advanced  Environment Variables.
 In the box entitled "System Variables" scroll down to the line that says "PATH" and doubleclick the entry.
 You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the PATH variable. It is very important that you do not delete the existing values in the PATH string, this will cause all sorts of problems for you!
 Scroll to the end of the string and at the end add ";C:\mingw\bin". Don't forget the semicolon; this separates the entries in the PATH.
 press OK  OK  OK and you are done.
Instructions to build Matlab libraries in Kepler EXCEPT for 64 bit Windows
 Add the Matlab shared libraries to your the library path. $MATLAB should be the location of your Matlab installation. For example, if /usr/bin/matlab is a link:
bash3.2$ which matlab /usr/bin/matlab bash3.2$ ls l /usr/bin/matlab lrwxrxrx 1 root wheel 42 Jan 15 20:57 /usr/bin/matlab > /Applications/MATLAB_R2009b.app/bin/matlab bash3.2$
Then $MATLAB would be /Applications/MATLAB_R2009b.app 32 Bit Mac (10.5?)
 export DYLD_LIBRARY_PATH=$MATLAB/bin/maci
 64 Bit Mac (10.6?)
 export DYLD_LIBRARY_PATH=$MATLAB/bin/maci64
 32 Bit Linux
 export LD_LIBRARY_PATH=$MATLAB/bin/gnlx86
 64 Bit Linux
 export LD_LIBRARY_PATH=$MATLAB/bin/glnxa64
 Windows
 Be sure that the matlab binary is in your path
 Add the matlab binary to your PATH
 Set PTII
export PTII=$Kepler/ptolemy/src
 Run configure
cd $PTII ./configure
 Run make in $PTII/ptolemy/matlab
cd $PTII/ptolemy/matlab make clean make
 Copy the generated library into the Kepler common library directory:
 32 Bit Mac (10.5?)
 copy libptmatlab.jnilib into $Kepler/common/lib/ptolemy/matlab/
 64 Bit Mac (10.6?)
 copy libptmatlab.jnilib into $Kepler/common/lib64/ptolemy/matlab/
 32 Bit Linux
 copy libptmatlab.so into $Kepler/common/lib/
 64 Bit Linux
 copy libptmatlab.so into $Kepler/common/lib64/
 32 Bit Windows
 copy ptmatlab.dll into $Kepler/common/lib/ptolemy/matlab/
 Be sure that the matlab binary is in your path
 Restart Kepler
A demo matlab workflow is at $DEMODIR/Matlab/MatlabExpression.xml
Instructions to build Matlab libraries in Kepler for 64 bit Windows
 Download and install 64 bit Mingw: See http://sourceforge.net/projects/mingww64/
 Add installed mingww64 into your Windows path:
 Rightclick on "My Computer" and select "Properties".
 Click Advanced  Environment Variables.
 In the box entitled "System Variables" scroll down to the line that says "PATH" and doubleclick the entry.
 You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the PATH variable. It is very important that you do not delete the existing values in the PATH string, this will cause all sorts of problems for you!
 Scroll to the start of the string and at the beginning add the bin path of your installed mingww64, such as "D:\tools\MinGW64bit\mingw64\bin;". The reason to put it at the beginning is because we need make sure the gcc command in mingw, instead of the gcc in cgywin, will be used. Don't forget the semicolon; this separates the entries in the PATH.
 press OK  OK  OK and you are done.
 Go through step 15 in the section 'Instructions to build Matlab libraries in Kepler except 64 bit Windows'. The last step will have error since we haven't build make instructions for 64 bit windows
 Start a cmd console (not in Cygwin!). Run gcc compile command.
cd %PTII%\ptolemy\matlab gcc DPT_NO_ENGGETARRAY DPT_NO_ENGPUTARRAY DPT_NO_MXGETNAME "I%MATLAB%/extern/include" "I%JAVA_HOME%/include" "I%JAVA_HOME%/include/win32" shared ptmatlab.cc fnoexceptions o ptmatlab.dll "L%MATLAB%/bin/win64" Wl,addstdcallalias leng lmx lmex
 Copy generated ptmatlab.dll into $Kepler/common/lib64/ptolemy/matlab directory.
 Restart Kepler