12

I'm running matlab R2016a on Fedora 24 and I can't use the plot command.

This is the error I get:

Error using gca

While setting the 'Parent' property of 'Axes':

Can't load '/usr/local/MATLAB/R2016a/bin/glnxa64/libmwosgserver.so': /usr/local/MATLAB/R2016a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version 'CXXABI_1.3.8' not found (required by /lib64/libGLU.so.1)

Error in newplot (line 73)

ax = gca(fig);

Also I have seen How to fix: [program name] /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version CXXABI_1.3.8' not found (required by [program name]) and it doesn't help.

Community
  • 1
  • 1
saiedmomen
  • 1,401
  • 16
  • 33

4 Answers4

15

What I did was I edited a file called .matlab7rc.sh (located in "path_to_ matlab/bin" folder and its hidden) and uncommented all lines that were(there are several of them):

LDPATH_PREFIX='$MATLAB/sys/opengl/lib/$ARCH'

The following is stated in the file for uncommenting this line(s)

To always use the OpenGL libraries shipped with MATLAB uncomment the next line.

Although it certainly did the trick I'm curious whether using OpenGL that was shipped with MATLAB degrades the performance and in general how does this approach compares to @joe_st_amand's answer.

saiedmomen
  • 1,401
  • 16
  • 33
  • 1
    This also solves an issue of MATLAB not closing when you attempt to exit, and instead stalling and saying "Busy" for all eternity. From here (https://www.mathworks.com/matlabcentral/answers/299126-r2016a-on-linux-fedora-24-will-not-exit) but also relevant to Ubuntu 16.10 in my case. – Anthony Jan 04 '17 at 14:51
9

I had the same problem with that version of matlab and fedora. It seems that matlab prepends its own library paths on startup to LD_LIBRARY_PATH.

You can start up matlab with and tell it to use the right version of libstdc++ using the following: LD_PRELOAD=/usr/lib64/libstdc++.so.6 matlab -desktop

What I did was add an alias to my .bashrc file: alias matlab='LD_PRELOAD=/usr/lib64/libstdc++.so.6 matlab -desktop'

Hope that helps!

Joe St Amand
  • 145
  • 5
0

Alternate fix:

Rename the libstdc++.so.6 library file so that MATLAB cannot find it and is forced to use the system's version of the library. This file is located in matlabroot/sys/os/glnxa64/

Source: https://in.mathworks.com/matlabcentral/answers/329796-issue-with-libstdc-so-6

I tried and it worked like charm.

Joseph
  • 2,327
  • 1
  • 19
  • 21
0

The following worked in fedora 28 scientific

> cd ~/usr/lib64
> ls libstd*

For me the output was

libstdc++.so.6  libstdc++.so.6.0.25

So I just added an alias in ~/.bashrc with the directory to libstdc++.so.6.0.25

> emacs ~/.bashrc

Write following line at the end:

alias matlab='LD_PRELOAD=/usr/lib64/libstdc++.so.6.025  /your/dir/to/bin/glnxa64/MATLAB -desktop'

Where /your/dir/to/ is the directory of your MATLAB installation. Then

> source ~/.bashrc

and after that I just run > matlab in terminal and all is OK.

EDIT. Add it to a desktop entry

You must make/edit a matlab.desktop file with the following, and place it in your .applications folder in order to works.

[Desktop Entry]
Name=Matlab R2017a
Exec=LD_PRELOAD=/usr/lib64/libstdc++.so.6.0.25 /usr/local/MATLAB/R2017a/bin/matlab -desktop &
Icon=~/username/.icons/Matlab_Logo.png
Terminal=false
Type=Application
Categories=Development;Science;Education

When opening from the desktop entry, it will load the appropiate libstdc. Works well.

jealcalat
  • 147
  • 9