MATLAB: Does MATLAB Coder locate the wrong toolchain when trying to build code for a specific hardware on the Linux machine (MATLAB R2017b)

matlab coder

I am currently running MATLAB on a linux system with centos 7.2 server and have gcc 4.8.5 installed as the default compiler on my machine (which is confirmed by executing "gcc -v"). I have also selected gcc 4.8.5 in MATLAB through the "mex -setup" command, however, when I try to automatically locate an installed toolchain in MATLAB Coder for the build process on a specified hardware board, "GNU gcc/g++ v4.4x" gets chosen instead of gcc v4.8. I am even unable to find v4.8 in the drop-down list and in the Target Build Log, GNU gcc/g++ v4.4.x shows up.
How do I use gcc v4.8.5 with MATLAB Coder even though it is selected as the compiler in MATLAB?

Best Answer

The toolchain name that appears in MATLAB Coder (GNU gcc/g++ v4.4.x) is misleading. Even though the toolchain states gcc v4.4, the compiler being used is actually the one that is set up through "mex -setup", which in your case is v4.8.5.