필터 지우기
필터 지우기

Segmentation fault: 11 when calling Matlab Runtime on a Mac

조회 수: 5 (최근 30일)
Timothy Plummer
Timothy Plummer 2019년 6월 20일
댓글: Walter Roberson 2020년 8월 27일
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
MatlabUser
MatlabUser 2020년 8월 27일
I have same issue too.
Segmentation fault: 11
Walter Roberson
Walter Roberson 2020년 8월 27일
Segmentation fault: 11 is basically trying to access through a bad pointer.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by