How can I resolve this mcc runtime error "cannot open shared object library"?

77 次查看(过去 30 天)
What am I doing wrong? I created a standalone executable using mcc. At runtime, I get "error while loading shared libraries: libmwlaunchermain.so: cannot open shared object file: No such file or directory."

回答(5 个)

Arnab Sen
Arnab Sen 2016-2-26
Hi Clay, Assuming you are using linux machine, there can be several reasons behind this issue, the primary reason being the incorrect installation of MCR or an incorrect specification of the path to execute the .sh file. In this case, an incorrect path specification was the source of the problem.
Here are some general troubleshooting steps for resolving this issue on Linux:
A. Install a Linux version of the MCR for 2013a from
1. Please ensure that you download a version that matches the bitness of your machine. 2. Extract the files and navigate to the corresponding folder; install MCR by typing “./install” on the command prompt. 3. Make sure you have sufficient privileges to run the setup. Please make note of the directory to which the MCR files are being installed to. 4. If the installation is successful for 2013a, you will see a “v81” folder created in this installation directory.
B. Run the executable with the right path specified.
You can run executable in two ways: . /executable.sh mcr_installation_dir/v81
Or,
./executable.sh $LD_LIBRARY_PATH
Where the environment variable LD_LIBRARY_PATH can be set using the following command:
setenv LD_LIBRARY_PATH mcr_installation_dir /v81/runtime/glnxa64: mcr_installation_dir /v81/bin/glnxa64: mcr_installation_dir /v81/sys/os/glnxa64:
If the above suggestions do not help, then try the following steps: 1. Check if you have a “startup.m” file that is being automatically included in your standalone application. In that case, enclose the commands within “startup.m” under a conditional statement:
If (isdeployed) ; else …original statements go here… end
2. Sometimes the mcrCache is corrupted. Set the "MCR_CACHE_ROOT" environment variable to a directory that you have read and write permissions to.
3.Sometime such error arises if the environment is not setup in UNIX systems. To resolve this issue, set the library path in Linux properly according to the below documentation:

martin claverie
martin claverie 2017-5-29
Hi
I know it is a old post, but I wanted to share how I solved the problem. I got exactly the same issue when I run my compiled code through crontab. Running directly the compiled code on the command line worked good.
the script has been compiled using the deploytool UI. I always use deploytool to compile a code for the first time. Then if I modified the *.m, I use the mcc matlab command line on the packinglog file to re-compile.
So I did that recompiling the code with mcc... and it works ;-) . With deploytool I get the bug, with mcc I don't have it.. No idea why... Cheers
Martin

Kevin Ahi
Kevin Ahi 2018-2-26
what is executable.sh? should I change "executable" with the name of my compiled file?

Elizabeth Jolly
Elizabeth Jolly 2022-2-24
Another reason for this can be due to your disk being full.

Thanh
Thanh 2023-8-30
If Matab executable is submitted to bsub, it could be LD_LIBRARY_PATH and other environment variables are not prograted to bsub job session.

类别

Help CenterFile Exchange 中查找有关 Standalone Applications 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by