Incompatible gcc version with mex

조회 수: 66 (최근 30일)
Andréas Sundström
Andréas Sundström 2018년 6월 26일
댓글: Mohamad Qadri 2020년 9월 16일
I run Ubuntu 18.04. When I try to compile files with mex, I get the error message saying that mex requires version 6.3.x of gcc, whereas the default gcc version on 18.04 is 7.3.
So far so good, I try to get my hands on an older version of gcc, but all i can find through the supported repositories is gcc version 6.4. The only way I seem to be able to get specifically version 6.3 is by manually compiling and installing gcc, but frankly, I do not want to go down that rabbit hole.
I have seen your answer regarding why you don't always support the latest gcc version, but can you please at least offer support for the latest version of gcc 6 (i.e. 6.4.x)?
  댓글 수: 1
David Young
David Young 2018년 8월 22일
It would be very helpful to have some advice on what to do about this. I also don't want to have to compile gcc from sources, but I now have a system with gcc 5.4 and gcc 6.4 both installed, and I can't guess which I should try to use to compile mex files.
It's really very puzzling that the compiler needed for MATLAB isn't actually supported.

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

답변 (11개)

Maria Geffen
Maria Geffen 2018년 9월 26일
I have the same issue with 2018b... sure enough, it also only supports gcc-6.3.x... this is absolutely maddening.

Victor
Victor 2019년 4월 8일
Can you share how to compile mex files with gcc 8.2.0? Thanks
  댓글 수: 1
Michal
Michal 2019년 4월 8일
I am afraid that there is no simple way how to reliably compile mex files on Ubuntu 18.10 with gcc 8.2.0 ... :(
This is terrible situation, because Ubuntu 18.10 is officially supported OS (see here and here ), but the only officially recomended way is via additional installation of gcc 6.3 (???!!!), which is on Ubuntu 18.10 very complicated or nearly impossible task, because only version gcc-6.4 is available in official Ubuntu repos (see here).
This is the main reason why I switch from Ubuntu to Debian 9 (stable) based distros (MX Linux 18, in my case).

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


Ladislav Dobrovsky
Ladislav Dobrovsky 2020년 5월 29일
편집: Ladislav Dobrovsky 2020년 7월 3일
EDIT, debian package: I have made a .deb package wich installs gcc-6.3 and does not destroy the main gcc installation: https://drive.google.com/file/d/1VYb08z7BQH6LQDimcob_jsDHFjjNO8dY/view?usp=sharing
------------------------------------------
I have compiled GCC 6.3 inside Virtualbox VM in Ubuntu 16 as gcc-6.3; then copied it back to my linux mint 19.3 (ubuntu 18) and did "make install" and also copied a shared object of a library that was in different version.
It works even with nvcc for cuda.
  댓글 수: 4
Michal
Michal 2020년 6월 2일
편집: Michal 2020년 6월 2일
@Ladislav Dobrovsky Python integration with MATLAB looks interesting, but ...
1. well coded MEX file is still excellent way how to significantly speed up the standard MATLAB.
2. Python + MATLAB is still more about info Googling than about real programming
And moreover, regarding support of older (and latest) RHEL: see https://access.redhat.com/solutions/19458, there is none standard package for gcc-6.3 , too ??!! Same situation on Debian, Ubuntu, etc. This is a mysterious compatibility reason from the TMW, that only one "recommanded" compiler is not available even for RHEL or other officially supporeted Linux distros. So, what ... ???
Ladislav Dobrovsky
Ladislav Dobrovsky 2020년 6월 30일
I have made a .deb package wich installs gcc-6.3 and does not destroy the main gcc installation:
https://drive.google.com/file/d/1VYb08z7BQH6LQDimcob_jsDHFjjNO8dY/view?usp=sharing

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


Robert
Robert 2018년 6월 26일
편집: Robert 2018년 6월 26일
I agree, Mathworks should have updated 2018a , at the very least, to gcc-6.4 at time of its release, which is was a bug fix to gcc-6.3, the only way to get 6.3 now is to a) compile it yourself, or b) use an old archive repository or .deb file. I have not tried the prerelease 2018b, I wonder what gcc version it supports?

Michal
Michal 2018년 7월 1일
Frankly speaking I do not understand why TMW choose the "compatible" compiler version on Linux so terribly. On many distributions officially supported by Matlab is very difficult to install "compatible" gcc version.
On the other hand, in most cases the incompatibility mex warning message has no impact on functionality.
  댓글 수: 1
