[kepler-dev] questions about matlab actor in 64 bit window 7.

Jianwu Wang jianwu at sdsc.edu
Wed Apr 28 10:21:39 PDT 2010


Hi Christopher,

    Really thank you for your always backup to Kepler.

    JNA looks better than JNI for the matlab interface. Yet we probably 
do not have to switch to JNA before Kepler 2.0.

    Dan and I found out the ptmatlab.cc works for both 32 bit and 64 bit 
Mac machine if we remove the '(int)' or change to '(long)' in the 
sentence 'char* output_buf2 = (char*)(int)p;'. It is probably because of 
the different ranges for 'int' in 32 bit and 64 bit Mac machine. 

    We are trying to tested the modified ptmatlab.cc in windows, which 
hit the problem I said before.

    For Kepler 2.0 release, I hope to update matlab libraries made by 
the new ptmatlab.cc. Yet more tests need to be done.

    I'll update the comments of Matlab demo workflow, explaining how to 
make it work with 64 bit machine. If libraries for 32 bit and 64 bit can 
not be released at the same time, we can put 64 bit libraries on a 
Kepler wiki webpage.

Christopher Brooks wrote:
> Hi Jianwu,
> No worries about bothering me while traveling, it just means
> that I have spotty connectivity.
>
> I'm discouraged by the problems with creating JNI shared libraries,
> it means that we have write once, recompile many times and test many
> times.  In another project, we are using JNA as an interface to OpenCV.
> Perhaps JNA would allow us to move away from compiling our own dlls.
>
> The Cygwin situation is making it increasingly difficult to do 
> development
> under Windows with gcc.  The Cygwin developers seem to be mostly under
> Linux and not actually use Cygwin for development under Windows.  
> (Otherwise,
> why would they insist on Unix line endings for the default mounts?)  
> Sigh.
>
> It looks like gcc is working for you.  I have some hacks into configure
> for checking to see if malloc_size() is present, but I need to test them.
> Realistically, at best it will be tomorrow before I can make headway 
> here.
>
> I think a good interface to Matlab is very important to Kepler and 
> appreciate
> the time you are putting into it.  I made some comments earlier about
> the Matlab demo in 2.0.  It would be nice if the instructions were 
> enhanced
> so that a non-developer could set up Kepler with Matlab.  This requires
> things like possibly updating DYLD_LIBRARY_PATH etc.
>
> _Christopher
>
> On 4/27/10 7:55 PM, Jianwu Wang wrote:
>> Hi Christopher,
>>
>> Sorry to bother you during your traveling. I fixed the the problem with
>> gcc, yet still can not get ptmatlab.dll. Dan and I will continue to work
>> on it. A quick solution is just to get a 'gcc' command just for my
>> machine to test whether the generated 64bit windows ptmatlab.dll works.
>>
>>
>> $ make
>> if [ "`uname -s`" = "Darwin" ]; then \
>> if [ -d "c:/Program Files/MATLAB/R2010a/bin/win32" -a -d "" ]; then \
>> echo "# Making 32 and 64 bit Universal Library ptmatlabUniversal.dll and
>> then copying to ptmatlab.dll"; \
>> make ptmatlabUniversal.dll; \
>> mv ptmatlabUniversal.dll ptmatlab.dll; \
>> else \
>> if [ -d "c:/Program Files/MATLAB/R2010a/bin/win32" ]; then \
>> echo "# Making ptmatlab32.dll and then copying to ptmatlab.dll"; \
>> make ptmatlab32.dll; \
>> mv ptmatlab32.dll ptmatlab.dll; \
>> else \
>> if [ -d "" ]; then \
>> echo "# Big bucks! Congrats!! making ptmatlab64.dll and copying to
>> ptmatlab.dll"; \
>> make ptmatlab64.dll; \
>> mv ptmatlab64.dll ptmatlab.dll; \
>> else \
>> echo "# MATLAB_LIBDIR 'c:/Program Files/MATLAB/R2010a/bin/win32' and/or
>> MATLAB_64LIBDIR '' don't exist, try rerunning configure."; \
>> exit 1; \
>> fi; \
>> fi; \
>> fi; \
>> echo "# The file command reports that ptmatlab.dll is: "; \
>> file ptmatlab.dll; \
>> else \
>> CLASSPATH="../.." "/cygdrive/c/Program Files/Java/jdk1.6.0_20/bin/javah"
>> -jni -o ptmatlab.h ptolemy.matlab.Engine; \
>> "/usr/bin/gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY 
>> -DPT_NO_MXGETNAME \
>> "-Ic:/Program Files/MATLAB/R2010a/extern/include" \
>> "-IC:/Program Files/Java/jdk1.6.0_20/jre/../include" \
>> "-IC:/Program Files/Java/jdk1.6.0_20/jre/../include/win32" \
>> -shared ptmatlab.cc -fno-exceptions -o ptmatlab.dll -L"c:/Program
>> Files/MATLAB/R2010a/bin/win32" -Wl,--add-stdcall-alias -lc -leng -lmx
>> -lmex; \
>> fi
>> /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:
>> cannot find -leng
>> /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:
>> cannot find -lmx
>> /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:
>> cannot find -lmex
>> collect2: ld returned 1 exit status
>> make: *** [ptmatlab.dll] Error 1
>>
>>
>>
>>
>> Best wishes
>>
>> Sincerely yours
>>
>> Jianwu Wang
>> jianwu at sdsc.edu
>> http://users.sdsc.edu/~jianwu/
>>
>> Scientific Workflow Automation Technologies (SWAT) Laboratory
>> San Diego Supercomputer Center
>> University of California, San Diego
>> San Diego, CA, U.S.A.
>>
>>
>> On 4/27/2010 6:04 PM, Christopher Brooks wrote:
>>> Hi Jianwu,
>>> Hmm, I don't have a Windows 64 platform on which to try Matlab.
>>>
>>> However, the problem below looks to be something to do with gcc?
>>> The message:
>>> > gcc: installation problem, cannot exec 'cc1plus': No such file or
>>> directory
>>> is suspect
>>>
>>> BTW - Cygwin under Windows is rather pathetic these days.
>>> - Christopher Faylor broke GNU make under Cygwin, see
>>> http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII7.0/limitations.htm
>>>
>>> - When I install Cygwin, the c: file system is mounted in such
>>> a way that shell scripts don't work, see
>>> https://lists.eecs.berkeley.edu/sympa/arc/ptolemy-hackers/2010-04/msg00017.html 
>>>
>>>
>>>
>>> In addition using JNI under Cygwin has been difficult. It has been best
>>> to invoke a C binary and then invoke Java, see $PTII/jni/launcher.
>>>
>>> That said, under Cygwin under Windows, I've found it easiest to work
>>> with the code
>>> in $PTII/jni and get those tests working first as the tests are simple.
>>>
>>> Another issue is that every version of Matlab might require a different
>>> share library. In addition, we have the 32bit vs 64bit issue. 
>>> Fortunately
>>> most platforms are moving towards 64 bit, so this will go away in the
>>> future.
>>> However, if we are to support Mac OS X, Windows and Linux, then we may
>>> need
>>> 32 bit and 64 bit versions for each platform (total 6). Also, there
>>> could be JDK
>>> version dependencies, so if we want to support JDK 1.5 and 1.6 then we
>>> could have
>>> 12 files. If we want to support the most recent version of Matlab and
>>> one version
>>> back, then that is 24 files, or at least as many 24 different tests
>>> that we
>>> should do.
>>>
>>> Sigh.
>>>
>>> I'm traveling this week and off the network on Wednesday.
>>>
>>>
>>> _Christopher
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 4/27/10 4:05 PM, Jianwu Wang wrote:
>>>> Hi Christopher,
>>>>
>>>> I just tried your new make in 64bit window7. It doesn't work. In 64 
>>>> bit
>>>> matlab, I only have directory C:\Program 
>>>> Files\MATLAB\R2010a\bin\win64,
>>>> no C:\Program Files\MATLAB\R2010a\bin\win32.
>>>>
>>>> In PATH, I have /cygdrive/c/Program
>>>> Files/MATLAB/R2010a/runtime/win64:/cygdrive/c/Program
>>>> Files/MATLAB/R2010a/bin:/cygdrive/c/Program
>>>> Files/MATLAB/R2010a/bin/win64.
>>>>
>>>> I think the makefile needs to be updated, right? Thanks.
>>>>
>>>> $ make
>>>> rm -f `basename Engine.java .java`.class
>>>> CLASSPATH="../.." "/cygdrive/c/Program 
>>>> Files/Java/jdk1.6.0_20/bin/javac"
>>>> -g -O Engine.java
>>>> if [ "`uname -s`" = "Darwin" ]; then \
>>>> if [ -d "c:/Program Files/MATLAB/R2010a/bin/win32" -a -d "" ]; then \
>>>> echo "# Making 32 and 64 bit Universal Library 
>>>> ptmatlabUniversal.dll and
>>>> then copying to ptmatlab.dll"; \
>>>> make ptmatlabUniversal.dll; \
>>>> mv ptmatlabUniversal.dll ptmatlab.dll; \
>>>> else \
>>>> if [ -d "c:/Program Files/MATLAB/R2010a/bin/win32" ]; then \
>>>> echo "# Making ptmatlab32.dll and then copying to ptmatlab.dll"; \
>>>> make ptmatlab32.dll; \
>>>> mv ptmatlab32.dll ptmatlab.dll; \
>>>> else \
>>>> if [ -d "" ]; then \
>>>> echo "# Big bucks! Congrats!! making ptmatlab64.dll and copying to
>>>> ptmatlab.dll"; \
>>>> make ptmatlab64.dll; \
>>>> mv ptmatlab64.dll ptmatlab.dll; \
>>>> else \
>>>> echo "# MATLAB_LIBDIR 'c:/Program Files/MATLAB/R2010a/bin/win32' 
>>>> and/or
>>>> MATLAB_64LIBDIR '' don't exist, try rerunning configure."; \
>>>> exit 1; \
>>>> fi; \
>>>> fi; \
>>>> fi; \
>>>> echo "# The file command reports that ptmatlab.dll is: "; \
>>>> file ptmatlab.dll; \
>>>> else \
>>>> CLASSPATH="../.." "/cygdrive/c/Program 
>>>> Files/Java/jdk1.6.0_20/bin/javah"
>>>> -jni -o ptmatlab.h ptolemy.matlab.Engine; \
>>>> "/usr/bin/gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY
>>>> -DPT_NO_MXGETNAME \
>>>> "-Ic:/Program Files/MATLAB/R2010a/extern/include" \
>>>> "-IC:/Program Files/Java/jdk1.6.0_20/jre/../include" \
>>>> "-IC:/Program Files/Java/jdk1.6.0_20/jre/../include/win32" \
>>>> -shared ptmatlab.cc -fno-exceptions -o ptmatlab.dll -L"c:/Program
>>>> Files/MATLAB/R2010a/bin/win32" -Wl,--add-stdcall-alias -lc -leng -lmx
>>>> -lmex; \
>>>> fi
>>>> gcc: installation problem, cannot exec 'cc1plus': No such file or
>>>> directory
>>>> make: *** [ptmatlab.dll] Error 1
>>>>
>>>> Best wishes
>>>>
>>>> Sincerely yours
>>>>
>>>> Jianwu Wang
>>>> jianwu at sdsc.edu
>>>> http://users.sdsc.edu/~jianwu/
>>>>
>>>> Scientific Workflow Automation Technologies (SWAT) Laboratory
>>>> San Diego Supercomputer Center
>>>> University of California, San Diego
>>>> San Diego, CA, U.S.A.
>>>>
>>>>
>>>> On 4/26/2010 4:42 PM, Christopher Brooks wrote:
>>>>> Hi Jianwu,
>>>>> I just updated $PTII/ptolemy/ptolemy/makefile so that it will build
>>>>> either
>>>>> * 32bit
>>>>> * 64bit
>>>>> * Universal (32bit and 64bit).
>>>>>
>>>>> If you have a chance, please update your tree and rerun "make".
>>>>>
>>>>> Thanks,
>>>>>
>>>>> _Christopher
>>>>>
>>>>> On 4/26/10 4:01 PM, Jianwu Wang wrote:
>>>>>> Hi Chistopher,
>>>>>>
>>>>>> My machine is snow leopard (10.6.3, 64 bit), matlab 2009b 64 bit, 
>>>>>> Java
>>>>>> 1.6 64 bit. I tried to use 'make' command in ptII/ptolemy/matlab
>>>>>> directory to generate libptmatlab file. But it has the following
>>>>>> error.
>>>>>> I think it is because my matlab installation do not have maci
>>>>>> directory,
>>>>>> only have maci64 directory. Do you think the problem is because 
>>>>>> of my
>>>>>> installation or make file? Thanks.
>>>>>>
>>>>>> echo $DYLD_LIBRARY_PATH
>>>>>> /Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/bin/maci64:/Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/sys/os/maci64 
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> kepler:matlab jianwu$ make
>>>>>> if [ "`uname -s`" = "Darwin" ]; then \
>>>>>> make libptmatlabUniversal.jnilib; \
>>>>>> mv libptmatlabUniversal.jnilib libptmatlab.jnilib; \
>>>>>> file libptmatlab.jnilib; \
>>>>>> else \
>>>>>> CLASSPATH="../.."
>>>>>> "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/javah" 
>>>>>>
>>>>>>
>>>>>>
>>>>>> -jni -o ptmatlab.h ptolemy.matlab.Engine; \
>>>>>> "/usr/bin/gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY
>>>>>> -DPT_NO_MXGETNAME \
>>>>>> "-I/Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/extern/include" 
>>>>>>
>>>>>>
>>>>>> \
>>>>>> "-I/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/../Headers" 
>>>>>>
>>>>>>
>>>>>>
>>>>>> \
>>>>>> "-I/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/../include/darwin" 
>>>>>>
>>>>>>
>>>>>>
>>>>>> \
>>>>>> ptmatlab.cc -fno-exceptions -dynamiclib -o libptmatlab32.jnilib
>>>>>> -L"/Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/bin/maci"
>>>>>> -leng -lmx -lmex; \
>>>>>> fi
>>>>>> CLASSPATH="../.."
>>>>>> "/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/javah" 
>>>>>>
>>>>>>
>>>>>>
>>>>>> -jni -o ptmatlab.h ptolemy.matlab.Engine
>>>>>> "/usr/bin/gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY
>>>>>> -DPT_NO_MXGETNAME \
>>>>>> "-I/Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/extern/include" 
>>>>>>
>>>>>>
>>>>>> \
>>>>>> "-I/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/../Headers" 
>>>>>>
>>>>>>
>>>>>>
>>>>>> \
>>>>>> "-I/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/../include/darwin" 
>>>>>>
>>>>>>
>>>>>>
>>>>>> \
>>>>>> ptmatlab.cc -fno-exceptions -dynamiclib -o libptmatlab32.jnilib
>>>>>> -L"/Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/bin/maci"
>>>>>> -leng -lmx -lmex
>>>>>> ld: warning: directory
>>>>>> '/Applications/MATLAB64/MATLAB_R2009b/MATLAB_R2009b.app/bin/maci'
>>>>>> following -L not found
>>>>>> ld: library not found for -leng
>>>>>> collect2: ld returned 1 exit status
>>>>>> make[1]: *** [libptmatlab32.jnilib] Error 1
>>>>>> mv: rename libptmatlabUniversal.jnilib to libptmatlab.jnilib: No 
>>>>>> such
>>>>>> file or directory
>>>>>> libptmatlab.jnilib: cannot open `libptmatlab.jnilib' (No such 
>>>>>> file or
>>>>>> directory)
>>>>>>
>>>>>
>>>
>


-- 

Best wishes

Sincerely yours

Jianwu Wang
wangjianwu at gmail.com

Post-Doctor
Scientific Workflow Automation Technologies (SWAT) Laboratory
San Diego Supercomputer Center 
University of California, San Diego
San Diego, U.S.A. 



More information about the Kepler-dev mailing list