Search code examples
numpyfortranlapackgfortrang77

Determine which compiler built my LAPACK


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!


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).