1. Requirement: cygwin ( gcc, g++, g77, make, gdb )
2. Access to http://www.netlib.org/lapack/ and obtain lapack-3.1.1.gz.
3. After downloading lapack-3.1.1.gz in /cygwin/home/***/, unzip lapack-3.1.1.gz, when the command line is
$ gunzip -c lapack-3.1.1.gz | tar xv
or
$ tar xvfz lapack-3.1.1.gz
Since current directory is /cygwin/home/***/, move it to /cygwin/home/***/lapack-3.1.1/, when the command line is
$ cd lapack-3.1.1
5. Copy and modify make.inc.LINUX, when the command line is given below.
$ cp INSTALL/make.inc.LINUX ./make.inc
6. Modify make.inc, using your text editor.
<EXAMPLE>
NOOPT = -ffloat-store
# The above line is necessary when using g95.
BLASLIB = $(HOME)/lapack-3.1.1/blas$(PLAT).a
LAPACKLIB = lapack$(PLAT).a
TMGLIB = tmglib$(PLAT).a
EIGSRCLIB = eigsrc$(PLAT).a
LINSRCLIB = linsrc$(PLAT).a
7. Build BLAS library and LAPACK library, when the command lines are
$ make blaslib
and
$ make lapacklib
If neither blas_LINUX.a nor lapack_LINUX.a were made in your current directory, modify make.inc appropriately.
8. Copy and modify blas_LINUX.a and lapack_LINUX.a, when the command lines are
$ cp blas_LINUX.a /lib/libblas.a
$ cp lapack_LINUX.a /lib/liblapack.a
$ ranlib /lib/libblas.a
$ ranlib /lib/liblapack.a
9. Now you can use LAPACK, when the command line is
$ g77 -o file01 file01.f -llapack -lblas -lg2c -lm
where file01.f were an example and you can use other fortran77 programs.
How to cope with "/bin///ld: cannot find -lg2c" for win users
When I used lapack library with g95, the error message
was displayed to indicate that ld.exe couldn't find
libg2c.a. To solve the problem, I typed in
cp /lib/gcc/i686-pc-cygwin/3.4.4/libg2c.a /lib/libg2c.a
at the command line and could compile *.f90 and create *.exe
using lapack library with g95. Then, the command line was
g95 -o * *.f90 -llapack -lblas -lg2c -lm.