From ArchWiki
Revision as of 04:15, 4 April 2012 by Skydiver (Talk | contribs) (General installation: add Create Desktop and Menu Shortcuts)

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Matlab#)

General installation

Use the following commands to mount and install Matlab. Note that the path to the install script should contain no spaces, or the install will fail. For graphical install and interface libxp is needed.

# pacman -S libxp 

Install from iso file

# modprobe loop
# mount -o loop matlab.iso /mnt/
# /mnt/install

Create Desktop and Menu Shortcuts

If you choose Custom in Installation Type, the symlink will be created automatically. Otherwise, you may need to manually create a symlink in /usr/local/bin to make it easier to launch in terminal.

# ln -s /{MATLAB}/bin/matlab /usr/local/bin

To create a menu item, create a new .desktop file in /usr/share/applications with following lines:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=MATLAB R2012a
Comment=Start MATLAB - The Language of Technical Computing
Exec=matlab -desktop

You can also put this .desktop file in Desktop folder to create a shortcut.

Install 32-bit Matlab on 64-bit system

Unfortunately, 32-bit is the only version available to students; 64-bit versions are available if you pay more money. These instructions have been updated for the student r2009A version - however the instructions should work with any current version of Matlab. To start off with we need to install a bunch of lib32 packages, not all found with pacman. Check the AUR for lib32-libxpAUR.

$ pacman -S lib32-mesa
$ pacman -S lib32-glibc
$ pacman -S lib32-libxmu
$ pacman -S lib32-zlib
$ pacman -S lib32-ncurses
$ pacman -S lib32-libxtst
$ pacman -S lib32-libxi
$ pacman -S lib32-libxrender
$ pacman -S lib32-libxfixes
$ pacman -S lib32-freetype2 lib32-fontconfig lib32-libxdamage
$ pacman -S lib32-libxpm

My system is not a fresh install so there may be some other packages needed.

Once they are installed

$ ./install -glnx86

After fixing any library dependency problems, you will be able to guide the installer through the install process. If activation doesn't work in the installer you'll need to login to Wolfram's site and download a license file which you'll put in {MATLAB}/licenses. After the install process, you'll need to create a symbolic link because the installer oddly thinks it's installing the 64-bit version of Matlab:

$ cd {MATLAB}/sys/java/jre
$ ln -s glnx86 glnxa64

In the above, {MATLAB} should be replaced by the root directory you chose for your installation.

You'll also need to put another link in matlab's bin folder because despite asking matlab to install the 32bit version, it still thinks you want to use the 64bit one.

$ cd {MATLAB}/bin
$ ln -s glnx86 glnxa64

After that you'll need to edit the {MATLAB}/bin/matlab script to get the java settings correct. After the comments at the top of the file, you'll need the line

export MATLAB_JAVA={Path of JRE}

Where {Path of JRE} will be /opt/java/jre if you're using Sun's JRE. The path is one level up from where rt.jar is located. That is, rt.jar should be in /opt/java/jre/libs if you used /opt/java/jre for MATLAB_JAVA. In Matlab R2010a it works pretty well, if you use the intern JRE with

export MATLAB_JAVA={Path of Matlab}/sys/java/jre/glnx86/jre

To run it, you'll need to:

$ /{MATLAB}/bin/matlab -glnx86 -desktop

At this point you may have to resolve more library dependencies or troubleshoot Java. Your version of Matlab may need a specific version of Sun's JRE installed.

General Troubleshooting

As one installs matlab, it might complain that there isn't 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.

Resolving start warnings/errors

  • 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 /lib64/ library, this can be resolved by:
# ln -s /lib/ /lib64
  • Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." I had to point Matlab to my system JVM in order to solve the problem (confirmed to work with the jdk7-openjdk package).
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre

OpenGL Acceleration

Once Matlab is installed type the following in the matlab interpreter:

opengl info

The output should be similar to the following:

Version         = 2.0 Mesa 7.8.2
Vendor          = Advanced Micro Devices, Inc.
Renderer        = Mesa DRI R600 (RV710 9552) 20090101 x86/MMX/SSE2 TCL DRI2
MaxTextureSize  = 4096
Visual          = 0xcb (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)
Software        = false
# of Extensions = 107

Driver Bug Workarounds:
OpenGLBitmapZbufferBug    = 0
OpenGLWobbleTesselatorBug = 0
OpenGLLineSmoothingBug    = 0
OpenGLClippedImageBug     = 0
OpenGLEraseModeBug        = 0

This will vary with card you are using, but the important part is "Software = false". If it's not "false" for you, then there is a problem with your hardware acceleration.


With an nVidia card, the output should be similar to this:

>> opengl info
Version         = 2.1.2 NVIDIA 177.82
Vendor          = NVIDIA Corporation
Renderer        = Quadro NVS 140M/PCI/SSE2
MaxTextureSize  = 8192
Visual          = 0x21 (TrueColor, depth 16, RGB mask 0xf800 0x07e0 0x001f)
Software        = false
# of Extensions = 144

Driver Bug Workarounds:
OpenGLBitmapZbufferBug    = 0
OpenGLWobbleTesselatorBug = 0
OpenGLLineSmoothingBug    = 0
OpenGLClippedImageBug     = 1
OpenGLEraseModeBug        = 0

With the nVidia card all it required to start working was to copy the from the matlab installed library /usr/local/matlab/sys/opengl/lib/glnx86/ to /usr/lib directory. Note that in x86_64 this might be a different directory.

Note: Although, not thoroughly tested, using lib32-nvidia-utils seems to work as well.