Hi! Can I do a stand alone executable if my program is targeted for plotting? I am getting the following error:

조회 수: 1 (최근 30일)
Hi! Can I do a stand alone executable if my program is targeted for plotting? I am getting the following error:
-> gcc-4.0 -c -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Applications/MATLAB_R2010a.app/extern/include -DUNIX -DX11 -O2 -DNDEBUG "test_main.c"
/Applications/MATLAB_R2010a.app/bin/mbuild: line 1885: gcc-4.0: command not found
mbuild: compile of ' "test_main.c"' failed.
Error: An error occurred while shelling out to mbuild (error code = 1). Unable to build executable. ??? Error using ==> mcc Error executing mcc, return status = 1 (0x1).
Do you know how to solve this? or what is going on? I can imagine is a cpp compiler error since the command not found targets gcc-4.0

채택된 답변

Roberto Maldonado
Roberto Maldonado 2014년 7월 14일
Okay I could solve the problem! Let me explain it in the following lines:
  1. Find location of Matlab App
  2. Access contents of package
  3. Locate the mbuildopts.sh inside bin folder
  4. Open with text editor
  5. Identify tags that target the compiler (CC:) as gcc-4.0 and change it to just gcc
  6. Identify tags that target the SDK and the version of it
  7. Get the absolute path to target of XCode's SDK and change it for the older one (there are two places to do this) also be sure to change the version of the target (in my case to 10.8)
  8. Some of the code is around line 200 and should look like this after changed :
CC='gcc'
SDKROOT='/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk'
MACOSX_DEPLOYMENT_TARGET='10.8'
  1. Now save changes on the .sh file
You have successfully changed the targeted SDK! and now can call the command gcc (not more gcc-4.0 any more) without targeting any older version of XCode Command Line Tools that is hard to find and long to download. I hope this might be helpul for future Mac users and for those who get similar errors on the mbuild command.
Thanks for the help and enjoy!

추가 답변 (2개)

Titus Edelhofer
Titus Edelhofer 2014년 7월 11일
Hi,
did you do a
mbuild -setup
before? Did MATLAB find your gcc 4.0?
Titus

Sruthi Ayloo
Sruthi Ayloo 2014년 7월 11일
편집: Sruthi Ayloo 2014년 7월 11일
What is the version of xcode and MAC OS you are using?
The following link might be helpful where a similar issue has been discussed:

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by