https://wiki.archlinux.org/api.php?action=feedcontributions&user=Kyak&feedformat=atomArchWiki - User contributions [en]2024-03-29T05:10:35ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=MATLAB&diff=736569MATLAB2022-07-08T08:51:20Z<p>Kyak: Work around installer issue</p>
<hr />
<div>[[Category:Numerical analysis]]<br />
[[ja:MATLAB]]<br />
[[zh-hans:MATLAB]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose, sometimes written in in first person}}<br />
From the [https://www.mathworks.com/products/matlab.html official website]:<br />
<br />
:MATLAB is a programming and numeric computing platform used by millions of engineers and scientists to analyze data, develop algorithms, and create models.<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Arch Linux is not officially supported.<br />
[https://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [https://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{AUR|matlab}} package or from the MATLAB installation software directly. The advantage of the {{AUR|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories.<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. [[Wayland]] is not currently supported yet, at least not for the GUI; however, plotting seems to work. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you. On version R2020 the normal {{ic|install}} script may not work, however, the legacy install script {{ic|ISO-DIR/bin/glnxa64/install_unix_legacy}} does work [https://bbs.archlinux.org/viewtopic.php?pid=1928258#p1928258].<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
Or you could add MATLAB install path to {{ic|PATH}} environment variable.<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
Example desktop entry (replace '''R2019a''' with your MATLAB version):<br />
<br />
{{hc|1=/usr/share/applications/matlab.desktop|<br />
2=[Desktop Entry]<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=/usr/local/MATLAB/'''R2019a'''/bin/matlab -desktop<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
}}<br />
<br />
If one need to set environment variable, one could prepend {{ic|env}} in {{ic|Exec}}, for example, to system's libfreetype:<br />
Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab<br />
<br />
One might want to use the system's {{ic|libstdc++}}.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The {{AUR|matlab}} package is designed to allow MATLAB to be integrated into and managed by Arch. Note however, that the package does not contain the installation files, and you are expected to place them in the cloned package folder yourself. It can be problematic to build the package using [[AUR helpers]], so you are expected to do so manually. You can obtain the actual MATLAB software using the installer from [https://www.mathworks.com the MathWorks website].<br />
<br />
{{Warning| <br />
The EULA for the proprietary MATLAB software is restrictive and it prohibits distribution and modification of the installation files. The installation method described in this section should only be performed on the system on which the software is going to be installed and the package should be deleted from the installation location and the [[pacman]] cache following installation. Redistributing the built package is a violation of the MATLAB EULA.<br />
}}<br />
<br />
* Clone the {{AUR|matlab}} package and {{ic|cd}} into it.<br />
<br />
* Download the zip file containing the MATLAB installer from MathWorks into the current directory. Extract the zip to the {{ic|matlab}} subdirectory (replace the XXXXX with your release version):<br />
<br />
$ bsdtar xC matlab -f matlab_XXXXX_glnxa64.zip<br />
<br />
* Run the extracted installer with:<br />
<br />
$ ./matlab/install<br />
<br />
* The installer gives you a choice of either installing the software now or only downloading selected modules. Choose the second option.<br />
<br />
* The installer will give you an option to change the download path. You might want to change it to something temporary (like {{ic|/tmp}} if you have big enough ram disk) as you will soon move the contents to a different location.<br />
<br />
* Wait for the download to finish and close the installer. Merge the downloaded archives into the extracted {{ic|matlab}} subdirectory (replace YYYY_MM_DD_HH_MM_SS with your release code):<br />
<br />
$ rsync -a /selected/download/folder/YYYY_MM_DD_HH_MM_SS/archives matlab<br />
<br />
* Then package the directory into a tarball:<br />
<br />
$ tar -cvf matlab.tar matlab<br />
<br />
* Download your licence: Go to [https://mathworks.com/mwaccount/ your MathWorks account] and click on the licence number you want to use. Then, go to the ''Install and activate'' tab and select ''Activate to retrieve licence File''. Follow the instructions and download the licence file needed for the installation. Name the file {{ic|matlab.lic}} and place it in the AUR package directory. There will also be a File Installation Key (FIK) visible on the MathWorks website. Copy-paste it in a new file named {{ic|matlab.fik}} and save it next to {{ic|PKGBUILD}} just like you did with the {{ic|matlab.lic}}.<br />
<br />
* Now, you will create a pacman package. You can customize the modules you want the package to contain by modifying the {{ic|PKGBUILD}} or leave it at default:<br />
<br />
{{hc|head=PKGBUILD|output=<br />
...<br />
# Limit products to lower size, set this to true to do a partial install<br />
partialinstall=false<br />
# Example list of products for a partial install; check README.md for details<br />
products=(<br />
"MATLAB"<br />
#---MATLAB Product Family---#<br />
"Curve_Fitting_Toolbox" # Math and Optimization<br />
"Database_Toolbox" # Database Access and Reporting<br />
"Deep_Learning_HDL_Toolbox"<br />
"Deep_Learning_Toolbox"<br />
"DSP_System_Toolbox"<br />
"Global_Optimization_Toolbox"<br />
"GPU_Coder"<br />
"MATLAB_Coder" # Code Generation<br />
"MATLAB_Compiler" # Application Deployement<br />
"MATLAB_Compiler_SDK"<br />
"Optimization_Toolbox"<br />
"Parallel_Computing_Toolbox" # Parallel computing<br />
"Partial_Differential_Equation_Toolbox"<br />
"Reinforcement_Learning_Toolbox"<br />
"Statistics_and_Machine_Learning_Toolbox" # AI, Data Science, Statistics<br />
"Symbolic_Math_Toolbox"<br />
"Text_Analytics_Toolbox"<br />
#---Application Products---#<br />
"Audio_Toolbox"<br />
"Bioinformatics_Toolbox" # Computational Biology<br />
"Computer_Vision_Toolbox"<br />
"Image_Processing_Toolbox" # Image Processing and Computer Vision<br />
"Signal_Processing_Toolbox" # Signal Processing<br />
"Wavelet_Toolbox"<br />
)<br />
...<br />
}}<br />
<br />
* Finally, use {{ic|makepkg}} command to build and install the package:<br />
<br />
$ makepkg -sri<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-utils}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If it works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/dri/<br />
<br />
If you experience a low-level graphics error, create a file with the name 'java.opts' in the directory where MATLAB is executed (for example '/usr/local/MATLAB/R2020a/bin/glnxa64') with the following line:<br />
-Djogl.disable.openglarbcontext=1<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [https://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers.html current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) does not seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it is no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Serial port access ===<br />
<br />
To successfully connect to any serial port, MATLAB expects to have write access directly to {{ic|/var/lock}} which is not allowed on Arch Linux for security reasons. Instead of allowing this access just for MATLAB, you can work around this problem by redirecting device locking using {{AUR|lockdev-redirect}}. All you have to do is executing MATLAB like this:<br />
<br />
# lockdev-redirect /{MATLAB}/bin/matlab<br />
<br />
If you have created a .desktop file as shortcut to MATLAB, then add "lockdev-redirect" as a prefix to your "Exec=" entry.<br />
<br />
=== HiDPI and 4k ===<br />
<br />
See [[HiDPI#MATLAB]].<br />
<br />
== Troubleshooting ==<br />
<br />
=== Warning: Initializing MATLAB Graphics failed ===<br />
<br />
This error seems to happen on multi-monitor setups, see [https://www.mathworks.com/matlabcentral/answers/611786-warning-initializing-matlab-graphics-failed#comment_1131148 this forum post].<br />
<br />
=== Blackscreen in help browser and livescripts ===<br />
<br />
In order to use help browser and livescripts install {{aur|libselinux}}.<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help browser {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [https://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]{{Dead link|2020|03|30|status=404}}<br />
* [https://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [https://stackoverflow.com/a/19468365]<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it does not resolve, you have to fool Java into thinking the WM is named LG3D. (It is an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the {{Pkg|wmname}} utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it does not work, try the combination of both. (The second line works in bspwm) If it still does not work, try googling similar issues with java in general.<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation dependencies missing ===<br />
<br />
Matlab might complain that it cannot find a package. Look at the package name and install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]]. {{AUR|matlab}} and {{AUR|matlab-dummy}} packages contain a list of up-to-date dependencies for the newest Matlab version.<br />
<br />
See also [[#Unable to launch the MATLABWindow application]].<br />
<br />
=== Installation error: archive is not a ZIP archive ===<br />
<br />
During the installation you can get:<br />
<br />
The following error was detected while installing ''package_name'': archive is not a ZIP archive <br />
Would you like to retry installing ''package_name''? If you press No, the installer will exit without completing the installation. More information can be found at /tmp/mathworks_root.log<br />
<br />
Matlab downloads all packages to {{ic|/tmp/}} directory which resides in RAM and is maximum size of half of available memory. In this case it is not enough for installation files and Matlab 2019a installer will warn you about this. If it did not, or if you ignored the warning, you will have got the above error.<br />
<br />
You can either [[Tmpfs#Examples|resize tmpfs]] (3,5 GB is not enough, 6 GB works), or remove packages from base install and add them later with built-in Matlab add-on installer.<br />
<br />
=== Install-time library errors ===<br />
<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you are installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== LiveScript errors ===<br />
<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing).<br />
<br />
A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start.<br />
<br />
A better option is to replace libgcrypt symlink in this extraction directory with a less precise one. For example, after extraction, this link to /lib64/libgcrypt.so.20.2.4 is created. Replace it with e.g. /lib64/libgcrypt.so.20.<br />
<br />
Matlab R2020 does not contain a chromium directory anymore. Relinking the library file libcrypto.so.1.1 with the system file can resolve the issue. It is located in:<br />
$MATLABROOT/bin/glnxa64<br />
<br />
*Also the steps in [[#Unable to launch the MATLABWindow application]] may resolve the issue.<br />
*It can also happen due to missing gconf package. Make sure {{AUR|gconf}} is installed.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
<br />
Make sure the correct support package add-ons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
<br />
{{Style|Written in first person}}<br />
<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround does not work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I have come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
{{bc|1=<br />
#!/bin/sh<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD {{!}}<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
}}<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error ===<br />
<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
<br />
For a ''Licensing error'' such as:<br />
<br />
{{hc|# matlab|<nowiki><br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
https://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
</nowiki>}}<br />
<br />
A re-activation might solve the problem.<br />
<br />
/usr/local/MATLAB/R2017a/bin/activate_matlab.sh -javadir /usr/lib/jvm/java-8-openjdk/jre/<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
<br />
In case MATLAB will not start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
<br />
{{Style|Written in first person}}<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
This problem is critical during installation. After one clicks some elements in the installation window, he will not be able to type into any textbox anymore and switching between windows does not always work. To circumvent the issue, one shall only use key-press, instead of mouse click during installation. MATLAB installer has a poor support on Wayland, one may also consider using other WM instead during installation.<br />
<br />
=== Unable to launch the MATLABWindow application ===<br />
<br />
In MATLAB version R2018b (and later), the installer crashes as follows:<br />
<br />
{{hc<br />
| $ ./install |<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 127<br />
[1] 1409378 IOT instruction (core dumped) ./install<br />
}}<br />
<br />
To find out why {{ic|MATLABWindow}} is crashing, run it manually to get detailed information.<br />
<br />
{{hc<br />
| $ ./bin/glnxa64/MATLABWindow |<br />
bin/glnxa64/MATLABWindow: symbol lookup error: /usr/lib/libcairo.so.2: undefined symbol: FT_Get_Color_Glyph_Layer<br />
}}<br />
<br />
{{ic|FT_Get_Color_Glyph_Layer}} is a symbol of {{Pkg|freetype2}}, which indicates a library incompatibility between the MATLAB application and the Arch Linux packages. [https://ww2.mathworks.cn/matlabcentral/answers/364551-why-is-matlab-unable-to-run-the-matlabwindow-application-on-linux]<br />
<br />
To fix this, put aside MATLAB's {{ic|libfreetype.so*}}.<br />
<br />
$ rm ./bin/glnxa64/libfreetype.so.6*<br />
<br />
You can also use {{ic|LD_PRELOAD}} environment variable to force MATLAB use Arch Linux's libfreetype without removing the lib file.<br />
<br />
$ export LD_PRELOAD=/lib64/libfreetype.so<br />
$ ./install<br />
<br />
Similarly, if the error is caused by {{ic|undefined symbol: g_log_structured...}}, put aside MATLAB's {{ic|libglib-2.0.so*}}. If the error is caused by {{ic|path to/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by _somelibrary_)}}, put aside MATLAB's {{ic|libstdc++.so.6}}.<br />
<br />
=== Add-on manager does not start in R2020a ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the Add-on manager does not start. Instead, the following error is shown<br />
<br />
Error using matlab.internal.cef.webwindow (line 385)<br />
MATLABWindow application failed to launch. Unable to launch the MATLABWindow application<br />
<br />
Error in matlab.internal.webwindow/createImplementation (line 288)<br />
implObj = matlab.internal.cef.webwindow(varargin{:});<br />
<br />
Error in matlab.internal.webwindow (line 144)<br />
obj.impl = obj.createImplementation(varargin{:});<br />
<br />
Error in matlab.internal.addons.AddOnsWindow/launch (line 51)<br />
obj.webwindow = matlab.internal.webwindow(char(url), obj.debugPort, obj.normalWindowPosition);<br />
<br />
Error in matlab.internal.addons.Explorer/loadUrlForNavigateToMessage (line 125)<br />
obj.addOnsWindowInstance.launch(url, obj.windowStateUtil.getExplorerWindowMaximizedSetting);<br />
<br />
Error in matlab.internal.addons.Explorer/show (line 56)<br />
obj.loadUrlForNavigateToMessage(url);<br />
<br />
Error in matlab.internal.addons.launchers.showExplorer (line 128)<br />
matlab.internal.addons.Explorer.getInstance.show(navigationData);<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} and {{ic|libgio*}} libraries of MATLAB, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd {MATLAB INSALLATION FOLDER}/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* libgio-2.0.so* exclude/<br />
<br />
=== Cannot verify university login during installation ===<br />
<br />
For total headcount license users, MATLAB will pop-up a window asking the user to login with their credentials in a web browser. However, if run with {{ic|sudo}}, most browsers (especially chromium) will not run. To circumvent this problem, one shall 'active the computer' through MATLAB's website using a browser by a normal user. [https://www.mathworks.com/matlabcentral/answers/326647-verify-university-login-not-open-browser See this issue]<br />
<br />
=== Missing libcrypt.so.1 ===<br />
<br />
If you get this error when launching or installing MATLAB (R2020a and later), install {{Pkg|libxcrypt-compat}}.<br />
<br />
=== Running installer as root does not launch the GUI ===<br />
<br />
If you run the installer as root and the GUI does not appear (but does appear without launching as root), try temporarily allowing the root user to access the X Server by running the following commands in order (where {{ic|./install}} is the command to run the installer as root):<br />
<br />
$ xhost +SI:localuser:root<br />
# ./install<br />
$ xhost -SI:localuser:root<br />
<br />
Note that the last command should be executed upon finishing the installation process, and {{ic|localuser}} is a string literal. See [https://au.mathworks.com/matlabcentral/answers/1461039-on-ubuntu-sudo-won-t-run-the-install-file#comment_1782671 this support answer], and {{man|1|xhost}}.<br />
<br />
In addition, verify that the {{ic|DISPLAY}} environment variable is set.<br />
<br />
An alternative is to install MATLAB as a local user.<br />
<br />
=== GUI installer is unable to create the target folder when installing as user ===<br />
<br />
Make the folder manually (as root), and take ownership. The path is typically /usr/local/MATLAB<br />
# mkdir -p /path/to/MATLAB/R20XXx<br />
# chown -R $LOGNAME: /path/to/MATLAB/R20XXx<br />
<br />
=== MATLAB crashes when opening Simulink ===<br />
<br />
When running from terminal the error message is:<br />
<br />
Inconsistency detected by ld.so: ../elf/dl-tls.c: 597: _dl_allocate_tls_init: Assertion `listp != NULL' failed!<br />
<br />
See upstream bug report here: https://www.mathworks.com/support/bugreports/details/2632298<br />
<br />
=== MATLAB cannot open or create script files ===<br />
<br />
See [[#Unable to launch the MATLABWindow application]].<br />
<br />
=== MATLAB installer doesn't start ===<br />
<br />
At least in R2022a and with one of the pango updates, there is a following error when running MATLAB installer:<br />
<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 127<br />
<br />
To work around this issue, force installer to use system libfreetype instead of shipping with installer:<br />
<br />
LD_PRELOAD=/usr/lib/libfreetype.so ./install<br />
<br />
== MATLAB in a systemd-nspawn ==<br />
<br />
MATLAB can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following instruction is to get a MATLAB R2021b installation running in a minimal Debian 11 environment. It assumes MATLAB is already installed as normal in "/usr/local/MATLAB/R2021b".<br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance, see also [[Systemd-nspawn#Use an X environment]].<br />
<br />
Create a minimal Debian environment in a directory ("deb11" here) with:<br />
<br />
$ debootstrap --include=systemd-container --components=main,contrib bullseye deb11<br />
<br />
Set a password for the root user and create regular user:<br />
<br />
$ systemd-nspawn -D deb11<br />
passwd<br />
useradd -m username<br />
logout<br />
<br />
and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind-ro=/tmp/.X11-unix --bind=/dev/shm --bind=/usr/local/MATLAB --setenv=DISPLAY=:0 --setenv=MESA_LOADER_DRIVER_OVERRIDE=i965 -b -D deb11<br />
<br />
Install the following packages to have the required libraries in the nspawn environment for MATLAB: https://github.com/mathworks-ref-arch/container-images/blob/master/matlab-deps/r2021b/ubuntu20.04/Dockerfile<br />
<br />
"mesa-utils" and dependencies needs to be installed to support graphics acceleration.<br />
"usbutils" can be installed to support usb interfaces for I/O with MATLAB.<br />
<br />
Install the matlab-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.<br />
<br />
Another way is to add something like <br />
-u username -a /usr/local/MATLAB/R2021b/bin/matlab -nosoftwareopengl -useStartupFolderPref<br />
<br />
to the systemd-nspawn command above.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=704324MATLAB2021-12-04T19:29:12Z<p>Kyak: /* Link to official reply. Suggestion to reinstall gconf is misleading and incorrect */</p>
<hr />
<div>[[Category:Numerical analysis]]<br />
[[ja:MATLAB]]<br />
[[zh-hans:MATLAB]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose, sometimes written in in first person}}<br />
From the [https://www.mathworks.com/products/matlab.html official website]:<br />
<br />
:MATLAB is a programming and numeric computing platform used by millions of engineers and scientists to analyze data, develop algorithms, and create models.<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[https://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [https://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{AUR|matlab}} package or from the MATLAB installation software directly. The advantage of the {{AUR|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{AUR|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. [[Wayland]] is not currently supported yet, at least not for the GUI; however, plotting seems to work. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you. On version R2020 the normal {{ic|install}} script may not work, however, the legacy install script {{ic|ISO-DIR/bin/glnxa64/install_unix_legacy}} does work [https://bbs.archlinux.org/viewtopic.php?pid=1928258#p1928258].<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
Or you could add MATLAB install path to {{ic|PATH}} environment variable.<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
Example desktop entry (replace '''R2019a''' with your MATLAB version):<br />
<br />
{{hc|1=/usr/share/applications/matlab.desktop|<br />
2=[Desktop Entry]<br />
Version='''R2019a'''<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=/usr/local/MATLAB/'''R2019a'''/bin/matlab -desktop<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
}}<br />
<br />
If one need to set environment variable, one could prepend {{ic|env}} in {{ic|Exec}}, for example, to system's libfreetype:<br />
Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab<br />
<br />
One might want to use the system's {{ic|libstdc++}}.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The {{AUR|matlab}} package is designed to allow MATLAB to be integrated into and managed by Arch. Note however, that the package does not contain the installation files, and you are expected to place them in the cloned package folder yourself. It can be problematic to build the package using [[AUR helpers]], so you are expected to do so manually. You can obtain the actual MATLAB software using the installer from [https://www.mathworks.com the MathWorks website].<br />
<br />
{{Warning| <br />
The EULA for the proprietary MATLAB software is restrictive and it prohibits distribution and modification of the installation files. The installation method described in this section should only be performed on the system on which the software is going to be installed and the package should be deleted from the installation location and the [[pacman]] cache following installation. Redistributing the built package is a violation of the MATLAB EULA.<br />
}}<br />
<br />
* Clone the {{AUR|matlab}} package and {{ic|cd}} into it.<br />
<br />
* Download the zip file containing the MATLAB installer from MathWorks into the current directory. Extract the zip to the {{ic|matlab}} subdirectory (replace the XXXXX with your release version):<br />
<br />
$ bsdtar xC matlab -f matlab_XXXXX_glnxa64.zip<br />
<br />
* Run the extracted installer with:<br />
<br />
$ ./matlab/install<br />
<br />
* The installer gives you a choice of either installing the software now or only downloading selected modules. Choose the second option.<br />
<br />
* The installer will give you an option to change the download path. You might want to change it to something temporary (like {{ic|/tmp}} if you have big enough ram disk) as you will soon move the contents to a different location.<br />
<br />
* Wait for the download to finish and close the installer. Merge the downloaded archives into the extracted {{ic|matlab}} subdirectory (replace YYYY_MM_DD_HH_MM_SS with your release code):<br />
<br />
$ rsync -a /selected/download/folder/YYYY_MM_DD_HH_MM_SS/archives matlab<br />
<br />
* Then package the directory into a tarball:<br />
<br />
$ tar -cvf matlab.tar matlab<br />
<br />
* Download your licence: Go to [https://mathworks.com/mwaccount/ your MathWorks account] and click on the licence number you want to use. Then, go to the ''Install and activate'' tab and select ''Activate to retrieve licence File''. Follow the instructions and download the licence file needed for the installation. Name the file {{ic|matlab.lic}} and place it in the AUR package directory. There will also be a File Installation Key (FIK) visible on the MathWorks website. Copy-paste it in a new file named {{ic|matlab.fik}} and save it next to {{ic|PKGBUILD}} just like you did with the {{ic|matlab.lic}}.<br />
<br />
* Now, you will create a pacman package. You can customize the modules you want the package to contain by modifying the {{ic|PKGBUILD}} or leave it at default:<br />
<br />
{{hc|head=PKGBUILD|output=<br />
...<br />
# Limit products to lower size, set this to true to do a partial install<br />
partialinstall=false<br />
# Example list of products for a partial install; check README.md for details<br />
products=(<br />
"MATLAB"<br />
#---MATLAB Product Family---#<br />
"Curve_Fitting_Toolbox" # Math and Optimization<br />
"Database_Toolbox" # Database Access and Reporting<br />
"Deep_Learning_HDL_Toolbox"<br />
"Deep_Learning_Toolbox"<br />
"DSP_System_Toolbox"<br />
"Global_Optimization_Toolbox"<br />
"GPU_Coder"<br />
"MATLAB_Coder" # Code Generation<br />
"MATLAB_Compiler" # Application Deployement<br />
"MATLAB_Compiler_SDK"<br />
"Optimization_Toolbox"<br />
"Parallel_Computing_Toolbox" # Parallel computing<br />
"Partial_Differential_Equation_Toolbox"<br />
"Reinforcement_Learning_Toolbox"<br />
"Statistics_and_Machine_Learning_Toolbox" # AI, Data Science, Statistics<br />
"Symbolic_Math_Toolbox"<br />
"Text_Analytics_Toolbox"<br />
#---Application Products---#<br />
"Audio_Toolbox"<br />
"Bioinformatics_Toolbox" # Computational Biology<br />
"Computer_Vision_Toolbox"<br />
"Image_Processing_Toolbox" # Image Processing and Computer Vision<br />
"Signal_Processing_Toolbox" # Signal Processing<br />
"Wavelet_Toolbox"<br />
)<br />
...<br />
}}<br />
<br />
* Finally, use {{ic|makepkg}} command to build and install the package:<br />
<br />
$ makepkg -sri<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-utils}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If it works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
If you experience a low-level graphics error, you can use a software implementation of OpenGL or use an older driver. According to [[Intel graphics#Old OpenGL Driver (i965)|this]] entry in the ArchWiki, in Mesa 20.0 the new Iris driver was promoted to be the default for Gen8+. You may disable it and revert to use the old i965 driver by setting the {{ic|1=MESA_LOADER_DRIVER_OVERRIDE=i965}} [[environment variable]] before starting Matlab or any OpenGL application. Alternatively, you can run Matlab with the following command:<br />
<br />
$ env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop<br />
<br />
If it works, you can edit the Matlab launcher script to add:<br />
<br />
export MESA_LOADER_DRIVER_OVERRIDE=i965<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [https://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers.html current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) does not seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it is no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Serial port access ===<br />
<br />
To successfully connect to any serial port, MATLAB expects to have write access directly to {{ic|/var/lock}} which is not allowed on Arch Linux for security reasons. Instead of allowing this access just for MATLAB, you can work around this problem by redirecting device locking using {{AUR|lockdev-redirect}}. All you have to do is executing MATLAB like this:<br />
<br />
# lockdev-redirect /{MATLAB}/bin/matlab<br />
<br />
If you have created a .desktop file as shortcut to MATLAB, then add "lockdev-redirect" as a prefix to your "Exec=" entry.<br />
<br />
=== HiDPI and 4k ===<br />
<br />
See [[HiDPI#MATLAB]]<br />
<br />
== Troubleshooting ==<br />
<br />
=== Warning: Initializing MATLAB Graphics failed ===<br />
<br />
This error seems to happen on multi-monitor setups, see [https://www.mathworks.com/matlabcentral/answers/611786-warning-initializing-matlab-graphics-failed#comment_1131148 this forum post].<br />
<br />
=== Blackscreen in help browser and livescripts ===<br />
<br />
In order to use help browser and livescripts install {{aur|libselinux}}.<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help browser {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [https://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]{{Dead link|2020|03|30|status=404}}<br />
* [https://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [https://stackoverflow.com/a/19468365]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it does not resolve, you have to fool Java into thinking the WM is named LG3D. (It is an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the {{Pkg|wmname}} utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it does not work, try the combination of both. (The second line works in bspwm) If it still does not work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable {{ic|J2D_D3D}} to {{ic|false}}[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting {{ic|MATLAB_JAVA}} to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation dependencies missing ===<br />
<br />
Matlab might complain that it cannot find a package. Look at the package name and install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]]. {{AUR|matlab}} and {{AUR|matlab-dummy}} packages contain a list of up-to-date dependencies for the newest Matlab version.<br />
<br />
If you get the following error when running the install script:<br />
<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Unable to launch the MATLABWindow application<br />
Aborted<br />
<br />
this is solved by installing {{AUR|libselinux}} from the AUR.<br />
<br />
=== Installation error: archive is not a ZIP archive ===<br />
<br />
During the installation you can get:<br />
<br />
The following error was detected while installing ''package_name'': archive is not a ZIP archive <br />
Would you like to retry installing ''package_name''? If you press No, the installer will exit without completing the installation. More information can be found at /tmp/mathworks_root.log<br />
<br />
Matlab downloads all packages to {{ic|/tmp/}} directory which resides in RAM and is maximum size of half of available memory. In this case it is not enough for installation files and Matlab 2019a installer will warn you about this. If it did not, or if you ignored the warning, you will have got the above error.<br />
<br />
You can either [[Tmpfs#Examples|resize tmpfs]] (3,5 GB is not enough, 6 GB works), or remove packages from base install and add them later with built-in Matlab add-on installer.<br />
<br />
=== Install-time library errors ===<br />
<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you are installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. {{Bug|54257}}<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== LiveScript errors ===<br />
<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing).<br />
<br />
A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start.<br />
<br />
A better option is to replace libgcrypt symlink in this extraction directory with a less precise one. For example, after extraction, this link to /lib64/libgcrypt.so.20.2.4 is created. Replace it with e.g. /lib64/libgcrypt.so.20.<br />
<br />
Matlab R2020 does not contain a chromium directory anymore. Relinking the library file libcrypto.so.1.1 with the system file can resolve the issue. It is located in:<br />
$MATLABROOT/bin/glnxa64<br />
<br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*It can also happen due to missing gconf package. Make sure {{AUR|gconf}} is installed.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b does not recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
{{Warning|As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB does not see the video device anymore). Downgrading fixes this.}}<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround does not work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I have come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error ===<br />
<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
<br />
For a ''Licensing error'' such as:<br />
<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
https://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
<br />
A re-activation might solve the problem.<br />
<br />
/usr/local/MATLAB/R2017a/bin/activate_matlab.sh -javadir /usr/lib/jvm/java-8-openjdk/jre/<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
<br />
In case MATLAB will not start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
This problem is critical during installation. After one clicks some elements in the installation window, he will not be able to type into any textbox anymore and switching between windows does not always work. To circumvent the issue, one shall only use key-press, instead of mouse click during installation. MATLAB installer has a poor support on Wayland, one may also consider using other WM instead during installation.<br />
<br />
=== Installer crashes with "Unable to launch the MATLABWindow application" ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the installer crashes before the splash in shown.<br />
{{hc<br />
|$ ./install |<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Unable to launch the MATLABWindow application<br />
Aborted (core dumped)<br />
}}<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} libraries of the MATLAB installer, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd matlab_R2020a_glnxa64/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* exclude/<br />
<br />
=== Add-on manager does not start in R2020a ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the Add-on manager does not start. Instead, the following error is shown<br />
<br />
Error using matlab.internal.cef.webwindow (line 385)<br />
MATLABWindow application failed to launch. Unable to launch the MATLABWindow application<br />
<br />
Error in matlab.internal.webwindow/createImplementation (line 288)<br />
implObj = matlab.internal.cef.webwindow(varargin{:});<br />
<br />
Error in matlab.internal.webwindow (line 144)<br />
obj.impl = obj.createImplementation(varargin{:});<br />
<br />
Error in matlab.internal.addons.AddOnsWindow/launch (line 51)<br />
obj.webwindow = matlab.internal.webwindow(char(url), obj.debugPort, obj.normalWindowPosition);<br />
<br />
Error in matlab.internal.addons.Explorer/loadUrlForNavigateToMessage (line 125)<br />
obj.addOnsWindowInstance.launch(url, obj.windowStateUtil.getExplorerWindowMaximizedSetting);<br />
<br />
Error in matlab.internal.addons.Explorer/show (line 56)<br />
obj.loadUrlForNavigateToMessage(url);<br />
<br />
Error in matlab.internal.addons.launchers.showExplorer (line 128)<br />
matlab.internal.addons.Explorer.getInstance.show(navigationData);<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} and {{ic|libgio*}} libraries of MATLAB, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd {MATLAB INSALLATION FOLDER}/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* libgio-2.0.so* exclude/<br />
<br />
=== Cannot verify university login during installation ===<br />
<br />
For total headcount license users, MATLAB will pop-up a window asking the user to login with his credentials in a web browser. However, if run with {{ic|sudo}}, most browsers (especially chromium) will not run. To circumvent this problem, one shall 'active the computer' through MATLAB's website using a browser by a normal user. [https://www.mathworks.com/matlabcentral/answers/326647-verify-university-login-not-open-browser See this issue]<br />
<br />
=== Running installer as root does not launch the GUI ===<br />
<br />
If you run the installer as root and the GUI does not appear (but does appear without launching as root), try allowing the root user to access the X Server by running the following command and running the installer again:<br />
<br />
$ xhost +SI:localuser:root<br />
<br />
Otherwise, install MATLAB as a local user. See [https://au.mathworks.com/matlabcentral/answers/1461039-on-ubuntu-sudo-won-t-run-the-install-file#comment_1782671 this support answer].<br />
<br />
=== MATLAB crashes when opening Simulink ===<br />
<br />
When running from terminal the error message is:<br />
<br />
Inconsistency detected by ld.so: ../elf/dl-tls.c: 597: _dl_allocate_tls_init: Assertion `listp != NULL' failed!<br />
<br />
See upstream bug report here: https://www.mathworks.com/support/bugreports/details/2632298<br />
<br />
== MATLAB in a systemd-nspawn ==<br />
<br />
MATLAB can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following instruction is to get a MATLAB R2021b installation running in a minimal Debian 11 environment. It assumes MATLAB is already installed as normal in "/usr/local/MATLAB/R2021b".<br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance, see also [[Systemd-nspawn#Use an X environment]].<br />
<br />
Create a minimal Debian environment in a directory ("deb11" here) with:<br />
<br />
$ debootstrap --include=systemd-container --components=main,contrib bullseye deb11<br />
<br />
Set a password for the root user and create regular user:<br />
<br />
$ systemd-nspawn -D deb11<br />
passwd<br />
useradd -m username<br />
logout<br />
<br />
and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind-ro=/tmp/.X11-unix --bind=/dev/shm --bind=/usr/local/MATLAB --setenv=DISPLAY=:0 --setenv=MESA_LOADER_DRIVER_OVERRIDE=i965 -b -D deb11<br />
<br />
Install the following packages to have the required libraries in the nspawn environment for MATLAB: https://github.com/mathworks-ref-arch/container-images/blob/master/matlab-deps/r2021b/ubuntu20.04/Dockerfile<br />
<br />
"mesa-utils" and dependencies needs to be installed to support graphics acceleration.<br />
"usbutils" can be installed to support usb interfaces for I/O with MATLAB.<br />
<br />
Install the matlab-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.<br />
<br />
Another way is to add something like <br />
-u username -a /usr/local/MATLAB/R2021b/bin/matlab -nosoftwareopengl -useStartupFolderPref<br />
<br />
to the systemd-nspawn command above.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=698923MATLAB2021-10-12T14:05:59Z<p>Kyak: Modified section on running MATLAB in systemd-nspawn. This should now support graphics acceleration and a more complete dependency list</p>
<hr />
<div>[[Category:Numerical analysis]]<br />
[[ja:MATLAB]]<br />
[[zh-hans:MATLAB]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose, sometimes written in in first person}}<br />
From the [https://www.mathworks.com/products/matlab.html official website]:<br />
<br />
:MATLAB is a programming and numeric computing platform used by millions of engineers and scientists to analyze data, develop algorithms, and create models.<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[https://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [https://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. [[Wayland]] is not currently supported yet, at least not for the GUI; however, plotting seems to work. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you. On version R2020 the normal {{ic|install}} script may not work, however, the legacy install script {{ic|ISO-DIR/bin/glnxa64/install_unix_legacy}} does work [https://bbs.archlinux.org/viewtopic.php?pid=1928258#p1928258].<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
Or you could add MATLAB install path to {{ic|PATH}} environment variable.<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
Example desktop entry (replace '''R2019a''' with your MATLAB version):<br />
<br />
{{hc|1=/usr/share/applications/matlab.desktop|<br />
2=[Desktop Entry]<br />
Version='''R2019a'''<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=/usr/local/MATLAB/'''R2019a'''/bin/matlab -desktop<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
}}<br />
<br />
If one need to set environment variable, one could prepend {{ic|env}} in {{ic|Exec}}, for example, to system's libfreetype:<br />
Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab<br />
<br />
One might want to use the system's {{ic|libstdc++}}.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
{{Style|Needs proper shell prompts. Are these commands run as root or normal user? Also avoid using sudo and explaining how to use [[makepkg]]}}<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB. Activation keys and installation files are required to be present in the package directory. There are detailed instructions on how to create the necessary files in the {{ic|README.md}}, provided alongside the PKGBUILD. (Due to needing local files; AUR helpers most likely cannot be used to build this package. Following the instructions and then building using {{ic|makepkg -sri}} is recommended.)<br />
<br />
One could also install older releases, eg. {{aur|matlab-r2015b}}{{Broken package link|package not found}}. The method to create local files for older versions can be different; so it is best to refer to the PKGBUILD of interest. For example; the following is a set of instructions on how the installation files were generated for the 2019a version;<br />
<br />
* Download the zip file containing the MATLAB installer from Mathworks. Then, run the installer to download necessary files for installation.<br />
<br />
bsdtar xC matlab -f matlab_R2019a_glnxa64.zip<br />
./matlab/install<br />
<br />
* Make sure you check all the boxes of the toolboxes you would need, and wait until the download is finished. Make sure not to close the installer. You can locate the downloaded files:<br />
<br />
sudo find /tmp -name "tmw*"<br />
<br />
or<br />
<br />
cd /tmp<br />
ls | grep tmw<br />
<br />
* Merge the downloaded files to the installer:<br />
<br />
rsync -a /tmp/tmwXXXXXXXX/archives matlab<br />
<br />
* Then package the installer to the required tarball:<br />
<br />
tar -cvf matlab.tar -C matlab/ .<br />
<br />
* Then download the .lic file: Go in [https://mathworks.com/mwaccount/ your MathWorks account] and click on the license number you want to use. Then, go to the Install and Activate tab and select "Activate to Retrieve License File". Follow the instructions and download the license file needed for the installation and name the file {{ic|matlab.lic}}. Also, the File Installation Key (FIK) is displayed: copy-paste it in a empty file and name it {{ic|matlab.fik}}. <br />
<br />
* Copy the above files to the folder containing the PKGBUILD file. Then, modify the PKGBUILD file to install the toolboxes you need. Then, run the installation:<br />
<br />
makepkg -sri<br />
<br />
Depending on the versioning; this is how the files are to be generated.<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If it works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
If you experience a low-level graphics error, you can use a software implementation of OpenGL or use an older driver. According to [[Intel graphics#Old OpenGL Driver (i965)|this]] entry in the ArchWiki, in Mesa 20.0 the new Iris driver was promoted to be the default for Gen8+. You may disable it and revert to use the old i965 driver by setting the {{ic|1=MESA_LOADER_DRIVER_OVERRIDE=i965}} [[environment variable]] before starting Matlab or any OpenGL application. Alternatively, you can run Matlab with the following command:<br />
<br />
$ env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop<br />
<br />
If it works, you can edit the Matlab launcher script to add:<br />
<br />
export MESA_LOADER_DRIVER_OVERRIDE=i965<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [https://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers.html current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) does not seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Serial port access ===<br />
<br />
To successfully connect to any serial port, MATLAB expects to have write access directly to {{ic|/var/lock}} which is not allowed on Arch Linux for security reasons. Instead of allowing this access just for MATLAB, you can work around this problem by redirecting device locking using {{AUR|lockdev-redirect}}. All you have to do is executing MATLAB like this:<br />
<br />
# lockdev-redirect /{MATLAB}/bin/matlab<br />
<br />
If you have created a .desktop file as shortcut to MATLAB, then add "lockdev-redirect" as a prefix to your "Exec=" entry.<br />
<br />
=== HiDPI and 4k ===<br />
<br />
See [[HiDPI#MATLAB]]<br />
<br />
== Troubleshooting ==<br />
<br />
=== Warning: Initializing MATLAB Graphics failed ===<br />
<br />
This error seems to happen on multi-monitor setups, see [https://www.mathworks.com/matlabcentral/answers/611786-warning-initializing-matlab-graphics-failed#comment_1131148 this forum post].<br />
<br />
=== Blackscreen in help browser and livescripts ===<br />
<br />
In order to use help browser and livescripts install {{aur|libselinux}}.<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help browser {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [https://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]{{Dead link|2020|03|30|status=404}}<br />
* [https://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [https://stackoverflow.com/a/19468365]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it does not resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the {{Pkg|wmname}} utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it does not work, try the combination of both. (The second line works in bspwm) If it still does not work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable {{ic|J2D_D3D}} to {{ic|false}}[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting {{ic|MATLAB_JAVA}} to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation dependencies missing ===<br />
<br />
Matlab might complain that it cannot find a package. Look at the package name and install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]]. {{AUR|matlab}} and {{AUR|matlab-dummy}} packages contain a list of up-to-date dependencies for the newest Matlab version.<br />
<br />
If you get the following error when running the install script:<br />
<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Unable to launch the MATLABWindow application<br />
Aborted<br />
<br />
this is solved by installing {{AUR|libselinux}} from the AUR.<br />
<br />
=== Installation error: archive is not a ZIP archive ===<br />
<br />
During the installation you can get:<br />
<br />
The following error was detected while installing ''package_name'': archive is not a ZIP archive <br />
Would you like to retry installing ''package_name''? If you press No, the installer will exit without completing the installation. More information can be found at /tmp/mathworks_root.log<br />
<br />
Matlab downloads all packages to {{ic|/tmp/}} directory which resides in RAM and is maximum size of half of available memory. In this case it is not enough for installation files and Matlab 2019a installer will warn you about this. If it did not, or if you ignored the warning, you will have got the above error.<br />
<br />
You can either [[Tmpfs#Examples|resize tmpfs]] (3,5 GB is not enough, 6 GB works), or remove packages from base install and add them later with built-in Matlab add-on installer.<br />
<br />
=== Install-time library errors ===<br />
<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you are installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. {{Bug|54257}}<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== LiveScript errors ===<br />
<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing).<br />
<br />
A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start.<br />
<br />
A better option is to replace libgcrypt symlink in this extraction directory with a less precise one. For example, after extraction, this link to /lib64/libgcrypt.so.20.2.4 is created. Replace it with e.g. /lib64/libgcrypt.so.20.<br />
<br />
Matlab R2020 does not contain a chromium directory anymore. Relinking the library file libcrypto.so.1.1 with the system file can resolve the issue. It is located in:<br />
$MATLABROOT/bin/glnxa64<br />
<br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*It can also happen due to missing gconf package. Make sure {{AUR|gconf}} is installed.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b does not recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
{{Warning|As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB does not see the video device anymore). Downgrading fixes this.}}<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround does not work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I have come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error ===<br />
<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
<br />
For a ''Licensing error'' such as:<br />
<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
https://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
<br />
A re-activation might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
<br />
In case MATLAB will not start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
This problem is critical during installation. After one clicks some elements in the installation window, he will not be able to type into any textbox anymore and switching between windows does not always work. To circumvent the issue, one shall only use key-press, instead of mouse click during installation. MATLAB installer has a poor support on Wayland, one may also consider using other WM instead during installation.<br />
<br />
=== Installer crashes with "Unable to launch the MATLABWindow application" ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the installer crashes before the splash in shown.<br />
{{hc<br />
|$ ./install |<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Unable to launch the MATLABWindow application<br />
Aborted (core dumped)<br />
}}<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} libraries of the MATLAB installer, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd matlab_R2020a_glnxa64/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* exclude/<br />
<br />
=== Add-on manager does not start in R2020a ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the Add-on manager does not start. Instead, the following error is shown<br />
<br />
Error using matlab.internal.cef.webwindow (line 385)<br />
MATLABWindow application failed to launch. Unable to launch the MATLABWindow application<br />
<br />
Error in matlab.internal.webwindow/createImplementation (line 288)<br />
implObj = matlab.internal.cef.webwindow(varargin{:});<br />
<br />
Error in matlab.internal.webwindow (line 144)<br />
obj.impl = obj.createImplementation(varargin{:});<br />
<br />
Error in matlab.internal.addons.AddOnsWindow/launch (line 51)<br />
obj.webwindow = matlab.internal.webwindow(char(url), obj.debugPort, obj.normalWindowPosition);<br />
<br />
Error in matlab.internal.addons.Explorer/loadUrlForNavigateToMessage (line 125)<br />
obj.addOnsWindowInstance.launch(url, obj.windowStateUtil.getExplorerWindowMaximizedSetting);<br />
<br />
Error in matlab.internal.addons.Explorer/show (line 56)<br />
obj.loadUrlForNavigateToMessage(url);<br />
<br />
Error in matlab.internal.addons.launchers.showExplorer (line 128)<br />
matlab.internal.addons.Explorer.getInstance.show(navigationData);<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} and {{ic|libgio*}} libraries of MATLAB, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd {MATLAB INSALLATION FOLDER}/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* libgio-2.0.so* exclude/<br />
<br />
=== Cannot verify university login during installation ===<br />
<br />
For total headcount license users, MATLAB will pop-up a window asking the user to login with his credentials in a web browser. However, if run with {{ic|sudo}}, most browsers (especially chromium) will not run. To circumvent this problem, one shall 'active the computer' through MATLAB's website using a browser by a normal user. [https://www.mathworks.com/matlabcentral/answers/326647-verify-university-login-not-open-browser See this issue]<br />
<br />
== MATLAB in a systemd-nspawn ==<br />
<br />
MATLAB can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following instruction is to get a MATLAB R2021b installation running in a minimal Debian 11 environment. It assumes MATLAB is already installed as normal in "/usr/local/MATLAB/R2021b".<br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance, see also [[Systemd-nspawn#Use an X environment]].<br />
<br />
Create a minimal Debian environment in a directory ("deb11" here) with:<br />
<br />
$ debootstrap --include=systemd-container --components=main,contrib bullseye deb11<br />
<br />
Set a password for the root user and create regular user:<br />
<br />
$ systemd-nspawn -D deb11<br />
passwd<br />
useradd -m username<br />
logout<br />
<br />
and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind-ro=/tmp/.X11-unix --bind=/dev/shm --bind=/usr/local/MATLAB --setenv=DISPLAY=:0 --setenv=MESA_LOADER_DRIVER_OVERRIDE=i965 -b -D deb11<br />
<br />
Install the following packages to have the required libraries in the nspawn environment for MATLAB: https://github.com/mathworks-ref-arch/container-images/blob/master/matlab-deps/r2021b/ubuntu20.04/Dockerfile<br />
<br />
"mesa-utils" and dependencies needs to be installed to support graphics acceleration.<br />
"usbutils" can be installed to support usb interfaces for I/O with MATLAB.<br />
<br />
Install the matlab-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.<br />
<br />
Another way is to add something like <br />
-u username -a /usr/local/MATLAB/R2021b/bin/matlab -nosoftwareopengl -useStartupFolderPref<br />
<br />
to the systemd-nspawn command above.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=565679MATLAB2019-02-03T06:28:02Z<p>Kyak: Another option for jxbrowser libraries symlinks</p>
<hr />
<div>[[Category:Numerical analysis]]<br />
[[ja:Matlab]]<br />
[[zh-hans:MATLAB]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. [[Wayland]] is not currently supported yet. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
Or you could add MATLAB install path to {{ic|PATH}} environment variable.<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
Example desktop entry:<br />
<br />
{{hc|matlab.desktop|<br />
[Desktop Entry]<br />
<nowiki>Version=2018a<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=matlab -desktop -nosplash<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
</nowiki><br />
}}<br />
<br />
If one need to set environment variable, one could prepend {{ic|env}} in {{ic|Exec}}, for example, to system's libfreetype:<br />
{{bc|<br />
<nowiki>Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab<br />
</nowiki><br />
}}<br />
<br />
One might wanna use system's {{ic|libstdc++}}.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, one could also install old releases, eg. {{aur|matlab-r2015b}}. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory.<br />
<br />
In order to install Matlab from AUR, download the PKGBUILD file from AUR. Download the zip file containing the Matlab installer and name it <tt>matlab.zip</tt>. Then download the .lic file: Go in [https://mathworks.com/mwaccount/ your MathWorks account] and click on the license number you want to use. Then, go to the Install and Activate tab and select "Activate to Retrieve License File". Follow the instructions and download the license file needed for the installation and name the file <tt>matlab.lic</tt>. Also, the File Installation Key (FIK) is displayed: copy-paste it in a empty file and name it <tt>matlab.fik</tt>. For more details, refer to the PKGBUILD file.<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers.html current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing).<br />
<br />
A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start.<br />
<br />
A better option is to replace libgcrypt symlink in this extraction directory with a less precise one. For example, after extraction, this link to /lib64/libgcrypt.so.20.2.4 is created. Replace it with e.g. /lib64/libgcrypt.so.20.<br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*It can also happen due to missing gconf package. Make sure {{Pkg|gconf}} is installed.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
'''Warning:''' As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB doesn't see the video device anymore). Downgrading fixes this.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
<br />
For a ''Licensing error'' such as:<br />
<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
<br />
A re-activation might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance, see also [[Systemd-nspawn#Use an X environment]].<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=565673MATLAB2019-02-03T06:14:44Z<p>Kyak: Mention that gconf is needed for Live script editor</p>
<hr />
<div>[[Category:Numerical analysis]]<br />
[[ja:Matlab]]<br />
[[zh-hans:MATLAB]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. [[Wayland]] is not currently supported yet. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
Or you could add MATLAB install path to {{ic|PATH}} environment variable.<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
Example desktop entry:<br />
<br />
{{hc|matlab.desktop|<br />
[Desktop Entry]<br />
<nowiki>Version=2018a<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=matlab -desktop -nosplash<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
</nowiki><br />
}}<br />
<br />
If one need to set environment variable, one could prepend {{ic|env}} in {{ic|Exec}}, for example, to system's libfreetype:<br />
{{bc|<br />
<nowiki>Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab<br />
</nowiki><br />
}}<br />
<br />
One might wanna use system's {{ic|libstdc++}}.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, one could also install old releases, eg. {{aur|matlab-r2015b}}. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory.<br />
<br />
In order to install Matlab from AUR, download the PKGBUILD file from AUR. Download the zip file containing the Matlab installer and name it <tt>matlab.zip</tt>. Then download the .lic file: Go in [https://mathworks.com/mwaccount/ your MathWorks account] and click on the license number you want to use. Then, go to the Install and Activate tab and select "Activate to Retrieve License File". Follow the instructions and download the license file needed for the installation and name the file <tt>matlab.lic</tt>. Also, the File Installation Key (FIK) is displayed: copy-paste it in a empty file and name it <tt>matlab.fik</tt>. For more details, refer to the PKGBUILD file.<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers.html current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*It can also happen due to missing gconf package. Make sure {{Pkg|gconf}} is installed.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
'''Warning:''' As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB doesn't see the video device anymore). Downgrading fixes this.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
<br />
For a ''Licensing error'' such as:<br />
<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
<br />
A re-activation might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance, see also [[Systemd-nspawn#Use an X environment]].<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=563263MATLAB2019-01-14T10:20:37Z<p>Kyak: Automate workaround for unable to type in text fields</p>
<hr />
<div>[[Category:Numerical analysis]]<br />
[[ja:Matlab]]<br />
[[zh-hans:MATLAB]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. [[Wayland]] is not currently supported yet. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
Or you could add MATLAB install path to {{ic|PATH}} environment variable.<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
Example desktop entry:<br />
<br />
{{hc|matlab.desktop|<br />
[Desktop Entry]<br />
<nowiki>Version=2018a<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=matlab -desktop -nosplash<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
</nowiki><br />
}}<br />
<br />
If one need to set environment variable, one could prepend {{ic|env}} in {{ic|Exec}}, for example, to system's libfreetype:<br />
{{bc|<br />
<nowiki>Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab<br />
</nowiki><br />
}}<br />
<br />
One might wanna use system's {{ic|libstdc++}}.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, one could also install old releases, eg. {{aur|matlab-r2015b}}. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory.<br />
<br />
In order to install Matlab from AUR, download the PKGBUILD file from AUR. Download the zip file containing the Matlab installer and name it <tt>matlab.zip</tt>. Then download the .lic file: Go in [https://mathworks.com/mwaccount/ your MathWorks account] and click on the license number you want to use. Then, go to the Install and Activate tab and select "Activate to Retrieve License File". Follow the instructions and download the license file needed for the installation and name the file <tt>matlab.lic</tt>. Also, the File Installation Key (FIK) is displayed: copy-paste it in a empty file and name it <tt>matlab.fik</tt>. For more details, refer to the PKGBUILD file.<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers.html current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
'''Warning:''' As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB doesn't see the video device anymore). Downgrading fixes this.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
<br />
For a ''Licensing error'' such as:<br />
<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
<br />
A re-activation might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance, see also [[Systemd-nspawn#Use an X environment]].<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514907MATLAB2018-03-25T13:07:26Z<p>Kyak: /* Using webcam/video device */ Add note about USB Webcam support</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514906MATLAB2018-03-25T13:04:08Z<p>Kyak: /* Segmentation fault on startup */ Add R2018a info</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
ncurses compatibility layer is not required anymore for R2018a.<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514905MATLAB2018-03-25T13:02:24Z<p>Kyak: /* Addon manager not working */ Fix formatting</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514904MATLAB2018-03-25T13:01:20Z<p>Kyak: /* Addon manager not working */ Add R20218a info</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
This section is relevant for both R2017b and R2018a.<br />
Addon manager requires the {{AUR|libselinux}} package to work.<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514901MATLAB2018-03-25T12:58:22Z<p>Kyak: /* MATLAB hangs for several minutes when closing Help Browser */ Also relevant for R2018a</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2017b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b and R2018a.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514899MATLAB2018-03-25T12:45:49Z<p>Kyak: /* Troubleshooting */ I should preview before saving changes</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2017b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=514898MATLAB2018-03-25T12:44:14Z<p>Kyak: Added info on R2018 keyboard focus problem</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[zh-hans:Matlab]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Style|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]]{{Broken section link}} used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note|Newer versions of Matlab (at least 2017a) doesn't seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it doesn't resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the [http://tools.suckless.org/wmname wmname] utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it doesn't work, try the combination of both. (The second line works in bspwm) If it still doesn't work, try googling similar issues with java in general.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2017b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Do not forget to update the {{ic|*.0}} links as well.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
*It could be because of broken symlinks of {{Pkg|libgcrypt}} and other dependencies, after system updates. On the first start of the Live Editor the components are extracted and these libary symlinks are created (if not existing). A solution is to simply delete the whole folder containing the broken symlinks and the extracted components, which are in the installation directory (represented by {{ic|$MATLABROOT}}) under:<br />
$MATLABROOT/sys/jxbrowser-chromium<br />
Or if the installation directory is not user writable in:<br />
~/.matlab/R2017b/HtmlPanel<br />
Matlab will then regenerate the contents on the next Live Editor start. <br />
*Also the steps in [[#Addon manager not working]] may resolve the issue.<br />
*If the above does not help, execute in the command window<br />
>> com.mathworks.mde.liveeditor.widget.rtc.CachedLightweightBrowserFactory.createLightweightBrowser()<br />
to get a more detailed error message.<br />
* A debugging console can be opened with<br />
>> com.mathworks.mde.webbrowser.HtmlPanelDebugConsole.invoke;<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.<br />
<br />
=== MATLAB crashes with "Failure loading desktop class" on startup ===<br />
In case MATLAB won't start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
== Matlab in a systemd-nspawn ==<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Kyakhttps://wiki.archlinux.org/index.php?title=User_talk:Kyak&diff=491605User talk:Kyak2017-09-28T06:02:22Z<p>Kyak: /* Edit summaries */ I edited summary this time</p>
<hr />
<div>== Edit summaries ==<br />
<br />
Hi Kyak, thanks for your contributions! Can I ask if you see a message like below when trying to save an edit:<br />
<br />
{{Warning|You have not provided an edit summary, which is an enormous help for other users who want to review your changes, see [[ArchWiki:Contributing#The 3 fundamental rules]]. Clicking "Save page" again will break this rule and force saving the page without a summary.}}<br />
<br />
If you don't see it, it's a bug and we should fix it. In any case, can you please follow its advice?<br />
<br />
Cheers :) -- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 11:20, 27 September 2017 (UTC)<br />
<br />
:Hi Kynikos,<br />
:Now sure how do i reply to you.. Perhaps by just editing this section?<br />
:I never saw the message that you mentioned. However, i do edit summary. For example, in this very edit, i change the /* Edit summaries */ to /* I just edited summaries */.<br />
:Am i doing it right?<br />
:P.S. In fact, i can see edited summaries right there: https://wiki.archlinux.org/index.php?title=Matlab&action=history (like "Update unfreeze script").<br />
<br />
::Hehe sorry, my bad, I should have looked better :) The problem then is that you're changing the "commented" message (that between the /* */ tags), while you should write on the right of that, for example if you see:<br />
::{{bc|/* Edit summaries */}}<br />
::You should change it to:<br />
::{{bc|/* Edit summaries */ I just edited summaries}}<br />
::Instead of:<br />
::{{bc|<s>/* I just edited summaries /*</s>}}<br />
::Thank you! -- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 15:19, 27 September 2017 (UTC)<br />
<br />
:::Oh, I see - thanks! I thought that the comment IS the summary :)</div>Kyakhttps://wiki.archlinux.org/index.php?title=User_talk:Kyak&diff=491563User talk:Kyak2017-09-27T15:04:05Z<p>Kyak: /* Edit summaries once again */</p>
<hr />
<div>== Edit summaries ==<br />
<br />
Hi Kyak, thanks for your contributions! Can I ask if you see a message like below when trying to save an edit:<br />
<br />
{{Warning|You have not provided an edit summary, which is an enormous help for other users who want to review your changes, see [[ArchWiki:Contributing#The 3 fundamental rules]]. Clicking "Save page" again will break this rule and force saving the page without a summary.}}<br />
<br />
If you don't see it, it's a bug and we should fix it. In any case, can you please follow its advice?<br />
<br />
Cheers :) -- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 11:20, 27 September 2017 (UTC)<br />
<br />
<br />
Hi Kynikos,<br />
<br />
Now sure how do i reply to you.. Perhaps by just editing this section?<br />
I never saw the message that you mentioned. However, i do edit summary. For example, in this very edit, i change the /* Edit summaries */ to /* I just edited summaries */.<br />
<br />
Am i doing it right?<br />
<br />
P.S. In fact, i can see edited summaries right there: https://wiki.archlinux.org/index.php?title=Matlab&action=history (like "Update unfreeze script").</div>Kyakhttps://wiki.archlinux.org/index.php?title=User_talk:Kyak&diff=491562User talk:Kyak2017-09-27T15:02:09Z<p>Kyak: /* I just edited summaries */</p>
<hr />
<div>== Edit summaries ==<br />
<br />
Hi Kyak, thanks for your contributions! Can I ask if you see a message like below when trying to save an edit:<br />
<br />
{{Warning|You have not provided an edit summary, which is an enormous help for other users who want to review your changes, see [[ArchWiki:Contributing#The 3 fundamental rules]]. Clicking "Save page" again will break this rule and force saving the page without a summary.}}<br />
<br />
If you don't see it, it's a bug and we should fix it. In any case, can you please follow its advice?<br />
<br />
Cheers :) -- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 11:20, 27 September 2017 (UTC)<br />
<br />
<br />
Hi Kynikos,<br />
<br />
Now sure how do i reply to you.. Perhaps by just editing this section?<br />
I never saw the message that you mentioned. However, i do edit summary. For example, in this very edit, i change the /* Edit summaries */ to /* I just edited summaries */.<br />
<br />
Am i doing it right?</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=491367MATLAB2017-09-26T05:33:11Z<p>Kyak: /* Update unfreeze script */</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017a/cefclient/sys/os/glnxa64}}, namely, as of R2017a:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017a/cefclient/sys/os/glnxa64}}.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017a/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
The steps in [[#Addon manager not working]] may resolve the issue.<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD |<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=490946MATLAB2017-09-22T05:58:09Z<p>Kyak: /* Add information related to R2017b and MATLAB freeze on Help Browser closing */</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017a/cefclient/sys/os/glnxa64}}, namely, as of R2017a:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017a/cefclient/sys/os/glnxa64}}.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017a/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Help browser]].<br />
<br />
=== Live Script Errors ===<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
The steps in [[#Addon manager not working]] may resolve the issue.<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround doesn't work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I've come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
#!/usr/bin/bash<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
inotifywait -m -e CLOSE /path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium/resources.pak |<br />
while read line<br />
do<br />
killall /path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium/jxbrowser-chromium<br />
done<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== Not starting - licensing error===<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
http://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-[[#Activation|activation]] might solve the problem.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=480878MATLAB2017-07-01T11:45:36Z<p>Kyak: /* Troubleshooting */ Add workaround for some dropdown menus</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year,<br />
release names are composed of {{ic|R}}, the year of the release and {{ic|a}} or {{ic|b}}.<br />
Since R2012b MATLAB has only been available for 64-bit Linux. Arch Linux is not officially supported.<br />
[http://www.mathworks.co.uk/support/sysreq/current_release/index.html]<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation Fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
==== Desktop entry ====<br />
<br />
Optionally create a [[desktop entry]]. The MIME type of MATLAB files is {{ic|text/x-matlab}}.<br />
<br />
Start {{ic|matlab}} with:<br />
<br />
* {{ic|-desktop}} to run Matlab without a terminal.<br />
* {{ic|-nosplash}} to prevent the splash screen from showing up.<br />
<br />
In order for icons to appear correctly {{ic|StartupWMClass}} needs to be set in the desktop entry. To find it out start MATLAB, run {{ic|xprop {{!}} grep WM_CLASS}} and select the MATLAB window.<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
{{Remove|R2013b is quite old.}}<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as {{ic|fc-match Helvetica}} returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [http://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]<br />
* [http://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [http://stackoverflow.com/a/19468365/2787723]<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. [https://bugs.archlinux.org/task/54257]<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017a/cefclient/sys/os/glnxa64}}, namely, as of R2017a:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017a/cefclient/sys/os/glnxa64}}.<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
=== Some dropdown menus cannot be selected ===<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=480788MATLAB2017-07-01T07:00:19Z<p>Kyak: /* fix formatting */</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year (generally in March and September) with release names of R20XXa and R20XXb. The MathWorks also provide a discounted [http://www.mathworks.com/academia/students.html Student Version] which is released once a year. Since R2012b MATLAB has only been available for 64-bit Linux. While MATLAB is officially supported on a number of [http://www.mathworks.co.uk/support/sysreq/current_release/index.html?sec=linux Linux distributions], Arch is not officially supported. Despite the lack of official support, installing and using MATLAB on Arch is straight forward.<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation Fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
To create a menu item, we need to get a icon first:<br />
<br />
# curl https://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -o /usr/share/icons/matlab.png<br />
<br />
Then create a new {{ic|.desktop}} file in {{ic|/usr/share/applications}} with following lines (see [[Desktop_entries]] for more info on {{ic|.desktop}} files):<br />
<br />
{{hc|/usr/share/applications/matlab.desktop|<nowiki><br />
#!/usr/bin/env xdg-open<br />
[Desktop Entry]<br />
Type=Application<br />
Icon=/usr/share/icons/matlab.png<br />
Name=MATLAB<br />
Comment=Start MATLAB - The Language of Technical Computing<br />
Exec=matlab -desktop -nosplash<br />
Categories=Development;<br />
MimeType=text/x-matlab;<br />
</nowiki>}}<br />
<br />
The {{ic|Exec}} command line is composed as follows:<br />
<br />
* {{ic|-desktop}} is a flag needed to run Matlab without a terminal.<br />
* {{ic|-nosplash}} is a flag preventing the splash screen from showing and taking up a temporary space in your task bar.<br />
<br />
In order for icons to appear correctly the startup WM class needs to be added to the new {{ic|.desktop}} file. While MATLAB is running, open a teminal window and enter:<br />
<br />
# xprop | grep WM_CLASS<br />
<br />
With xprop running, select the MATLAB window, and add the outputted information to the bottom of the {{ic|.desktop}} file, for example: <br />
<br />
StartupWMClass=MATLAB R2016a - academic use<br />
<br />
You can also put this {{ic|.desktop}} file in the {{ic|~/Desktop}} directory to create a shortcut on your desktop. See also [https://help.ubuntu.com/community/MATLAB].<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
{{bc|# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules}}<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki><br />
}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
{{bc|<nowiki>$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java</nowiki>}}<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package from the [[official repositories]]. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ glxinfo | grep "direct rendering"</nowiki>}}<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
{{bc|<nowiki>$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
{{bc|<nowiki>export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/</nowiki>}}<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as:<br />
{{bc|<nowiki>$ fc-match Helvetica</nowiki>}}<br />
returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null</nowiki>}}<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null</nowiki>}}<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ speaker-test</nowiki>}}<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'</nowiki>}}<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
<span style="color:red"><br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
</span><br />
<br />
is related to bugs [http://www.mathworks.de/support/bugreports/961964 961964] and [http://www.mathworks.com/support/bugreports/1003952 1003952]. In some cases (e.g., bug [http://www.mathworks.de/support/bugreports/961964 961964]) patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 The MathWorks], while in others (e.g., bug [http://www.mathworks.com/support/bugreports/1003952 1003952]) work arounds exist. A more general solution of recompiling {{ic|glibc}} has also been [http://stackoverflow.com/a/19468365/2787723 suggested].<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. See also https://bugs.archlinux.org/task/54257.<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in matlabroot/R2017a/cefclient/sys/os/glnxa64, namely, as of R2017a:<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in matlabroot/R2017a/cefclient/sys/os/glnxa64<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
<br />
To fix this issue, download latest jxbrowser from https://www.teamdev.com/jxbrowser and replace the following jars from MATLAB:<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into matlabroot/sys/jxbrowser-chromium/glnxa64/chromium when first opening Help Browser. Remove matlabroot/sys/jxbrowser-chromium/glnxa64/chromium directory to make sure MATLAB uses the latest jxbrowser.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=480786MATLAB2017-07-01T05:47:51Z<p>Kyak: /* Note on using gstreamer in recent MATLAB */</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year (generally in March and September) with release names of R20XXa and R20XXb. The MathWorks also provide a discounted [http://www.mathworks.com/academia/students.html Student Version] which is released once a year. Since R2012b MATLAB has only been available for 64-bit Linux. While MATLAB is officially supported on a number of [http://www.mathworks.co.uk/support/sysreq/current_release/index.html?sec=linux Linux distributions], Arch is not officially supported. Despite the lack of official support, installing and using MATLAB on Arch is straight forward.<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation Fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
To create a menu item, we need to get a icon first:<br />
<br />
# curl https://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -o /usr/share/icons/matlab.png<br />
<br />
Then create a new {{ic|.desktop}} file in {{ic|/usr/share/applications}} with following lines (see [[Desktop_entries]] for more info on {{ic|.desktop}} files):<br />
<br />
{{hc|/usr/share/applications/matlab.desktop|<nowiki><br />
#!/usr/bin/env xdg-open<br />
[Desktop Entry]<br />
Type=Application<br />
Icon=/usr/share/icons/matlab.png<br />
Name=MATLAB<br />
Comment=Start MATLAB - The Language of Technical Computing<br />
Exec=matlab -desktop -nosplash<br />
Categories=Development;<br />
MimeType=text/x-matlab;<br />
</nowiki>}}<br />
<br />
The {{ic|Exec}} command line is composed as follows:<br />
<br />
* {{ic|-desktop}} is a flag needed to run Matlab without a terminal.<br />
* {{ic|-nosplash}} is a flag preventing the splash screen from showing and taking up a temporary space in your task bar.<br />
<br />
In order for icons to appear correctly the startup WM class needs to be added to the new {{ic|.desktop}} file. While MATLAB is running, open a teminal window and enter:<br />
<br />
# xprop | grep WM_CLASS<br />
<br />
With xprop running, select the MATLAB window, and add the outputted information to the bottom of the {{ic|.desktop}} file, for example: <br />
<br />
StartupWMClass=MATLAB R2016a - academic use<br />
<br />
You can also put this {{ic|.desktop}} file in the {{ic|~/Desktop}} directory to create a shortcut on your desktop. See also [https://help.ubuntu.com/community/MATLAB].<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
{{bc|# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules}}<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki><br />
}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
{{bc|<nowiki>$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java</nowiki>}}<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package from the [[official repositories]]. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ glxinfo | grep "direct rendering"</nowiki>}}<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
{{bc|<nowiki>$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
{{bc|<nowiki>export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/</nowiki>}}<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as:<br />
{{bc|<nowiki>$ fc-match Helvetica</nowiki>}}<br />
returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null</nowiki>}}<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null</nowiki>}}<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ speaker-test</nowiki>}}<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'</nowiki>}}<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
<span style="color:red"><br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
</span><br />
<br />
is related to bugs [http://www.mathworks.de/support/bugreports/961964 961964] and [http://www.mathworks.com/support/bugreports/1003952 1003952]. In some cases (e.g., bug [http://www.mathworks.de/support/bugreports/961964 961964]) patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 The MathWorks], while in others (e.g., bug [http://www.mathworks.com/support/bugreports/1003952 1003952]) work arounds exist. A more general solution of recompiling {{ic|glibc}} has also been [http://stackoverflow.com/a/19468365/2787723 suggested].<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. See also https://bugs.archlinux.org/task/54257.<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in matlabroot/R2017a/cefclient/sys/os/glnxa64, namely, as of R2017a:<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in matlabroot/R2017a/cefclient/sys/os/glnxa64<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
<br />
To fix this issue, download latest jxbrowser from https://www.teamdev.com/jxbrowser and replace the following jars from MATLAB:<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into matlabroot/sys/jxbrowser-chromium/glnxa64/chromium when first opening Help Browser. Remove matlabroot/sys/jxbrowser-chromium/glnxa64/chromium directory to make sure MATLAB uses the latest jxbrowser.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=480785MATLAB2017-07-01T05:46:01Z<p>Kyak: /* Added workaround for recent pango upgrade */</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year (generally in March and September) with release names of R20XXa and R20XXb. The MathWorks also provide a discounted [http://www.mathworks.com/academia/students.html Student Version] which is released once a year. Since R2012b MATLAB has only been available for 64-bit Linux. While MATLAB is officially supported on a number of [http://www.mathworks.co.uk/support/sysreq/current_release/index.html?sec=linux Linux distributions], Arch is not officially supported. Despite the lack of official support, installing and using MATLAB on Arch is straight forward.<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation Fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
To create a menu item, we need to get a icon first:<br />
<br />
# curl https://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -o /usr/share/icons/matlab.png<br />
<br />
Then create a new {{ic|.desktop}} file in {{ic|/usr/share/applications}} with following lines (see [[Desktop_entries]] for more info on {{ic|.desktop}} files):<br />
<br />
{{hc|/usr/share/applications/matlab.desktop|<nowiki><br />
#!/usr/bin/env xdg-open<br />
[Desktop Entry]<br />
Type=Application<br />
Icon=/usr/share/icons/matlab.png<br />
Name=MATLAB<br />
Comment=Start MATLAB - The Language of Technical Computing<br />
Exec=matlab -desktop -nosplash<br />
Categories=Development;<br />
MimeType=text/x-matlab;<br />
</nowiki>}}<br />
<br />
The {{ic|Exec}} command line is composed as follows:<br />
<br />
* {{ic|-desktop}} is a flag needed to run Matlab without a terminal.<br />
* {{ic|-nosplash}} is a flag preventing the splash screen from showing and taking up a temporary space in your task bar.<br />
<br />
In order for icons to appear correctly the startup WM class needs to be added to the new {{ic|.desktop}} file. While MATLAB is running, open a teminal window and enter:<br />
<br />
# xprop | grep WM_CLASS<br />
<br />
With xprop running, select the MATLAB window, and add the outputted information to the bottom of the {{ic|.desktop}} file, for example: <br />
<br />
StartupWMClass=MATLAB R2016a - academic use<br />
<br />
You can also put this {{ic|.desktop}} file in the {{ic|~/Desktop}} directory to create a shortcut on your desktop. See also [https://help.ubuntu.com/community/MATLAB].<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
{{bc|# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules}}<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki><br />
}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
{{bc|<nowiki>$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java</nowiki>}}<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package from the [[official repositories]]. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ glxinfo | grep "direct rendering"</nowiki>}}<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
{{bc|<nowiki>$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
{{bc|<nowiki>export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/</nowiki>}}<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as:<br />
{{bc|<nowiki>$ fc-match Helvetica</nowiki>}}<br />
returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null</nowiki>}}<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null</nowiki>}}<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ speaker-test</nowiki>}}<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'</nowiki>}}<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
<span style="color:red"><br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
</span><br />
<br />
is related to bugs [http://www.mathworks.de/support/bugreports/961964 961964] and [http://www.mathworks.com/support/bugreports/1003952 1003952]. In some cases (e.g., bug [http://www.mathworks.de/support/bugreports/961964 961964]) patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 The MathWorks], while in others (e.g., bug [http://www.mathworks.com/support/bugreports/1003952 1003952]) work arounds exist. A more general solution of recompiling {{ic|glibc}} has also been [http://stackoverflow.com/a/19468365/2787723 suggested].<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. See also https://bugs.archlinux.org/task/54257.<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in matlabroot/R2017a/cefclient/sys/os/glnxa64, namely, as of R2017a:<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in matlabroot/R2017a/cefclient/sys/os/glnxa64<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
<br />
To fix this issue, download latest jxbrowser from https://www.teamdev.com/jxbrowser and replace the following jars from MATLAB:<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into matlabroot/sys/jxbrowser-chromium/glnxa64/chromium when first opening Help Browser. Remove matlabroot/sys/jxbrowser-chromium/glnxa64/chromium directory to make sure MATLAB uses the latest jxbrowser.</div>Kyakhttps://wiki.archlinux.org/index.php?title=MATLAB&diff=480784MATLAB2017-07-01T05:31:22Z<p>Kyak: /* Add notes on MATLAB hang in R2017a when closing Help Browser */</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[[ja:Matlab]]<br />
{{Related articles start}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
{{Poor writing|unnecessarily verbose}}<br />
From the [http://www.mathworks.com/products/matlab/ official website]:<br />
<br />
:''MATLAB is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB, you can analyze data, develop algorithms, and create models and applications. The language, tools, and built-in math functions enable you to explore multiple approaches and reach a solution faster than with spreadsheets or traditional programming languages, such as C/C++ or Java.''<br />
<br />
== Overview ==<br />
<br />
MATLAB is proprietary software produced by The MathWorks and requires a license to obtain, install, and activate. New versions of MATLAB are released twice a year (generally in March and September) with release names of R20XXa and R20XXb. The MathWorks also provide a discounted [http://www.mathworks.com/academia/students.html Student Version] which is released once a year. Since R2012b MATLAB has only been available for 64-bit Linux. While MATLAB is officially supported on a number of [http://www.mathworks.co.uk/support/sysreq/current_release/index.html?sec=linux Linux distributions], Arch is not officially supported. Despite the lack of official support, installing and using MATLAB on Arch is straight forward.<br />
<br />
== Installation ==<br />
<br />
A complete copy of the MATLAB software must be obtained before it can be installed. The MATLAB software is available to licenses holders on both a DVD and through the [http://www.mathworks.com The MathWorks website]. In addition to the software a file installation key is required for installation. It is possible to install MATLAB either with the {{aur|matlab}} package from the [[AUR]] or from the MATLAB installation software directly. The advantage of the {{aur|matlab}} package is that it manages dependencies and some of the nuances of the installation process while installing directly from the MATLAB installation software can be done by regular users to their home directories and works for any release of MATLAB (the {{aur|matlab}} package only works for releases including and after R2010b).<br />
<br />
=== Installing from the MATLAB installation software ===<br />
<br />
The MATLAB installation software is self contained and does not require any additional packages to install in silent mode. To install with the GUI a working [[Xorg]] graphical display is necessary. The installation is handled by the {{ic|install}} script. You can run the script as root to install MATLAB system-wide or your user to install it only for you.<br />
<br />
MATLAB 2016a and earlier is not compatible with {{Pkg|ncurses}} 6, so you must install the {{AUR|ncurses5-compat-libs}} package. See [[#Segmentation Fault on startup]] for more info.<br />
<br />
During the installation, you are asked if you want symlinks to be created. If you did not choose to do so, you can now manually create a symlink in {{ic|/usr/local/bin}} to make it easier to launch in terminal:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
To create a menu item, we need to get a icon first:<br />
<br />
# curl https://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -o /usr/share/icons/matlab.png<br />
<br />
Then create a new {{ic|.desktop}} file in {{ic|/usr/share/applications}} with following lines (see [[Desktop_entries]] for more info on {{ic|.desktop}} files):<br />
<br />
{{hc|/usr/share/applications/matlab.desktop|<nowiki><br />
#!/usr/bin/env xdg-open<br />
[Desktop Entry]<br />
Type=Application<br />
Icon=/usr/share/icons/matlab.png<br />
Name=MATLAB<br />
Comment=Start MATLAB - The Language of Technical Computing<br />
Exec=matlab -desktop -nosplash<br />
Categories=Development;<br />
MimeType=text/x-matlab;<br />
</nowiki>}}<br />
<br />
The {{ic|Exec}} command line is composed as follows:<br />
<br />
* {{ic|-desktop}} is a flag needed to run Matlab without a terminal.<br />
* {{ic|-nosplash}} is a flag preventing the splash screen from showing and taking up a temporary space in your task bar.<br />
<br />
In order for icons to appear correctly the startup WM class needs to be added to the new {{ic|.desktop}} file. While MATLAB is running, open a teminal window and enter:<br />
<br />
# xprop | grep WM_CLASS<br />
<br />
With xprop running, select the MATLAB window, and add the outputted information to the bottom of the {{ic|.desktop}} file, for example: <br />
<br />
StartupWMClass=MATLAB R2016a - academic use<br />
<br />
You can also put this {{ic|.desktop}} file in the {{ic|~/Desktop}} directory to create a shortcut on your desktop. See also [https://help.ubuntu.com/community/MATLAB].<br />
<br />
=== Installing from the AUR package ===<br />
<br />
The EULA for the proprietary MATLAB software is restrictive. The {{aur|matlab}} package from the [[AUR]] is designed to allow MATLAB to be integrated into and managed by Arch. The package should be built on the system on which it is going to be installed and the package should be deleted from the installation location and the [[Pacman]] cache following installation. Distributing the package is a clear violation of the EULA.<br />
<br />
The {{aur|matlab}} package from the [[AUR]] defaults to building a package for the most recent 64-bit release of MATLAB, although the PKGBUILD supports MATLAB releases from R2010b and even the installation of multiple releases simultaneous. The PKGBUILD defaults to installing all toolboxes that the file identification key allows, however, the PKGBUILD can be edited to include only a subset of the toolboxes. The selection of the toolboxes must be finalized at the time of package creation due to DRM policies put in place by The MathWorks. The {{aur|matlab}} package from the [[AUR]] requires that both the MATLAB installation software and the file installation key are available in the source directory. The file installation key must be in a file called {{ic|matlab.fik}} and the installation software must be in an iso file called {{ic|matlab.iso}}. Once the iso file and file installation key are created, the MATLAB package can be created and install as usual.<br />
<br />
For MATLAB releases between r2010b and r2011a the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. If the MATLAB download agent is used to download the installation software, then the iso file can be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory.<br />
<br />
For MATLAB releases including and after r2011b the contents of the iso file must include: {{ic|./archives/}}, {{ic|./bin/}}, {{ic|./etc/}}, {{ic|./help/}}, {{ic|./java/}}, {{ic|./activate.ini}}, {{ic|./install}}, and {{ic|./installer_input.txt}}. For version before r2014a, the MATLAB download agent could download all the required files and the iso file could be trivially created by simply running {{ic|mkisofs -r -o}} on the download directory. For MATLAB releases including and after r2014a the MATLAB download agent only downloads the MATLAB installer. The MATLAB installer then needs to be run to downloaded the MATLAB software and toolboxes. Therefore, a two step process is required to generate this iso file with the MATLAB download agent. First, you download and run the MATLAB installer to install MATLAB in a temporary directory. This process downloads the MATLAB software and toolboxes by default to {{ic|~/Downloads/MathWorks}} (this can be changed by passing the flag {{ic|-downloadFolder /path/to/directory}}). It is actually possible quit the MATLAB installer once the software and toolboxes are downloaded. Once the software and toolboxes are downloaded the required iso file can be created by merging the installer directory (containing above mentioned files) and the download directory (containing {{ic|./archives/}}), and then running {{ic|mkisofs -r -o}} on the resulting directory.<br />
<br />
== Activation ==<br />
<br />
In order to run MATLAB it requires a license file to be installed. The license file can be generated with {{ic|$MATLABROOT/bin/activate_matlab.sh}} or downloaded from [http://www.mathworks.com MATLAB] directly. <br />
<br />
=== R2013b and earlier ===<br />
<br />
Up to and including R2013b the license file was linked to the MAC address of eth0. This causes problems with the [[Network_configuration#Device_names|Predictable Network Interface Names]] used by Arch Linux. It is possible to disable predictable network interface names by adding {{ic|1=net.ifnames=0}} in your kernel command line or by creating a udev rule file<br />
<br />
{{bc|# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules}}<br />
<br />
It is also possible to [[Network_configuration#Change_device_name|change the name of a device]], but changing the name to eth0 can result in race conditions between the kernel and udev during boot. Another solution is to create a dummy network interface named eth0 with the MAC address linked to the license file. First, get that MAC address using {{ic|ip link}}. Next, create the following file:<br />
<br />
{{hc|/etc/systemd/system/matlab.licensing.service|<nowiki><br />
[Unit]<br />
Description=Dummy network interface for MATLAB<br />
Requires=systemd-modules-load.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/sbin/ip link set dev dummy0 name eth0<br />
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki><br />
}}<br />
<br />
Replace 00:00:00:00:00:00 with the MAC address linked to the license file.<br />
<br />
Then make the script run on boot:<br />
<br />
# systemctl enable matlab.licensing<br />
<br />
Finally, set the dummy module to load on boot by creating the following file:<br />
<br />
{{hc|/etc/modules-load.d/dummy.conf|<nowiki>dummy</nowiki>}}<br />
<br />
== Configuration ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version bundled with MATLAB typically lags behind {{pkg|jre7-openjdk}} from the [[official repositories]] and it is possible, although not required, to use the {{ic|MATLAB_JAVA}} environment variable to specify the path of an alternative JRE. For example, to specify the {{pkg|jre7-openjdk}} JRE and check the resulting version of Java, do:<br />
<br />
{{bc|<nowiki>$ MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre matlab -nodesktop -nosplash -r "version -java, exit" | grep Java</nowiki>}}<br />
<br />
{{Accuracy|overly specific, yet no references to claimed behaviour}}<br />
<br />
Using alternative JRE would often solve some long-standing problems, such as the extra "{{ic|MEvent. CASE!}}" string when doing two-finger scrolling using touchpad. Another problem that can be solved in this way is the ugly, limited fonts provided by default, especially for some Chinese characters.<br />
<br />
=== OpenGL acceleration ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package from the [[official repositories]]. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ glxinfo | grep "direct rendering"</nowiki>}}<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
{{bc|<nowiki>$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software</nowiki>}}<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
{{bc|<nowiki>export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/</nowiki>}}<br />
<br />
=== Fonts for figures ===<br />
<br />
{{Note| This section only applies to R2014a and earlier as starting with R2014b MATLAB uses True Type Fonts. So as long as:<br />
{{bc|<nowiki>$ fc-match Helvetica</nowiki>}}<br />
returns a font, figure fonts should work as expected.}}<br />
<br />
While MATLAB can be run in a text only mode, it also provides advanced graphics capabilities. To confirm that MATLAB is making use of the system fonts run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "xlabel('BIG FONT', 'FontSize', 42); ylabel('small font', 'FontSize', 12); pause; exit" > /dev/null</nowiki>}}<br />
<br />
This should produce a MATLAB figure with "BIG FONT" in a large font on the abscissa and "small font" in a small font on the ordinate. If "BIG FONT" and "small font" are both the same size, refer to [[Xorg#Program_requests_.22font_.27.28null.29.27.22|Xorg fonts]] to confirm that the correct the bitmap font package (either {{Pkg|xorg-fonts-100dpi}} or {{Pkg|xorg-fonts-75dpi}} from the [[official repositories]]) is installed on your system.<br />
<br />
=== Sound ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null</nowiki>}}<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
{{bc|<nowiki>$ speaker-test</nowiki>}}<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU computing ===<br />
<br />
MATLAB can take advantage of [http://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
{{bc|<nowiki>$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'</nowiki>}}<br />
<br />
=== Install supported compilers ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [http://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [http://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
=== Help browser ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
== Troubleshooting ==<br />
<br />
=== Static TLS errors ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
<span style="color:red"><br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
</span><br />
<br />
is related to bugs [http://www.mathworks.de/support/bugreports/961964 961964] and [http://www.mathworks.com/support/bugreports/1003952 1003952]. In some cases (e.g., bug [http://www.mathworks.de/support/bugreports/961964 961964]) patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 The MathWorks], while in others (e.g., bug [http://www.mathworks.com/support/bugreports/1003952 1003952]) work arounds exist. A more general solution of recompiling {{ic|glibc}} has also been [http://stackoverflow.com/a/19468365/2787723 suggested].<br />
<br />
=== MATLAB crashes when displaying graphics ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Archlinux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using DWM/Awesome ===<br />
<br />
[http://tools.suckless.org/wmname wmname] is a utility to set the window manager name of the root window.<br />
<br />
wmname LG3D<br />
<br />
Then start Matlab.<br />
<br />
=== Garbled or invisible text ===<br />
<br />
Set the environment variable <code>J2D_D3D</code> to <code>false</code>[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting <code>MATLAB_JAVA</code> to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Corrupted text and fonts in menus and fields ===<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== Installation ===<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Install-time library errors ===<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you're installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== Resolving start warnings/errors ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Segmentation fault on startup ===<br />
<br />
If Matlab stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
=== Hangs on rendering or exiting with Intel graphics ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== Addon manager not working ===<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2016b)<br />
<br />
=== Using webcam/video device ===<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed. <br />
<br />
At least Matlab 2016b doesn't recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
=== MATLAB hangs for several minutes when closing Help Browser ===<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
<br />
To fix this issue, download latest jxbrowser from https://www.teamdev.com/jxbrowser and replace the following jars from MATLAB:<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into matlabroot/sys/jxbrowser-chromium/glnxa64/chromium when first opening Help Browser. Remove matlabroot/sys/jxbrowser-chromium/glnxa64/chromium directory to make sure MATLAB uses the latest jxbrowser.</div>Kyak