Question

I want to install the newest version of numpy (a numerical library for Python), and the version (v1.6.1) is not yet in the Ubuntu Oneiric repositories. When I went ahead to manually install it, I read in the INSTALL file that numpy needs to be built with the same compiler that built LAPACK (a fortran lib used by numpy). Unfortunately, I don't know which compiler that is. I didn't install LAPACK myself - apt-get did, back when I installed an older numpy (v1.5.1) using apt. If I had to guess, I'd say gfortran, but I'd rather not mess this up.

How do I figure out which compiler built my current installation of LAPACK? Is there any easy way - perhaps running some fortran code that uses it and examining the output?

Thanks!

Was it helpful?

Solution

From the same INSTALL file you referenced...

How to check the ABI of blas/lapack/atlas
-----------------------------------------

One relatively simple and reliable way to check for the compiler used to build
a library is to use ldd on the library. If libg2c.so is a dependency, this
means that g77 has been used. If libgfortran.so is a a dependency, gfortran has
been used. If both are dependencies, this means both have been used, which is
almost always a very bad idea.

If I had to guess, I would probably guess gfortran also as the only two free fortran compilers that I know of are g77 and gfortran and g77 development is pretty much dead as far as I know ... Another thing to check is g77 (by default) appended two underscores to symbols whereas gfortran (by default) only appends one. This is probably the thing that is most important for numpy to know ... although there may be other subtle differences (if numpy is doing some dirty hacking to get at information stored in a common block for instance).

OTHER TIPS

I know of no easy way, though you may find readelf -a /usr/lib/$SHARED_OBJECT illuminating, where $SHARED_OBJECT is something like /usr/lib/atlas-base/liblapack_atlas.so.3gf.0 (you'll have to look in your /usr/lib to see what your exact filename is).

However, there is another, quite different way to get information, since you are using Ubuntu, a flavor of Debian.

  1. Find out which to binary package $BINARY_PKG your Lapack shared object belongs by dpkg -l | grep -E '(lapack|atlas) and/or dpkg -S $SHARED_OBJECT.
  2. Find out from which source package $SOURCE_PKG the binary package $BINARY_PKG was built by dpkg -s $BINARY_PACKAGE. In the output, look for the Source: line.
  3. Change into some temporary working directory.
  4. Issue apt-get source $SOURCE_PKG. (Alternately, apt-get source $BINARY_PKG has the same effect.)
  5. Issue ls and notice the Lapack source directory.
  6. Change into the Lapack source directory.
  7. Examine the file debian/control, paying special attention to the relevant Build-Depends: line. This will tell what was necessary to build the package.
  8. Issue dpkg -s build-essential, which will give you additional information about compilers available to build every package in your distribution (you may have to install the build-essential package, first).

All this is of course a lot of work, and none of it is in the nature of a simple formula that just gives you the answer you seek; but it does give you places to look for the answer. Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top