필터 지우기
필터 지우기

Unable to generate Mex function in OS X 10.9.5 and Xcode 6.2

조회 수: 1 (최근 30일)
MRC
MRC 2015년 9월 16일
답변: Walter Roberson 2015년 9월 16일
I'm using Matlab Coder in Matlab-r2014b in OS X 10.9.5. I have Xcode 6.2. I'm unable to generate a Mex function using Matlab compiler. I'm reporting here a sample code with structure and type of variables similar to my real one.
1) The script that calls the entry-point
clear all
N=3 ;
Res=alg(N);
2) The entry-point
function val=alg(N)
%#codegen
coder.inline('never')
coder.varsize('matrixfinal');
matrixfinal=zeros(1,3*N+2);
profindex=randi(N+1,2^(N-1),1);
for s=1:10
coder.varsize('matrix');
matrix=zeros(1,3*N+2);
for k=1:2^(N-1)
if profindex(k)==N-1
matrix=[(matrix); randi(1,1,3*N+2)];
end
end
if size(matrix,1)>1
matrix(1,:)=[];
end
for k=1:size(matrix,1)
for h=1:size(matrixfinal,1)
if sum(matrix(k,2+2*N:3*N)==matrixfinal(h,2+2*N:3*N))==N-1
matrixfinal(h,3*N+1)=matrixfinal(h,3*N+1)+matrix(k,3*N+1);
matrixfinal(h,3*N+2)=matrixfinal(h,3*N+2)+matrix(k,3*N+2);
end
end
end
end
if size(matrixfinal,1)>1
matrixfinal(1,:)=[];
end
val=matrixfinal(1,1);
end
When I try to built the Mex Function I get the following error
??? Build error: Compilation returned error status code 2. See the target build log in the report for further details.
Error in ==> alg Line: 1 Column: 1
Code generation failed: Open error report.
If I open error report, I read
1 xcrun -sdk macosx10.7 clang -c -fno-common -arch x86_64 -isysroot -mmacosx-version-min=10.7 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG -I "....
2 xcodebuild: error: SDK "macosx10.7" cannot be located.
3 xcrun: error: unable to find utility "clang", not a developer tool or in PATH
4 gmake: *** [alg_mexutil.o] Error 72
How can I solve this problem? If instead I generate C/C++ Static Library it works. I found these instructions http://www.mathworks.com/matlabcentral/answers/103904-can-i-use-xcode-5-as-my-c-or-c-compiler-in-matlab-8-1-r2013a-or-matlab-8-2-r2013b but they are for 10.8
Thanks for your help

채택된 답변

Walter Roberson
Walter Roberson 2015년 9월 16일
Follow the instructions at that link but edit the 10.7 references to become 10.9 instead of 10.8

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by