Could not access the MCR component cache - matlab

I want to use CGI and Apache web server to give users access to run my compiled Matlab application (an exe file). I followed the instructions at this guide.
But, I received an error in the web server logs as:
[error] [client 127.0.0.1] Could not access the MCR component cache., referer: .../standalone.html
I am using Matlab 2012a. Is there anyway to control the MCR cache for applications compiled using Matlab 2012a? There is no more CTF file with the compilations of this Matlab release.
Thanks.

I believe that in recent versions of MATLAB Compiler the CTF archive is embedded in the .exe by default, but that you can change that back, either by selecting an option from within the deploytool settings, or by using the -C parameter with mcc.
The CTF archive would normally expand automatically the first time you run the component, but if you need to manually expand it (I believe there are reasons you need to when calling it from CGI, although I've never done it myself) there's a utility called extractCTF.exe in matlabroot\toolbox\compiler\arch, where arch is your OS type, such as win32 etc.
See here and here for more information.
Hope that helps!

Related

Error running the rsim executable (Simulink Coder)

I have a simulink model (2016b with MC 2013 C/C++ and Mingw-64 compilers) that I'd like to generate a standalone executable for windows-64 bit.
I was able to run the grt executable but due to the fact that I need to read a mat file runtime as opposed to compile time, I am using rsim code generation for this purpose, however the executable that gets generated appears to need quite a bit of .dll, I provided the dll it was asking for however, the application still unable to run. This is the error that results
The application was unable to start correctly 0xc000007b. Click OK to
close the application
What am I missing ?
Your main program is compiled for x64 (64-bit) target, but the dll you provided is compiled for x86 (32-bit) target. Or vice versa.
If it is Mingw-64 stuff, you should be able to obtain all (or most) of them by using the official online installer. Link is here.

memory command is not available even after compiled with TCL_MEM_DEBUG flag

I have memory related problem in my application on solaris9 environment where Tcl_DeleteInterp() function calls lot of free() and mutex_unlock() functions. To debug the problem i followed the below steps to compile tcl on solaris server (with TCL_MEM_DEBUG flag) but still i couldn't use the 'memory' command in my interpreter.
Ran configure script on server (./configure –prefix=<directory needs to be installed> --enable-symbols=mem)
Make clean all
Make install (tcl libraries and tlcsh exe is copied to the path specified in step1)
Compilation generated two libraries (libtcl8.4g.so and libtclstub8.4g.a), I copied libtcl8.4g.so as libtcl8.4.so to my app
Copied tcl8.4 directory as well.
I also copied the tclsh8.4 to $PROVHOME/bin and created soft link as tclsh-> tclsh8.4.
From my application i linked the debug symbol enabled libraries to the place where exactly i created the Tcl interpreter.
Initialized the Tcl interpreter to using Tcl_InitMemory() function (so that the memory command will be registered in the supplied(arg) interpreter.
When i used the interpreter exe (tclsh) separately i could execute the memory command, but when i used the same exe on my application its not working. Can someone help me what could be the possible reason for this problem ?
Also help me how can i cross verify the libraries that they are compiled with TCL_MEM_DEBUG flag.
Will the Tcl source code tar file contain Solaris directory where i have to build the libraries or should i use the unix source code for solaris platform as well ?
Thanks
Are you using [mem] interactively (which does expansion of unambiguous short command names) and forgetting to use the full name ([memory]) in your scripts?
You're using Tcl embedded in your code? You need to call Tcl_InitMemory (passing in the handle to the interpreter where you want the memory command created) after creation of the interpreter and before you run user scripts, i.e., straight after the Tcl_CreateInterp gives you the handle (which should in turn come after the Tcl_FindExecutable call that initializes the shared parts of the library).
You must also make sure that everything is built with that flag set so that the correct memory allocation APIs are used in both your code when it integrates with Tcl, and you must make sure that you are linking against the debugging build. It's probably the linking that has gone wrong, but I've not done that level of development on Solaris for many years.
I think you'll find that “Getting a list of used libraries by a running process (unix)” is relevant to your problems.

IPPL with Matlab Compiler Runtime (MCR)

I'm trying to deploy an application from Matlab to JAVA.
I use Matlab Builder JA and the Image Processing Toolbox.
I create my jar file from Matlab R2012a with the deploytool on MacOSX.
When I run my JAVA program using this jar on my mac, it's OK, but when I try to run it on a Linux or Windows system, I get the error:
Undefined function or variable 'ipplmex'.
Error in ==> ippl at 48
Error in ==> imrotate>useIPP at 205
Deactivating the use of IPPL with iptsetpref('UseIPPL', false) doesn't fix my problem.
I also have done the exact same work on a Linux environment with Matlab R2011a, and it works on Linux but not on a MacOSX machine with the same error.
If anyone has an idea concerning this IPPL thing when changing OS, that would be great.
Thanks !
Java components created with Builder JA are only cross-platform if they don't depend on platform-specific libraries, such as MEX-files you create, or the IPPL libraries supplied with Image Processing Toolbox.
If you want your Java component to make use of IPPL, I think you'll need to create the Java component once on Mac, once on Linux, once on Windows, and use the version created on the appropriate platform.
ipplmex is a (platform-specific) MEX file that is called by ippl, which is a utility function that checks whether IPPL is available. I can't check this at the moment, but I think it makes that availability check whether or not you've specified that you want to actually use IPPL, via the iptsetpref command. Therefore whether or not you specify that IPPL should be used, there's still a platform-specific MEX-file being called.
Again, I can't check this at the moment, but if you're comfortable with your component not using IPPL, you might try to modify the ippl command to just return zero (indicating that IPPL is not available) without attempting to execute ipplmex. (Make sure to take a copy of your existing ippl.m file before you try any modifications).

Running Matlab MCR and MATLAB on the Same Machine

I'm having trouble getting a compiled .exe file to run with MCR instead of Matlab (I can tell because the program is using multiple threads, which it would not do if it were running with MCR). The MATLAB documentation (http://www.mathworks.com/help/toolbox/compiler/f12-999353.html) says:
"To run deployed components against the MCR install, mcr_root\ver\runtime\win32|win64 must appear on your system path before matlabroot\runtime\win32|win64.
If mcr_root\ver\runtime\arch appears first on the compiled application path, the application uses the files in the MCR install area.
If matlabroot\runtime\arch appears first on the compiled application path, the application uses the files in the MATLAB Compiler installation area."
Can anyone connect the dots a bit more for me? I don't know what this means. Thanks!
I had the same problem: my compiled code was multithreaded, which I did not want.
The problem got solved by compiling with the option:
-R -singleCompThread
You need to set properly the PATH global environment variable in Windows. How you do it exactly depends on Windows version.
Here is the first link from Google by query "set path on Windows": http://www.computerhope.com/issues/ch000549.htm
This variable is a list of directories. Make sure you have a directory with MCR executable earlier in this list than a directory with MATLAB executable.

Runtime error for MCC compiled program using parfor

I have problems running a program compiled with MCC that uses parfor. The non-compiled .m version works (no bug). When I run the compiled version, I get
"distcomp.remoteparfor" is undefined. I believe I exactly have the error described in
the following link.
http://www.mathworks.com/support/solutions/en/data/1-PAHWE/index.html?product=CO&solution=1-PAHWE
However, since MCR is not installed on my machine (got Matlab and MCC),
I am wondering what the pathes $APPNAME_mcr/java/jar/toolbox and
$MCR/MATLAB Component Runtime/v70/java/jar/toolbox correspond to. I found
the distcomp.jar file in C:\Program Files\MATLAB\R2011b\java\jar\toolbox, but I don't know where to put it since see any path corresponding to $MCR/MATLAB Component Runtime/v70/java/jar/toolbox since MCR is not installed.
Thanks a lot!
Fred
No need to install the MCR if you are simply trying to run the application on the same machine that has MATLAB. The question to ask is, HOW are you launching the compiled application? From a DOS command window? From within MATLAB using the SYSTEM command?
If you are launching the application from a DOS / UNIX command line, then the important thing to keep in mind is that the MATLAB binaries need to be on your system path i.e. just make sure:
$MATLABROOT\bin\$ARCH
is on your system path. Where $MATLABROOT is the matlab installation folder, and $ARCH is your system architecture. For example:
c:\work\matlab\bin\win64
on my machine since my installation folder which contains MATLAB is:
c:\work
and i am on a win64 machine.
The problem is solved. The solution is to make the program
a function instead of a script :
http://www.mathworks.com/matlabcentral/answers/22825-parfor-errors-when-file-is-compiled