修改了三处 ARmake.inc 文件, 然后 使用命令 make lib 生成库, 最后把库在/usr/local/lib 里作一个连接,完成了 arpack 库 的安装。
如果在 Fedora Core 6 下安装, 还要把
FC = f77 改成 FC = gfortran
因为我的机器上只有这个 fortran 编译器
在 suse 10.1 机器上具体步骤如下:
http://www.caam.rice.edu/software/ARPACK/
下载 arpack96.tar.gz
下载 patch.tar.gz
cp arpack96.tar.gz /usr/local/share
cp patch.tar.gz
tar xzvf arpack96.tar.gz
tar xzvf patch.tar.gz
cd ARPACK
make lib
会发现这样的报错
/bin/sh: line 0: cd: /root/ARPACK/BLAS: 没有那个文件或目录
Making lib in /root/ARPACK/BLAS
/bin/sh: /bin/make: 没有那个文件或目录
/bin/sh: line 0: cd: /root/ARPACK/LAPACK: 没有那个文件或目录
Making lib in /root/ARPACK/LAPACK
/bin/sh: /bin/make: 没有那个文件或目录
/bin/sh: line 0: cd: /root/ARPACK/UTIL: 没有那个文件或目录
Making lib in /root/ARPACK/UTIL
/bin/sh: /bin/make: 没有那个文件或目录
/bin/sh: line 0: cd: /root/ARPACK/SRC: 没有那个文件或目录
Making lib in /root/ARPACK/SRC
/bin/sh: /bin/make: 没有那个文件或目录
ranlib /root/ARPACK/libarpack_SUN4.a
ranlib: '/root/ARPACK/libarpack_SUN4.a': No such file
修改 ARmake.inc
把
home = $(HOME)/ARPACK
修改成你的ARPACK 所在的文件夹
home = /usr/local/share/ARPACK
make lib
报的错误还是
Making lib in /usr/local/share/ARPACK/BLAS
/bin/sh: /bin/make: 没有那个文件或目录
Making lib in /usr/local/share/ARPACK/LAPACK
/bin/sh: /bin/make: 没有那个文件或目录
Making lib in /usr/local/share/ARPACK/UTIL
/bin/sh: /bin/make: 没有那个文件或目录
Making lib in /usr/local/share/ARPACK/SRC
/bin/sh: /bin/make: 没有那个文件或目录
ranlib /usr/local/share/ARPACK/libarpack_SUN4.a
ranlib: '/usr/local/share/ARPACK/libarpack_SUN4.a': No such file
把 PLAT = SUN4 改成 PLAT = LINUX
因为我觉得我们的机器是LINUX, 不是 SUN4
不知道为什么 找不到 这些东西, 现在我们可以保证 BLAS and LAPACK 的路径都是对。
/bin/make 的路径是不是对呢? 在 suse 10.1 使用命令
whereis make
发现 make 的路径是 /usr/bin/make
把
MAKE = /bin/make
改成
MAKE = /usr/bin/make
经过这样后,就能编译成功了。
然后安装这个库
linux-1482:/usr/local/share/ARPACK # cd /usr/local/lib
linux-1482:/usr/local/lib # ln -s /usr/local/share/ARPACK/libarpack_LINUX.a ./libarpack.a
附上修改过的 ARmake.inc
#################################
#
# Program: ARPACK
#
# Module: ARmake.inc
#
# Purpose: Top-level Definitions
#
# Creation date: February 22, 1996
#
# Modified:
#
# Send bug reports, comments or suggestions to arpack@caam.rice.edu
#
###################################
#
# %---------------------------------%
# | SECTION 1: PATHS AND LIBRARIES |
# %---------------------------------%
#
#
# %--------------------------------------%
# | You should change the definition of |
# | home if ARPACK is built some place |
# | other than your home directory. |
# %--------------------------------------%
#
#home = $(HOME)/ARPACK
home = /usr/local/share/ARPACK
#
# %--------------------------------------%
# | The platform identifier to suffix to |
# | the end of library names |
# %--------------------------------------%
#
# PLAT = SUN4
PLAT = LINUX
#
# %------------------------------------------------------%
# | The directories to find the various pieces of ARPACK |
# %------------------------------------------------------%
#
BLASdir = $(home)/BLAS
LAPACKdir = $(home)/LAPACK
UTILdir = $(home)/UTIL
SRCdir = $(home)/SRC
#
DIRS = $(BLASdir) $(LAPACKdir) $(UTILdir) $(SRCdir)
#
# %-------------------------------------------------------------------%
# | Comment out the previous line and uncomment the following |
# | if you already have the BLAS and LAPACK installed on your system. |
# | NOTE: ARPACK assumes the use of LAPACK version 2 codes. |
# %-------------------------------------------------------------------%
#
#DIRS = $(UTILdir) $(SRCdir)
#
# %---------------------------------------------------%
# | The name of the libraries to be created/linked to |
# %---------------------------------------------------%
#
ARPACKLIB = $(home)/libarpack_$(PLAT).a
LAPACKLIB =
BLASLIB =
#
ALIBS = $(ARPACKLIB) $(LAPACKLIB) $(BLASLIB)
#
#
# %---------------------------------------------------------%
# | SECTION 2: COMPILERS |
# | |
# | The following macros specify compilers, linker/loaders, |
# | the archiver, and their options. You need to make sure |
# | these are correct for your system. |
# %---------------------------------------------------------%
#
#
# %------------------------------%
# | Make our own suffixes' list. |
# %------------------------------%
#
.SUFFIXES:
.SUFFIXES: .f .o
#
# %------------------%
# | Default command. |
# %------------------%
#
.DEFAULT:
@$(ECHO) "Unknown target $@, try: make help"
#
# %-------------------------------------------%
# | Command to build .o files from .f files. |
# %-------------------------------------------%
#
.f.o:
@$(ECHO) Making $@ from $<
@$(FC) -c $(FFLAGS) $<
#
# %-----------------------------------------%
# | Various compilation programs and flags. |
# | You need to make sure these are correct |
# | for your system. |
# %-----------------------------------------%
#
FC = f77
FFLAGS = -O -cg89
LDFLAGS =
CD = cd
ECHO = echo
LN = ln
LNFLAGS = -s
# MAKE = /bin/make
MAKE = /usr/bin/make
RM = rm
RMFLAGS = -f
SHELL = /bin/sh
#
# %----------------------------------------------------------------%
# | The archiver and the flag(s) to use when building an archive |
# | (library). Also the ranlib routine. If your system has no |
# | ranlib, set RANLIB = touch. |
# %----------------------------------------------------------------%
#
AR = ar
ARFLAGS = rv
#RANLIB = touch
RANLIB = ranlib
#
# %----------------------------------%
# | This is the general help target. |
# %----------------------------------%
#
help:
@$(ECHO) "usage: make ?"

