Segmentation fault: 11 when calling Matlab Runtime on a Mac
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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:
import GenMagic
import matlab
TestNum = 5 #Value must be an integer
print("Matlab Initializing")
client = GenMagic.initialize()
print("Matlab Initialized")
print(TestNum)
print("Running Function")
[outArg1,outArg2] = client.GenMagic(TestNum,nargout=2)
print("Function finished")
print(outArg1)
Here is the GenMagic Matlab program (that was compiled into the GenMagic compiled code):
function [outputArg1,outputArg2] = GenMagic(inputArg1)
%GENMAGIC Summary of this function goes here
% Detailed explanation goes here
outputArg1 = magic(inputArg1);
outputArg2 = ind2rgb(outputArg1,colormap);
close('all')
imwrite(outputArg2,'Magic.png');
end
3 Commenti
Walter Roberson
il 27 Ago 2020
Segmentation fault: 11 is basically trying to access through a bad pointer.
Risposte (0)
Vedere anche
Categorie
Scopri di più su C Shared Library Integration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!