Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Matlab is not able to load required libraries #141

Closed
gabrielenava opened this issue Jul 11, 2016 · 9 comments · Fixed by robotology/robotology-superbuild#1464
Closed

Matlab is not able to load required libraries #141

gabrielenava opened this issue Jul 11, 2016 · 9 comments · Fixed by robotology/robotology-superbuild#1464

Comments

@gabrielenava
Copy link
Collaborator

gabrielenava commented Jul 11, 2016

For some versions of Ubuntu and Matlab, the toolbox that require Matlab such as WBToolbox, WBIToolboxControllers and IDynTree complain about missing libraries. Here is the output for WBToolbox:

Invalid MEX-file '/home/DanielePucci/Software/codyco-superbuild/build/install/mex/WBToolbox.mexa64':
 /home/DanielePucci/Software/matlab/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.21' not found (required by /home/DanielePucci/Software/codyco-superbuild/build/install/mex/WBToolbox.mexa64)

This issue has been temporarily solved adding to the .bashrc

alias matlab="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab"

The error comes out with Ubuntu xenial, Matlab version is 2016a and gcc version is 5.3.1 20160413

@traversaro
Copy link
Contributor

traversaro commented Aug 3, 2016

I solved the problem in a more permanent way my renaming the matlab's libstdc++.so.6 to a different name:

sudo mv  /usr/local/MATLAB/R2016a/sys/os/glnxa64/libstdc++.so.6 /usr/local/MATLAB/R2016a/sys/os/glnxa64/libstdc++.so.6.back

In this way matlab always finds the system libstdc++.so.6 instead of its own version, regardless of how you call it.
This is extremely important to make sure that matlab works correctly even when is not called by the terminal, for example when it is called by CTest while running some automatic tests for some repositories with matlab tests, such as iDynTree or mex-wholebodymodel.

@francesco-romano
Copy link
Contributor

francesco-romano commented Nov 2, 2016

Every now and then these runtime issues pop up.

An additional alternative, which probably can be the more clean than the two previous, is to copy the file in matlabroot/bin/.matlab7rc.sh into the user's home folder, e.g. on macOS
cp /Applications/MATLAB_R2016b.app/bin/.matlab7rc.sh ~/.matlab7rc.sh and modifying it by looking for the corresponding architecture section (e.g. glnx* for linux, ...) and add the libraries to the LDPATH_PREFIX variable.
For example in my case:

LDPATH_PREFIX='/usr/local/opt/gcc/lib/gcc/6/'

You can also check that this works, by executing the following line in the Matlab prompt (this is for mac, but it suffices to change DYLD_LIBRARY_PATH into LD_LIBRARY_PATH for linux).

getenv('DYLD_LIBRARY_PATH')

and check that the paths in LDPATH_PREFIX are before the matlab paths, e.g.

>> getenv('DYLD_LIBRARY_PATH')

ans =

/usr/local/opt/gcc/lib/gcc/6/:/Applications/MATLAB_R2016b.app/sys/os/maci64:/Applications/MATLAB_R2016b.app/bin/maci64/../../Contents/MacOS: ...

@diegoferigo
Copy link

This workaround is still required

Ubuntu Xenial
Matlab 2016b
GCC 5.4.0 20160609

@traversaro
Copy link
Contributor

cc @fjandrad

@traversaro
Copy link
Contributor

This information need to be moved to some FAQ or QA issue.

@traversaro
Copy link
Contributor

Moved the problem of properly documenting this at the superbuild level in robotology/robotology-superbuild#64 .

@yeshasvitirupachuri
Copy link

I tried to run the standup controller from whole-body-controllers on a new installation of MATLAB Version 9.4 (R2018a), Simulink Version 9.1 (R2018a). While trying to run the simulink model "unable to run the MATLABWindow application" warning message with other error messages are thrown and the model was terminated without running. @gabrielenava and I followed this issue and renamed all the libglib-* files to libglib-*.old. This solved the issue and the simulink model is running without errors now.

@traversaro
Copy link
Contributor

@Yeshasvitvs on which version of Ubuntu you had this problem?

@yeshasvitirupachuri
Copy link

@traversaro Ubuntu 18.04

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants