-
Notifications
You must be signed in to change notification settings - Fork 200
Description
This is less a bug report, more just creating a paper trail in hopes the next person doesn't also accidentally lose a day to library errors.
If you are:
- a Linux user
- using a newer version of MATLAB (2025b for me)
- using MTEX 6.1 to automatically download the correct .mexa64 files for you,
You might run into the same issue I did, where jcvoronoi_mex gives a Failure result during MTEX's install, and then a variation of the following error when running calcGrains:
checking: jcvoronoi_mex.mexa64 failed
--> [Invalid MEX-file '/path/to/mtex/mtex-6.1.0/mex/jcvoronoi_mex.mexa64': /path/to/matlab/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by jcvoronoi_mex.mexa64)]
This (I believe?) is because jcvoronoi is the only MTEX mex that is compiled from .cpp, and the version it's compiled with needs to match the libstdc++.so.6 INSIDE THE MATLAB INSTALL.
The two solutions that worked for me:
Option A: soft link your own libstdc++.so.6
find where the MATLAB libstdc++.so.6 file is (usually sys/os/glnx64), move it somewhere else as a backup, and replace it with a softlink to your local library
cd <matlabroot>/sys/os/glnxa64
mkdir old_libs
mv libstdc++.so.6* old_libs
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
# (Adjust paths as needed)
Option B: soft recompile the mex
Delete mtext-6.1.0/mex/jcvoronoi_mex.mexa64, get a mex builder if you don't already have one via
sudo apt install build-essential
and run mex_install from matlab.
Both ways worked for me, I'm not matlab-savy enough to know if one is better than the other.
I'll also add, as a Linux user, the mex changes in 6.1.0 have been a huge time saver and the above has been the only real problem I've seen so far. Thank you for the hard work, it makes my life considerably easier.