Compiling and linking netlib

Author: Simone Labels:: , , , ,

Ok, so here is the deal. I just got this awesome new computer at work. A slick Dell workstation, i7 double core, a load of ram and hard drive space.

So, first thing first: wipe out windows 7. Great. Got the new Ubuntu 10.10 Maverick to do it. It took literally 5 minutes. No kidding. I spent some time installing my programs: flash and skype, all the way down to my little programs. But, as I said, it is my work computer. I have to use it to actually produce something. And to do so I might just need a compiler. Fortran, C, C++ and so forth.

A few years ago, when I started, g77 was the deal. Gnu made that, it was free, it had good performance, it was it. A couple of years ago, Gnu decides to change to gfortran. Installing gfortran is just a matter of apt-get and such, no problem. However, to actually linking it to libraries that are over a couple of years old turns out to be a problem, ending up in an actual nightmare for a stubborn ass like me.

There is a large set of math libraries which is called slatec, from netlib. It used to come standard with linux a few years ago, and ubuntu had its version. This was until gnu decided to change its compiler to gfortran. I remember, back in my days of college, that building a library was not the worst thing in the world. It was just a matter of writing a makefile and properly linking everything.

Well, that was before today. I have to admit, I have not done it in some time, but - hey - I thought - if anything else I got smarter with age, not dumber. Facts proved me wrong.

This slatec library has been built against g77 for years (starting actually from f77). It has no business with gfortran, and it does not want to obey. So I download the sources (about 1000 fortran files) and build my little make program the way I learnt years ago and guess what? The library does not work. It does not want to work. Not only that, it refuses to compile, it refuses to give me any real advice on what to do. Thanks for nothing, gfortran.

So I think: I better give up now that the day is still young, install f77 and build the library against it. But... Now there is gfortran. g77 is no more. There is an f77 program which is just an interface for f2c, which converts fortran to c and then compiles. You can do the math.

Here it is what actually happens when building slatec against gfortran. Through the makefile you actually get a library which you will need to move to your /usr/lib or /usr/local/lib. And when you compile your fortran code - believe it or not - the code compiles with no problems. When you test it with one of the many programs that comes with it, it does not work. It gives weird messages. I tried it with one of my old programs (I have used it so many times that I just know it works), which integrates a simple set of ordinary differential equations. Nothing fancy, nothing stiff, something you could do with matlab without issues. I got nothing. And the weird thing is that, when I used the single subroutines instead of the library, the program works.

Ok, long story short: I installed another compiler. Yeah, that's it. Thanks gnu for helping. One day lost. 10 hours in the can. And I flushed.
Another day, another rant. I start to resemble Adam Carolla.

0 comments |

Post a Comment

Followers

Popular Posts

About Me

So, you want to know about me, uh? Are you one of those creeps? Well, get lost! You should be working instead. I work. I have a job. Unlike you. A real job. Yeah, that's right. I don't do this for a living. You want to know where I write this blog? On the can. That's right. That's where it belongs. I do something useful with my time. I am not a genius, I don't have a PhD in Physics or anything fancy like that. If I did, I would be working somewhere on the west coast, doing some fancy rocket science research. But no. I have a real job. Are you still reading? Get lost!
Powered by Blogger.
banner 1 banner 2