From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111c93,5ec896f20cf5b478,start X-Google-Attributes: gid111c93,public From: allanb@sparta.apmaths.uwo.ca (Allan B MacIsaac) Subject: Re: MATLAB under Linux/Alpha ? Date: 1998/05/11 Message-ID: <6j5mcv$62l@falcon.ccs.uwo.ca> X-Deja-AN: 352085415 Organization: The University of Western Ontario, London, Ont. Canada Newsgroups: comp.os.linux.alpha I was recently able to get the Digital Unix 4.0 version of matlab 5.1 (and MapleV R5 and Netscape 4.05) to run under Linux. The key was a patch provided by Richard Henderson to help someone who wanted to run the SPEC benchmark suite compiled under Digital Unix on his Alpha running Linux. Below is a long account of the details, which I provided to The Mathworks Inc. After I clean this stuff up, perhaps I'll send a note for inclusion into Alpha FAQ. How to install the Digital Unix 4.0 Version of Matlab under Alpha/Linux 1. Requirements a. You must have legal access to the shared libraries of Digital Unix 4.0 or higher. Copy /sbin/loader from Digital Unix to /sbin/loader on the Linux system. Copy the contents of /usr/shlib from the Digital Unix machine to /usr/shlib on the Linux system. Copy the file /etc/svc.conf from the DU machine to the Linux system. Now you don't really need all the libraries, but I haven't got Matlab installed on a newer DEC Unix box so I can't check which ones it really uses. b. You must have a legal license for Matlab. c. You must have a newer version of the Linux kernel, with the following patch, provided by Richard Henderson. I used kernel 2.1.99, and I'm not sure what kernel version the patch was meant to apply to, but it doesn't apply directly to 2.1.99. This fix ignores a problem in the DEC libraries (I think) In people terms you need to delete the following two lines from the function do_sigreturn in the file /usr/src/linux/arch/alpha/kernel/signal.c if (__get_user(ps, &frame->sc.sc_ps) || ps != 8) goto give_sigsegv; In my 2.1.99 they were at lines 287-288. --- signal.c.orig Fri May 1 14:55:29 1998 +++ signal.c Fri May 1 14:55:59 1998 @@ -301,8 +301,6 @@ do_sigreturn(struct sigframe *frame, str /* Verify that it's a good sigcontext before using it */ if (verify_area(VERIFY_READ, frame, sizeof(*frame))) goto give_sigsegv; - if (__get_user(ps, &frame->sc.sc_ps) || ps != 8) - goto give_sigsegv; if (__get_user(set.sig[0], &frame->sc.sc_mask) || (_NSIG_WORDS > 1 && __copy_from_user(&set.sig[1], &frame->extramask, 2. Funny stuff a. The installation script for Matlab (and Maple V R5 and many packages) uses uname to detect the architecture of the system the script is being run on. Like most vendors when uname returns Linux, they assume x86. Since Linux now runs on Alpha's, Sun's, SGI's, Mac's both M68 and PPC, ARM, etc. this will hopefully change soon. In the mean time we need to work around this assumption. For the Alpha, the work around I use is to replace /bin/uname temporarily with the simple sh script below. One could get fancy and create a script that really mimics the DEC Unix uname, but this works #!/bin/sh echo OSF1 So you should do this as root mv /bin/uname /bin/uname_real cat >/bin/uname #!/bin/sh echo OSF1 ^D (This means hold down the control key and type D.) O.K. now your uname should just return OSF1 and nothing else. and we're ready to follow the install instructions in the Installation Guide for UNIX that The Math Works sent you when you paid them their well earned money. (No joke I think Matlab is worth every penny) 3. By the book. a. Mount the CD mount -t is09660 /dev/cdrom /cdrom b. cd /usr/local c. mkdir matlab5 d. cd matlab5 e. put your license in this directory (/usr/local/matlab5) f. run the install script /cdrom/install -i I've found that the -i is required. It tells matlab to "Ignore the check for disk-space when running setup" I haven't explored the problem in detail, but it is a minor thing. g. Follow the on screen instructions as detailed in your manual 4. Finishing up a. The work around with uname has to be undone. mv /bin/uname_real /bin/uname b. Matlab also checks to see what architecture it is being run on when it starts. It still uses uname, but since the scripts are now editable (is this a word?), we can fix them directly. There are three files we need to edit: $(MATLAB)/etc/util/arch.sh $(MATLAB)/install/arch.sh $(MATLAB)/bin/util/arch.sh The files in the version of Matlab I have are all the same so the fix is the same for all of these files. In these files there are the lines Linux) Arch="lnx86" ;; These three lines need to be replaced by Linux) case `uname -m` in # A DEC Alpha running Linux "alpha") Arch="alpha" ;; # a Sun Sparc running linux # I doubt if this is correct. # I don't have a sparc to test it out "sparc") #�this is the SunOS matlab test. # Linux should have a cleaner way if [ -d /dev/pts ]; then Arch="sol2" else Arch="sun4" fi ;; # the Linux/x86 case --586 Pentium maybe "i586") Arch="lnx86" ;; # the Linux/x86 case --486 "i486") Arch="lnx86" ;; # the Linux/x86 case --386 "i386") Arch="lnx86" ;; # currently do not support any other platforms *) Arch="`/bin/arch`" ;; esac ;; I've only checked to see that this works for Linux/Alpha. The Sun case is most likely wrong. Matlab also checks to see if the version number of your OS is high enough to run the version of Matlab you have. This is the script oscheck.sh in the $(MATLAB)/bin/util directory. This script will tell you that your operating system is not supported, but matlab will run anyway, so I didn't bother to patch this script. 5. You're all done. 6. Other things. a. I did this using a DEMO license graciously provided by Peter Trogos at The Math Works. I make no guarantee that it will work for anyone else. Also I did not install the license manager. When I get my real license I will do that and update this note. I suspect that some combination of the Linux/Intel and Digital Unix procedure will work. -- Dr. Allan B. MacIsaac There once was an old man from Esser, Dept. of Applied Math Whose knowledge grew lesser and lesser. University of Western Ontario It at last grew so small, London, Ontario, Canada That he knew nothing at all, N6A 5B7 And now he's a College Professor.