Running Fortran on ARM

Generally and very briefly, there is no official Fortran compiler available for the ARM architecture. The easiest way to get Fortran code (specifically Fortran 77) to run on the ARM architecture, or any other architecture that doesn’t have a Fortran compiler, is to convert the Fortran code to C. In order to do that efficiently, we can use Netlib’s f2c command line tool, available for Linux, Unix and Windows.

The steps that need to be followed are:

1) Compile the library – source at
Rename makefile.u to makefile and do make. Copy the generated libf2c.a to /usr/lib and the f2c.h header under /usr/include.
2) Compile the binary – source at
Rename makefile.u to makefile and do make. Copy the binary f2c under /usr/local/bin.

Supposing we have the foo.f file we can generate the C version by running f2c foo.f, giving us foo.c. It can now be compiled using ‘gcc foo.c -o foo -lf2c‘.

In order to automate this process a while, the following script can be used. It accepts only one argument, the Fortran source file.

fileName=`echo $1 | sed 's/\(.*\)\..*/\1/'`
echo $fileName
f2c $fortranFile
gcc ${fileName}.c -o $fileName -lf2c

UPDATE: There is GCC Fortran compiler for ARM Fedora and Debian and I presume for other distros as well. The issue now is that these distributions are compiled for ARMv5, while the latest ARM processors (Cortex-A8, A9, A15) are of the ARMv7 architecture. The compilers, and the OS in general is therefore unable to make use of the additional instructions sets and FPU. Other distros, such as Slackware, are compiled on even older architecture, ARMv4.


Microsoft Academic Alliance: For the sake of education?

At the current year we start getting ours hands on .NET Framework. Because the university is a member of the Microsoft Academic Alliance, we can get some full suites of expensive MS software at no charge in order to get our university work done as well as for any non-commercial projects of our own. But for the students to get the software for free, the university must first pay a fee to Microsoft. The university gets fees from the students anyway, so we could say that the fees include these extra fess.

The list of the software contains Visual Studio 2008 Professional Edition, MS SQL Server 2008, Express Studio Developer Edition, Windows 2008 Server and others. Of course, from a student (who is obliged to work with these technologies) point of view, that’s of great help to get his work done and see what these technologies can offer and how they work.

Some of these are notable. Visual Studio is a nice environment for developing applications. However, Visual Basic is a bit awful, ASP is ok and C# is a copy of Java, C++ and C filled with some annoyances here and there but these could be found in every programming language I guess. A very positive thing I must admit, is how all these different technologies can coporate to create a working product. They work smoothly and in harmony (until they crash). But of course, whatever the product is, it will not run on any non-MS platform (sometimes it will but it’s not MS that makes that feasible). But as I said earlier, it’s great that the student can get his hands on all that stuff on his machine at no charge.

But what Microsoft gets out of it? Do they really care for students’ education? Or do they care to get more and more users and developers, where most of them are in their early stages, around their own products? The latest MS program for providing products at no charge to educational institutions was annouced on February 2008 by Bill Gates at Stanford University [1]. It is estimated that 35 million students in 11 countries [2] (I’d guess they’d be more today) will get access to MS products provided at no charge.

Imagine now, how many of these 35 million students don’t know of the non-MS technologies? I would say most them and I think that they would look in MS alternatives if they really had to. But now, MS keeps the business running in the usual dodgy way.