필터 지우기
필터 지우기

Setup MEX compiler for R2014a for Linux

조회 수: 11 (최근 30일)
Nathan
Nathan 2014년 6월 23일
댓글: Jay Stanley 2018년 3월 16일
Ubuntu 14.04 comes with GCC 4.8. Matlab 2014a only supports up to GCC 4.7. When I use 2013a I can set the mexopts.sh script to use GCC-4.7 by doing the following
1) In matlab, type mex -setup and press 1 to copy mexopts.sh to ~/.matlab/R2013b/mexopts.sh
2) From the terminal, edit the file ~/.matlab/R2013b/mexopts.sh so that CC=’gcc’ change to –> CC=’gcc-4.7′ CCX=’g++’ change to –> CCX=’g++-4.7′
In 2014a the mexopts.sh file does not exist anymore. When I type mex -setup I get the following error:
>> mex -setup C++
Error using mex
No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2014a/glnxa64.
I know GCC 4.7 is installed because it works for R2013b but how do I set compiler in 2014a?
  댓글 수: 1
Awais Ashfaq
Awais Ashfaq 2016년 2월 22일
Hi, I have a similar problem. Where should I copy the mexopts.sh? I can't find any folder MATLABversion? Cheers

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

채택된 답변

Mukul Rao
Mukul Rao 2014년 7월 14일
Hi,
Beginning version R2014a, MATLAB automatically configures the mex pseudo compiler to use a supported compiler (such as gcc 4.7x ) on your machine. This leaves the use of the command “mex –setup” redundant unless you would like to use a supported compiler that is different from the default selection, or force MATLAB to use an unsupported compiler.
Did you try mexing a simple mex file like “timestwo.c” to check if the “mex file_name.x” command works on R2014a?
>> copyfile(fullfile(matlabroot,'extern','examples','refbook',...
'timestwo.c'), '.', 'f');
>> mex timestwo.c
Make sure you have write permission in your current working directory
  댓글 수: 6
Awais Ashfaq
Awais Ashfaq 2016년 2월 22일
Hi, I have a similar problem. Where should I copy the mexopts.sh? I can't find any folder MATLABversion? Cheers
wided hechkel
wided hechkel 2017년 2월 11일
Hello,
Should i delete the mexopts.sh from MatlabRoot"/bin/mexopts.sh after changing and copying it to ~/.matlab/"MatlabVersion" ?

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

추가 답변 (3개)

JIAWEI WU
JIAWEI WU 2015년 1월 26일
Thanks Sergey, I copied the file mexopts.h as you said, it works here. it cost me one night to fix it, until now, finally, it has been solved. you are so great!

Dave
Dave 2017년 4월 14일
편집: Dave 2017년 4월 16일
My solution for R2017a on Ubuntu 16.04.
First install the version of GCC Matlab expects:
sudo apt-get install gcc-4.9
Then edit the configuration file to point to this:
cd ~/.matlab/R2017a
sudo chmod 777 mex_C_glnxa64.xml
gedit mex_C_glnxa64.xml
Within that xml file, replace:
Location="$gcc"
with
Location="/usr/bin/gcc-4.9"
Save file and Matlab should no longer produce wrong version warnings.
  댓글 수: 1
Jay Stanley
Jay Stanley 2018년 3월 16일
This solution works on R2017b / Ubuntu 17.10

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


wided hechkel
wided hechkel 2017년 2월 11일
Hello,
Should i delete the mexopts.sh from MatlabRoot"/bin/mexopts.sh after changing and copying it to ~/.matlab/"MatlabVersion" ?
  댓글 수: 1
jie Chang
jie Chang 2017년 3월 12일
Hello,could you tell me where the direction ~/.matlab/“MatlabVersion”is? thank you.

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

카테고리

Help CenterFile Exchange에서 Troubleshooting in MATLAB Compiler SDK에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by