How to configure the mexopts.sh file in MAC 10.12.6 El Capitan
1 次查看(过去 30 天)
显示 更早的评论
I could not compile the c code in MATLAB 2012b on my MAC 10.12.6. When I implement the command: mex hello.c, it releases an error like:
gcc-5.3.0: command not found.
I had tried many ways to fix that problem but I failed. I have known that gcc (version 5.3.0) is existed on my MAC, but it seems to me that the MATLAB couldn't link to the gcc. I guess that the configuration in the mexopts.sh is wrong. Below is a part of the mexopts.sh file:
C='gcc-5.3.0'
SDKROOT='Applications/Xcode/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk'
MACOSX_DEPLOYMENT_TARGET='10.5'
ARCHS='x86_64'
CFLAGS="-fno-common -no-cpp-precomp -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
CFLAGS="$CFLAGS -fexceptions"
CLIBS="$MLIBS"
COPTIMFLAGS='-O2 -DNDEBUG'
CDEBUGFLAGS='-g'
#
CLIBS="$CLIBS -lstdc++"
# C++keyName: GNU C++
# C++keyManufacturer: GNU
# C++keyLanguage: C++
# C++keyVersion:
# C++keyLinkerName:
# C++keyLinkerVersion:
CXX=g++-5.3.0
CXXFLAGS="-fno-common -no-cpp-precomp -fexceptions -arch $ARCHS -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
CXXLIBS="$MLIBS -lstdc++"
CXXOPTIMFLAGS='-O2 -DNDEBUG'
CXXDEBUGFLAGS='-g'
Could anyone please let me know how to solve that problem. Thank you!
0 个评论
回答(1 个)
Walter Roberson
2016-12-22
Your gcc-5.3 is probably not on your path. If you are calling mex from within MATLAB then first set the PATH environment variable to include the directory that your gcc-5.3 is in. For example,
setenv('PATH', strcat(getenv('PATH'), ':/usr/local/bin'))
9 个评论
Walter Roberson
2017-1-13
Did you install XCode? If you did, then which version?
In mexopts.sh you can change
CC = gcc-5.3
to
CC = /usr/local/bin/gcc-5.3
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!