In MATLAB, we have created a simple function to generate a magic square (similar to the basic tutorial) and produce an image. We created a Python package using MATLAB Compiler SDK. When we install MATLAB Runtime and run the package on a Mac, we consistently get a "Segmentation fault: 11" error.
Here is what we've tried:
1. Verified that it runs with MATLAB Runtime on a PC that did not have the full version of MATLAB installed.
2. Set the DYLD_LIBRARY_PATH environment variable using the path given in the MATLAB Runtime installation instructions. This was set in the .bash_profile and the path was verified by echoing out DYLD_LIBRARY_PATH on the command line.
3. Ran the python package both inside a conda virtual environment and outside of one.
4. Ran it with Python 3.5, 3.6, and 3.7. (The first two only in a virtual environment.)
5. In the .bash_profile, added the path /Library/Frameworks/Python.framework/Versions/3.7/lib to the DYLD_LIBRARY_PATH (based on a suggestion found online for this error).
6. Ran it with MATLAB Runtime R2019a and R2018b. Initially the packages was created with MATLAB 2019a, and that version of the Runtime was installed on the Mac. Then we created the package using MATLAB 2018b, added that version of the Runtime to the Mac, and tried running it. We did not deleted the R2019a runtime.
7. Checked CPU usage using both the Mac's Activity Monitor app and the top command in the terminal, but the CPU usage never went over 7%.
Here is the testing.py function we're calling with python:
TestNum = 5 #Value must be an integer
client = GenMagic.initialize()
[outArg1,outArg2] = client.GenMagic(TestNum,nargout=2)
Here is the GenMagic Matlab program (that was compiled into the GenMagic compiled code):
function [outputArg1,outputArg2] = GenMagic(inputArg1)
outputArg1 = magic(inputArg1);
outputArg2 = ind2rgb(outputArg1,colormap);