title: Linking LAPACK/BLAS libraries
body: <p><strong>Background:</strong><br>
  I am working on a project written in a mix of C and Fortran 77 and now need to link the LAPACK/BLAS libraries to the project (all in a Linux environment). The LAPACK in question is version 3.2.1 (including BLAS) from netlib.org. The libraries were compiled using the top level Makefile (make lapacklib and make blaslib).</p>
  
  <p><strong>Problem:</strong><br>
  During linking, error messages claimed that certain (not all) BLAS-routines called from LAPACK-routines were undefined. This gave me some headache but the problem was eventually solved when (in the Makefile) the order of appearance of the libraries to be linked was changed.</p>
  
  <p><strong>Code:</strong><br>
  In the following, (a) gives errors while (b) does not. The linking is performed by (c).<br>
      (a) LIBS  = $(LAPACK)/blas_LINUX.a $(LAPACK)/lapack_LINUX.a<br>
      (b) LIBS  = $(LAPACK)/lapack_LINUX.a $(LAPACK)/blas_LINUX.a<br>
      (c) gcc -Wall -O -o $@ project.o project.a $(LIBS)</p>
  
  <p><strong>Question:</strong><br>
  What could be the reason for the undefined references of only some routines and what makes the order of appearance relevant?</p>