Skip to content

Instantly share code, notes, and snippets.

@bonanza123
Created September 5, 2016 12:50

Revisions

  1. bonanza123 created this gist Sep 5, 2016.
    13 changes: 13 additions & 0 deletions MATLAB MEX GCC archlinux
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    MATLAB usually requires acient gcc versions to compile MEX files (e.g. v4.9.x for R2016b). However, archlinux usually ships with the most recent version of gcc and this may results in some conflicts with linked C++ ABI.
    Fortunately, archlinux AUR provides also older gcc versions (such as gcc49). The problem is that MATLAB's `mex -setup` doesn't find these additionally installed gcc versions. The solution is to go into your local mex config in:
    `/home/XX/.matlab/R2016b/mex_C++_glnxa64.xml`
    and replace the line
    `<cmdReturns name="which g++" />`
    e.g. with
    `<cmdReturns name="which g++-4.9" />`.
    Additionally, change
    `<cmdReturns name="g++ -print-file-name=libstdc++.so"`
    to
    `<cmdReturns name="g++-4.9 -print-file-name=libstdc++.so"`.
    Then try to run `mex.getCompilerConfigurations('C++','Selected')` from MATLAB and verify the settings.
    (Don't forget to the same if the mex_C xml files etc).