Getting MATLAB 2023b to work on Fedora 39
0January 12, 2024 by Garrett Mitchener
Summary
This is about getting the scientific computing package MATLAB to work with as few errors and missing features as possible on the Fedora distribution of Linux. You need some experience as a UNIX/Linux sysadmin or power user to make sense of this.
The basic problem
MATLAB comes with a bunch of bundled stuff that isn’t quite as close to the bleeding edge as what’s in Fedora. I’ve sent some messages back and forth to Mathworks tech support, and finally come up with the following fixes to some of the problems I’ve encountered. With these fixes, I’m now running MATLAB 2023b on Fedora 39 with minimal error messages on the console, and as far as I can tell, everything works.
This machine is a Dell Precision workstation, Intel-AMD 64-bit processor, with an AMD GPU. I’ve installed MATLAB in /usr/local/MATLAB/R2023b.
The main idea is that it’s better to use the system versions of GTK2, fontconfig, and libstdc++ than the versions that are bundled with MATLAB.
GTK problems
To fix GTK2, set the environment variable GTK_PATH=/usr/lib64/gtk-2.0. There are several ways to do this. One is to use the env command to run MATLAB,
env GTK_PATH=/usr/lib64/gtk-2.0 /usr/local/MATLAB/R2023b/bin/matlab
I prefer to put something like this into a bash script in ~/bin/matlab,
#!/bin/bash
export GTK_PATH=/usr/lib64/gtk-2.0
/usr/local/MATLAB/R2023b/bin/matlab "$@"
Anyway, setting GTK_PATH seems to fix these problems:
- Every keystroke sends an X11 error to the console:
Xlib: sequence lost (0x10000 > 0xf134) in reply type 0x2!
- Unable to load libcanberra, which is a sound-related library:
Gtk-Message: 17:39:36.540: Failed to load module "canberra-gtk-module"
I haven’t found a fix for the warning about Gtk-Message: 09:59:26.024: Failed to load module "pk-gtk-module"
. It seems to be harmless. This warning means that the PackageKit module is missing for GTK2. I don’t think MATLAB uses it anyway. This module allows an application to offer to install system packages if there’s one it thinks you need. Fedora comes with PackageKit modules for GTK3, but not GTK2, and I’m assuming that no one is maintaining the GTK2 module these days.
Library problems
These next fixes require root privileges. My approach is to find the directory where the bundled libraries are, create a subdirectory called Attic, and move the problematic ones into that subdirectory. That way, if I need to get them back, they’re easy to find, and I can run mv Attic/<file> .
to restore them.
To use the system libstdc++,
cd /usr/local/MATLAB/R2023b/sys/os/glnxa64
mkdir -p Attic
mv -v libstdc++* Attic
This change allows Mesa rendering drivers to load properly, seems to fix these problems:
- Error messages like this in the console:
MATLAB is selecting SOFTWARE rendering.
MESA-LOADER: failed to open radeonsi: /usr/local/MATLAB/R2023b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib64/dri/radeonsi_dri.so) (search paths /usr/lib64/dri, suffix _dri)
To use the system fontconfig,
cd /usr/local/MATLAB/R2023b/bin/glnxa64
mkdir -p Attic
mv -v libfontconfig* Attic
That hushes the warning Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
which is harmless, but I figured I’d get rid of it. It happens because there’s a feature in that config file that is only available in more recent versions of fontconfig.
Getting the gnome shell launcher (.desktop file) to work
I haven’t been able to get this to work. Since I can launch MATLAB from a command line, I haven’t tried to fix the launcher.
Category Computer, Math | Tags: computer, fixed, linux
Leave a Reply