Andréas Sundström
Andréas Sundström 2018년 7월 2일
To be more specific, I'm trying to build and install the Matlab wrapper for Adios. There, I get nothing out except this incompatibility warning and an error.

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


Patrick Amy
Patrick Amy 2018년 10월 2일
I actually built and installed gcc-6.3 from source after much effort, but I get an error that mex can't find gcc-6.3 for C++ compiling, only for C compiling. So when I run:
>> mex -setup C++ Error using mex No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.
However, when I run
> mex -setup -v Verbose mode is on. ... Looking for compiler 'gcc' ... ... Executing command 'which gcc' ...Yes ('/usr/bin/gcc'). ... Executing command 'gcc -print-file-name=libstdc++.so' ...Yes ('/usr/lib64/libstdc++.so'). Found installed compiler 'gcc'. ... Looking for compiler 'gcc' ... ... Executing command 'which gcc' ...Yes ('/usr/bin/gcc'). ... Executing command 'gcc -print-file-name=libstdc++.so' ...Yes ('/usr/lib64/libstdc++.so'). Found installed compiler 'gcc'. MEX configured to use 'gcc' for C language compilation.
I know my computer is using gcc-6.3 because when I check the version in the terminal I get
gcc (GCC) 6.3.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Could Matlab just not know where to look for the compiler? I already add the /bin file with gcc in it to the path and set the environment variables and what not.
  댓글 수: 2
Darun Barazanchy
Darun Barazanchy 2019년 8월 6일
Can you post you gcc version somewhere? I am trying to built gcc 6.3, but I get error after error! It is extremely disappointing that MATLAB can't support a more recent version of gcc!!! Terrible
Ladislav Dobrovsky
Ladislav Dobrovsky 2020년 6월 3일
the setup is not good, you can set which GCC to use for the actual compilation call:
mex GCC='/usr/local/bin/gcc-6.3' arrayProduct.cpp

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


Alexander Kristensen
Alexander Kristensen 2019년 3월 12일
편집: Alexander Kristensen 2019년 3월 12일
I have a similar issue.
Compiling mex files works fine with current gcc compiler (gcc 8.2.0 on Ubuntu 18.10, MATLAB 2018b) but throws a warning message.
However if I try and use mexcuda it throws an error of incompatibility.
"Error using mex.
no supported compiler was found. For options. visit https://www.mathworks.com/support/compilers ..."
But installing the gcc 6.3.x is quite tedious, especially for someone with no experience in that area.
I hope for more assistance for Linux users.

Adam Hyler
Adam Hyler 2019년 9월 23일
  댓글 수: 3
Xingang Li
Xingang Li 2020년 4월 9일
This also worked for me and the repository is still available.
Ladislav Dobrovsky
Ladislav Dobrovsky 2020년 5월 29일

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


Po-Hsuan Huang
Po-Hsuan Huang 2020년 3월 3일
I just wrote Matlab a service request. Hopefully they will respond to this thread. Have anyone tried to contact Matlab ? Did they reply ?
I will update if I hear back from them.
  댓글 수: 1
Michal
Michal 2020년 3월 3일
Yes, I tried to contact matlab by service request ... No solution!!!
Just proposal to install supported version of compiler, which is nearly (or completely) impossible from official Ubuntu repositories.

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


BRSC User
BRSC User 2020년 4월 6일
I also get tons of error when attempt to use locally developed C++/C based source code with matlab with mex / mexFunction. Look forward for any update form Mathworks OR other netizens for success.
  댓글 수: 5
Ladislav Dobrovsky
Ladislav Dobrovsky 2020년 6월 30일
I have made a .deb package wich installs gcc-6.3 and does not destroy the main gcc installation:
Mohamad Qadri
Mohamad Qadri 2020년 9월 16일
Thanks Ladislav, the package works great

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


ma la
ma la 2020년 9월 11일
A work arround which seems to work in some cases is to use octave to compile the mex.
I am realy surprised that is does, and I have no idea of the limitation or the limits of that workarround. Currently, I compile the mex code with the ubuntu (20.04 LTS) version of octace and then run the code from matlab. I would always recommend to first run an example with known results to validate that the code is actually performing as expected.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by