From: Oisin Counihan on
Hi,

I am trying to compile a Matlab function (hello.m) to a standalone executable. After wasting a ludicrous amount of time I have finally got the compiler to produce an executable (on Red Hat Linux using Matlab R2008a). Now however I doesn't run,

Trying to run it on the machine on which it was complied gives the error:
hello: error while loading shared libraries: libmwmclmcrrt.so: cannot open shared object file: No such file or directory.

I assume this is because I have not added the appropriate paths. Along with the executable the compiler generates a readme.txt which helpfully specifies that the following paths must be added to LD_LIBRARY_PATH:
<mcr_root>/version/runtime/glnx86:
<mcr_root>/version/sys/os/glnx86:
<mcr_root>/version/sys/java/jre/glnx86/jre1.6.0/lib/i386/native_threads:
<mcr_root>/version/sys/java/jre/glnx86/jre1.6.0/lib/i386/server:
<mcr_root>/version/sys/java/jre/glnx86/jre1.6.0/lib/i386:
setenv XAPPLRESDIR <mcr_root>/version/X11/app-defaults

however it gives no indication as to how I can determine the value of <mcr_root> for my machine. Anyone have any ideas how I can determine this for a given machine?

Thanks.

Ois?n.
From: Jeremy Shaver on
"Oisin Counihan" <oisin_nz(a)yahoo.co.uk> wrote in message <hc9rgf$cul$1(a)fred.mathworks.com>...
> Hi,
>
> I am trying to compile a Matlab function (hello.m) to a standalone executable. After wasting a ludicrous amount of time I have finally got the compiler to produce an executable (on Red Hat Linux using Matlab R2008a). Now however I doesn't run,
>
> Trying to run it on the machine on which it was complied gives the error:
> hello: error while loading shared libraries: libmwmclmcrrt.so: cannot open shared object file: No such file or directory.
>
> I assume this is because I have not added the appropriate paths. Along with the executable the compiler generates a readme.txt which helpfully specifies that the following paths must be added to LD_LIBRARY_PATH:
> <mcr_root>/version/runtime/glnx86:
> <mcr_root>/version/sys/os/glnx86:
> <mcr_root>/version/sys/java/jre/glnx86/jre1.6.0/lib/i386/native_threads:
> <mcr_root>/version/sys/java/jre/glnx86/jre1.6.0/lib/i386/server:
> <mcr_root>/version/sys/java/jre/glnx86/jre1.6.0/lib/i386:
> setenv XAPPLRESDIR <mcr_root>/version/X11/app-defaults
>
> however it gives no indication as to how I can determine the value of <mcr_root> for my machine. Anyone have any ideas how I can determine this for a given machine?
>
> Thanks.
>
> Ois?n.

I've been having trouble with a similar problem on a Mac. You need to have the MCR installed ahead of time. You can either require the user to install it at a predefined location or include it with your bundle. I've had luck with the latter where I add the mcr directory to my application then refer to it relatively when I add it to the path.

Scott