Ubuntu 11.04 and MATLAB x64 C, C++ and Fortran libraries

MatLab requires the use of libraries (think translation dictionaries) to run code that is outside of it’s native realm (a hybrid C).

The most common of computing languages are those of C and Fortran (an old machine code).

The problem is that old code runs typically on 32 bit (a way of addressing memory), whereas most modern operating systems are now running 64 bit.

If you run a 64 bit Linux distro then you cannot run 32 bit MATLAB and you will be forced to install and run x64 MATLAB (there are some work around for Windows).

Added complication comes from the fact that you need 32 and 64 bit libraries to run some code. This is due to some of the 64 bit compilers being unable to effectively mimic a 32 bit environment.

The best analogy I can think of is trying to read French in English knowing no French and having only an Ancient Latin dictionary as a reference. But if you then have an Ancient French to Ancient Latin dictionary as well you can have a fair stab at comprehension, even if it’s through Ancient French to Latin to English.

This whole process is further complicated, as by default Ubuntu will not let you have 2 versions of the same library. By installing the 32 bit library you replace the 64 bit.

In Fedora it is assumed that whilst the OS is 64 bit you’ll want to use 32 bit libraries. As a result, Fedora has both /usr/lib64 and /usr/lib32.

Ubuntu does not. Ubuntu gives you /usr/lib. What we need to do is install all the 64 bit libraries which is automatically linked, then create a /usr/lib32, install the 32 bit libraries and then symbolically link the 32 bit libraries into /usr/lib. However, we first need to install a repository that gives us the facility to run more than one library, so that the 32 bit links don’t overwrite the 64 bit links.

Go to System > Administration > Symantic Package Manager.

Using the Quick Filter install:

  • gfortran-4.5 (or newer)
  • gfortran-4.5-multilib
  • libgfortran3
  • lib32gfortran3
  • fort77
  • ratfor
  • f2c

Apply these updates and close.

Open a Terminal window. Now we need to install a few other things

Java compiler

sudo apt-get install gcj

GNU autotools

sudo apt-get install autoconf
sudo apt-get install automake

Intel Compiler Suite

sudo apt-get install gcc
sudo apt-get install build-essential
sudo apt-get install libc6-dev
sudo apt-get install ia32-libs
sudo apt-get install g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install alien
sudo apt-get install rpm
sudo apt-get install libstdc++5
sudo apt-get install libstdc++5-3.3-dev

Now everything should be installed. Now we need to install the x32 without overwriting the x64 in /usr/lib. So we need to manually download the library, unpack them and link manually.

So, download the 32 library (link) (Update: latest version is 4.5, give it a Google)

Extract it:

dpkg --extract libstdc++5_3.3.6-18_i386.deb  ./

Change the version number if you’ve downloaded a different version

Note that a /usr folder has been created wherever you downloaded the folder to. We need to now copy this file to /usr/lib32

cd usr/lib
cp libstdc++.so.5.0.7 /usr/lib32

Now link the x32 library to your system

cd /usr/lib32
ln -s libstdc++.so.5.0.7 libstdc++.so.5

Update your system:

sudo apt-get update

Now MATLAB should be working with all the required libraries in 32 and 64 bit.

Referenced from Intel and Ubuntu docs

DeerAnalysis

To further get DeerAnalysis working requires 2 more lines of code in terminal:

cd [path to DeerAnalysis]
gfortran -o ftikreg_r_new.out ftikreg_r_new.f
gfortran -o ftikreg_r_old.out ftikreg_r_old.f

Thanks to Gunnar Jescke

Older post

Peakfinder

What distinguishes you from other developers?

I've built data pipelines across 3 continents at petabyte scales, for over 15 years. But the data doesn't matter if we don't solve the human problems first - an AI solution that nobody uses is worthless.

Are the robots going to kill us all?

Not any time soon. At least not in the way that you've got imagined thanks to the Terminator movies. Sure somebody with a DARPA grant is always going to strap a knife/gun/flamethrower on the side of a robot - but just like in Dr.Who - right now, that robot will struggle to even get out of the room, let alone up some stairs.

But AI is going to steal my job, right?

A year ago, the whole world was convinced that AI was going to steal their job. Now, the reality is that most people are thinking 'I wish this POC at work would go a bit faster to scan these PDFs'.

When am I going to get my self-driving car?

Humans are complicated. If we invented driving today - there's NO WAY IN HELL we'd let humans do it. They get distracted. They text their friends. They drink. They make mistakes. But the reality is, all of our streets, cities (and even legal systems) have been built around these limitations. It would be surprisingly easy to build self-driving cars if there were no humans on the road. But today no one wants to take liability. If a self-driving company kills someone, who's responsible? The manufacturer? The insurance company? The software developer?