# How To: Installing MATLAB



## gianD748 (Jan 7, 2010)

I have collect in one text all the suggestions that I found useful to install MATLAB on BSD systems. I hope that this should help other people that could have had the same problem. Actually, sometimes, too many posts are more confusing than one that contains ALL the steps that one ctually needs to install Matlab. 

Installing MATLAB on BSD systems:

1) The computer misses the "sse2" flag that is not found in /compat/linux/proc/cpuinfo. This causes the failing of the installation. To avoid this problem the following patch must be used (http://lists.freebsd.org/pipermail/freebsd-questions/2009-July/202248.html):

In the â€œinstallâ€ program the line:


```
expr "`cat /proc/cpuinfo`" : '.* sse2 .*$'
```

has to be replaced by:


```
#expr "`cat /proc/cpuinfo`" : '.* sse2 .*$'
echo 1
```

2) to avoid further problems like 


```
There was an unexpected exception. See the log file (/tmp/aws.log) for more details. (Jan 04, 2010 
12:58:56)java.lang.UnsatisfiedLinkError: /usr/compat/linux/usr/local/matlab/bin/glnx86/libinstutil.so: libstdc++.so.6: cannot handle TLS data " (**)
```

the following changes must be applied:

-> Remove all linux* ports already installed with: `pkg_delete linux`

-> Add to /etc/sysctl.conf file the following line: 
	
	



```
compat.linux.osrelease=2.6.16
```

-> Matlab program probably also needs linprocfs mounted, so add to /etc/fstab file the following line:

```
linprocfs        /compat/linux/proc linprocfs               rw        0        0
```

-> Reboot.

->  Add to the file /etc/make.conf the following two lines


```
OVERRIDE_LINUX_BASE_PORT=f10
OVERRIDE_LINUX_NONBASE_PORTS=f10
```

-> Install emulators/linux_base-f10
-> Install f10 versions of the linux* ports if you need them, e.g. instead of graphics/linux-png install graphics/linux-f10-png if you need it. 

3) to avoid problems with libc.so.6 (and related) do the following:

-> create the following symlink: `ln -s ../usr/bin/expr /compat/linux/bin/expr`

-> For the error about libXp.so.6, check if you have the port x11/linux-f10-xorg-libs installed. If not, install it.

4) Now follow the instruction presented in: http://www.freebsd.org/doc/en/books/handbook/linuxemu-matlab.html, limiting
to 10.5.1 and 10.5.2 paragraphs.

Now you have installed  Matlab. Before running it you have to do some patches to avoid futher â€œSSE2 checking problemsâ€. From
http://www.mail-archive.com/freebsd-questions@freebsd.org/msg214774.html, do the following steps:

-> In ldd and mexext files  replace the word â€œLinux)â€ with â€œFreeBSD)â€

-> In matlab file, replace  #!/bin/sh with #!/usr/compat/linux/bin/sh

-> In mbuild and util/oscheck.sh files, add an echo 1 line after the cpuinfo/sse2 line.

Now, finally, you can run Matlab! Do not care of the error message that it display since the program runs correctly anyway.


----------



## DutchDaemon (Jan 7, 2010)

I have rewritten your entire post. Please use proper posting tags to make your posts readable.


----------



## gianD748 (Jan 14, 2010)

*thanks a lot*

thank you very much for your help and excuse me for the problem that my inexperience has caused.

sorry again


----------

