Size: 12205
Comment: fixed wiki links
|
Size: 12378
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 66: | Line 66: |
For 64-bit machines, you would have to edit line 713 and line 150 of the install and oscheck.sh scripts, respectively. The changes to those lines are as described above. |
MATLAB
Prerequisites
At a minimum, you don't need much to run MATLAB. It will run in the console without X just fine, though naturally missing some functionality such as graphing. Most users, however, use many of the bells and whistles. The Prerequisites section is made with that in mind.
To use the MATLAB desktop, GUIDE, Simulink, and all the nice graphs, you need to have ["Java"] installed, and the executable in your path. If you don't, you'll have to run from a terminal, which isn't always the greatest. A quick way to check to see if you have Java in your path is to open a terminal and type which java. If it comes back with something similar to /usr/local/bin, you're good to go, otherwise you need to follow the instructions in the ["Java"] How-To.
You will get far better performance making complex graphs if you are using hardware rendered openGL. In other words, a videocard. Open up a terminal and run the following command. {{ grep Driver /etc/X11/xorg.conf }} If you have a line that says either fglrx or nvidia, you're in good shape. If you get ati or nv, you need to install the proprietary drivers for your card. If you get vesa, i810, or something else, you probably don't have a video card, and will just have to accept lower performance.
Installing MATLAB
MATLAB's install script will not run from a mounted cdrom. Oddly, this is not due to default settings mounting cd-drives with -noexec, but some mystical and poorly understood voodoo. The cure is to copy the disk to your harddrive, and then run the install. To copy the disk, open a terminal and type the following
sudo cp -R /media/cdrom0 /tmp/matlab
Once that's done copying over, in the terminal type
sudo sh /tmp/matlab/install_unix.sh
It will then launch the GUI installer. For your root directory, enter /usr/local/matlab, and agree to make the directory. Then click the box labelled Create symbolic links to MATLAB and mex scripts, and select /usr/local/bin. Continue with the OK buttons until it starts to install. Once it is installed, running the command matlab will launch the MATLAB UI.
You can pass additional options to start MATLAB, in the format matlab -option. Here are a few of the most popular ones.
-nodesktop Start MATLAB in a console, without the GUI - much faster loading. -nosplash Don't show that annoying MATLAB splash screen as it loads. -nojvm Do not start Java support. This also causes -nodesktop. -r "command" Start MATLAB and execute the given command. -h Show more MATLAB options.
An example command would be matlab -nojvm -nosplash -r "1+1"
Missing cellfun.mexglx (and other files)
If you are installing Matlab (Version 7.0.1.24704 (R14) Service Pack 1) on a x86 machine with Ubuntu (Breezy Badger) there could be some problems with the permissions on file /etc/libc.so.6, which, by default, does not have executable permission and does not behave like it is expected by some scripts. When some scripts (install and startup scripts) try to query the version of the libc file, they are returned empty strings. Possibly because of this issue, some of the mexglx files are not installed and when matlab starts up, the script ${matlab_dir}/bin/util/oscheck.sh also reports the following error.
/opt/matlab/bin/util/oscheck.sh: line 134: /lib/libc.so.6: Permission denied
The file ${matlab_dir}/toolbox/matlab/datatypes/cellfun.mexglx was not installed and this could cause problems when trying to execute a simple command such as ls, for e.g.,
>> ls ??? Attempt to execute SCRIPT cellfun as a function. Error in ==> iscellstr at 13 res = cellfun('isclass',s,'char'); Error in ==> ls at 16 if iscellstr(varargin)
One way to solve this would be to modify two lines in the scripts ${matlab_dir}/bin/util/oscheck.sh as well as in the script ${matlab_install_cd}/install. Line 697 of ${matlab_install_cd}/install
ver=`strings /lib/libc.so.6 | head -n 1 | sed -e "s/^[^0-9]*//" -e "s/[ ,].*$//"`
and line 134 of ${matlab_dir}/bin/util/oscheck.sh
ver=`/lib/libc.so.6 | head -n 1 | sed -e "s/^[^0-9]*//" -e "s/[ ,].*$//"
need to be replaced with the line
ver=`strings /lib/libc.so.6 | grep "GNU C Library" | sed -e "s/^[^0-9]*//" -e "s/[ ,].*$//"`
For 64-bit machines, you would have to edit line 713 and line 150 of the install and oscheck.sh scripts, respectively. The changes to those lines are as described above.
The need to edit an install script will necessitate copying the CD to the hard disk as described in a previous section. A more detailed explanation can be found [http://www.cfar.umd.edu/users/aravinds/tools.html#install_matlab here]. This could help explain other problems with other missing or improperly linked .mexglx files.
Symbolic Toolkit Doesn't Work
To see if you're affected by this, either look at your MATLAB box and see if it says R13, or run the command vpa(pi,64). If it gives you the following error message
Unable to load mex file: /usr/local/matlab/toolbox/symbolic/maplemex.mexglx. /usr/local/matlab/bin/glnx86/libmaple.so: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference ??? Invalid MEX-file
You have the infamamously annoying NPTL bug. First, open up your text editor to the script which launches MATLAB. A good way to do that is
sudo gedit `which matlab`
Note the ` is not '. Go past to the first line that doesn't have a # in front of it - should be around 136. Add the line export LD_ASSUME_KERNEL=2.4.1, so that your file looks something like this:
#__________________________________________________________________________ # export LD_ASSUME_KERNEL=2.4.1 arg0_=$0 # # Temporary file that hold MATLABPATH code from .matlab6rc.sh file. # temp_file=/tmp/$$a # trap "rm -f $temp_file; exit 1" 1 2 3
Now save and close your editor, and try again. If you want to double check that it worked, at the MATLAB command prompt run getenv('LD_ASSUME_KERNEL'), if it says 2.4.1 you're set.
OpenGL and MATLAB
If you are having problems with openGL doing stupid things like rendering surface patches in the wrong order, or getting errors saying that OpenGL not available, using ZBuffer, and are using a version older than R14SP2, then you might have to do a bit of work to get things running right. The source for most of the thinking in this part is [http://www.mathworks.com/support/solutions/data/1-18N21.html?solution=1-18N21 MathWorks]
Once you've gotten the MATLAB desktop up and running, at the prompt enter the opengl info command, as in the following example:
>> opengl info Version = 2.0.0 NVIDIA 76.64 Vendor = NVIDIA Corporation Renderer = GeForce FX 5200/PCI/SSE2 MaxTextureSize = 4096 Extensions = GL_ARB_depth_texture GL_ARB_fragment_program GL_ARB_fragment_program_shadow ...
Your results will most likely be different, but the important part is the Renderer line. In my example, it shows the name of the graphics card that will do the work. If you are using software rendering, that line will read Mesa X11. If you have a graphics card and are not getting hardware acceleration, you probably need to use the manufacturers drivers, which is well documented elsewhere.
If it's not the drivers for your videocard, open up a terminal and run the following command:
ldd /usr/local/matlab/bin/glnx86/glren.so
The output of that command will show you if the openGL library files are all where expected. Here is a sample output of a working configuration.
$ldd /usr/local/matlab/bin/glnx86/glren.so libmx.so => not found libut.so => not found libmwudd.so => not found libmwservices.so => not found libGL.so => /usr/lib/libGL.so (0xb7f45000) libGLU.so => /usr/X11R6/lib/libGLU.so (0xb7ecf000) libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0xb7ec2000) libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0xb7eba000) libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0xb7e6a000) libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0xb7da5000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c78000) libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0xb750f000) libnvidia-tls.so.1 => /usr/lib/tls/libnvidia-tls.so.1 (0xb750d000) libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb74ec000) libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb74e8000) libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0xb742e000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7423000) libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0xb741a000) libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0xb7402000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
If you are missing an important lib on that list, but it is installed, then you need to create a symlink to it. Lets say that you saw this line, libGL.so => not found. In a terminal you would run the following commands:
cd /usr/local/matlab/sys/opengl/lib/glnx86 dpkg -S libGL.so ln -s /usr/lib/libGL.so libGL.so
The odds of you having this problem is fairly low if you are using the proper drivers for your videocard. If you cannot find the missing library, try to find and install it using apt-cache search <term>, where <term> is something like libXt.
If things still aren't working well, but do work kinda, the problem is probably MATLAB being silly and not using the right XVisual. We test this by opening up the MATLAB desktop and running the following code
hf=figure; set(hf,'renderer','opengl'); get(hf,'xvisual')
This will return a string, such as 0x21 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff). We use this to check against glxinfo, to make sure MATLAB isn't being stupid.
glxinfo | grep 0x21 | awk '{print $15}'
If it returns 24 (matching the depth in the string MATLAB gave us), then everything is okay. If it is set to 0, you need to find another value for XVisual. The easiest way to do this is to play a bit with glxinfo.
glxinfo | grep tc | grep y
Pick one that doesn't have Slow in the last column - and preferably None, and has 24 in the 15th column. Here is a sample output.
0x21 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 0 0 None 0x23 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 0 0 None 0x26 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 0 0 None 0x27 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 0 0 None 0x2a 24 tc 0 32 0 r y . 8 8 8 0 4 16 0 16 16 16 16 0 0 None 0x2b 24 tc 0 32 0 r y . 8 8 8 8 4 16 0 16 16 16 16 0 0 None 0x2e 24 tc 0 32 0 r y . 8 8 8 0 4 0 0 16 16 16 16 0 0 None 0x2f 24 tc 0 32 0 r y . 8 8 8 8 4 0 0 16 16 16 16 0 0 None 0x32 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon 0x33 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon 0x34 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon 0x35 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon 0x3a 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon 0x3b 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon 0x3c 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon 0x3d 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 4 1 Ncon 0x42 24 tc 0 32 0 r y . 8 8 8 0 4 16 0 16 16 16 16 2 1 Ncon 0x43 24 tc 0 32 0 r y . 8 8 8 8 4 16 0 16 16 16 16 2 1 Ncon 0x44 24 tc 0 32 0 r y . 8 8 8 0 4 16 0 16 16 16 16 4 1 Ncon 0x45 24 tc 0 32 0 r y . 8 8 8 8 4 16 0 16 16 16 16 4 1 Ncon
Lets say we chose 0x26 to use for XVisual. To set this value in MATLAB, simply run
set(0,'defaultfigurexvisual','0x26');
Add that to your startup.m file, and you should hopefully have nice openGL graphs.