Skip to content

Commit

Permalink
Add documentation on how to solve "Invalid MEX-file error" when using…
Browse files Browse the repository at this point in the history
… MATLAB (#1464)

* Add FAQ entry on Invalid MEX-file error

* Add links to FAQs in MATLAB-related documentation
  • Loading branch information
traversaro authored Aug 29, 2023
1 parent c71a4e4 commit 399e8d4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,32 @@ The `robotology-superbuild` is based on [YCM](https://github.com/robotology/ycm)
International Journal of Semantic Computing (IJSC), Vol. 13, No. 02, 2019


### How do I solve the "Invalid MEX-file <...>" error message on Linux when using MATLAB or Simulink libraries?

If you are on Linux and you encounter errors similar to:
~~~
Invalid MEX-file '/home/username/Software/robotology-superbuild/build/install/mex/WBToolbox.mexa64':
/home/username/Software/matlab/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.21' not found (required by /home/username/Software/robotology-superbuild/build/install/mex/WBToolbox.mexa64)
~~~
when running MATLAB or Simulink libraries installed by the robotology-superbuild, to solve the problem it should be sufficient to run:
~~~
sudo apt install matlab-support
~~~
and specify your MATLAB installation directory and when there is the question "Rename MATLAB's GCC libraries?" answer "Yes".

If there are no configuration question when you run , probably that means that the package is already installed. In that case, you can just reconfigure it with the command:
~~~
sudo dpkg-reconfigure matlab-support
~~~
and again, specify your MATLAB installation directory and when there is the question "Rename MATLAB's GCC libraries?" answer "Yes".

If the problem persists even after following this steps, please [open a new issue in the robotology-superbuild issue tracker](https://github.com/robotology/robotology-superbuild/issues/new).





Mantainers
==========

Expand Down
6 changes: 5 additions & 1 deletion doc/cmake-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ For more info on configuring MATLAB software with the robotology-superbuild, ple
### Check the installation
To verify that the compilation of `ROBOTOLOGY_USES_MATLAB` option was successful, try to run a script that uses
the Matlab bindings of `yarp` and see if it executes without any error, for example:

~~~matlab
yarpVec = yarp.Vector();
yarpVec.resize(3);
Expand All @@ -314,6 +315,8 @@ yarpVec.toMatlab()
~~~~
This scripts should print a `1 2 3` vector, but only if the `yarp` bindings are working correctly.
If executing this script you obtain a "Invalid MEX-file ..." error, please check how to solve this problem in [the related FAQ question in robotology-superbuild's README](../README.md#how-do-i-solve-the-invalid-mex-file--error-message-on-linux-when-using-matlab-or-simulink-libraries).
## Octave
Expand All @@ -334,7 +337,8 @@ yarpVec.resize(3);
yarpVec.fromMatlab([1;2;3]);
yarpVec.toMatlab()
~~~~
This scripts should print a `1 2 3` vector, but only if the `yarp` bindings are working correctly.
This scripts should print a `1 2 3` vector, but only if the `yarp` bindings are working correctly.
## Python
Expand Down
1 change: 1 addition & 0 deletions doc/matlab-one-line-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ vec.fromMatlab([1,2,3])
vec.toString();
~~~

If executing this script you obtain a "Invalid MEX-file ..." error, please check how to solve this problem in [the related FAQ question in robotology-superbuild's README](../README.md#how-do-i-solve-the-invalid-mex-file--error-message-on-linux-when-using-matlab-or-simulink-libraries).


### Installation on MATLAB Online
Expand Down

0 comments on commit 399e8d4

Please sign in to comment.