【发布时间】:2014-06-21 05:02:12
【问题描述】:
我正在尝试在运行 redhat+IBM LSF 的集群中从源代码安装最新的 octave 3.8.1。除了我自己的主目录之外,我没有其他任何地方的写访问权限,这就是为什么我必须从源代码安装 octave。集群提供的 blas 和 lapack 不起作用,所以我必须自己构建它们。我现在已经完成了blas和lapack的编译并通过了./configure,但是当我运行make时,报错如下:
这些是我用来构建自己的BLAS 和LAPACK 的步骤。 BLAS 的来源在~/src/BLAS,LAPACK 的来源在~/src/lapack-3.5.0,倍频程3.8.1 的来源在~/src/octave-3.8.1。
只加载了两个模块1) pcre/8.33 2) acml/5.3.1/gfortran64,我使用
gfortran -shared -O2 *.f -o libblas.so -fPIC
和静态库使用
gfortran -O2 -c *.f -fPIC
ar cr libblas.a *.o
然后我将共享库libblas.so 复制到~/src/octave-3.8.1。 lapack 目录下make.inc 文件的内容为:
####################################################################
# LAPACK make include file. #
# LAPACK, Version 3.5.0 #
# November 2013 #
####################################################################
#
SHELL = /bin/sh
#
# Modify the FORTRAN and OPTS definitions to refer to the
# compiler and desired compiler options for your machine. NOOPT
# refers to the compiler options desired when NO OPTIMIZATION is
# selected. Define LOADER and LOADOPTS to refer to the loader and
# desired load options for your machine.
#
FORTRAN = gfortran
OPTS = -shared -O2 -fPIC
DRVOPTS = $(OPTS)
NOOPT = -O0 -frecursive
LOADER = gfortran
LOADOPTS =
#
# Timer for the SECOND and DSECND routines
#
# Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME
#TIMER = EXT_ETIME
# For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_
# TIMER = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME
TIMER = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...)
# SECOND and DSECND will use a call to the INTERNAL FUNCTION CPU_TIME
# TIMER = INT_CPU_TIME
# If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0
# TIMER = NONE
#
# Configuration LAPACKE: Native C interface to LAPACK
# To generate LAPACKE library: type 'make lapackelib'
# Configuration file: turned off (default)
# Complex types: C99 (default)
# Name pattern: mixed case (default)
# (64-bit) Data model: LP64 (default)
#
# CC is the C compiler, normally invoked with options CFLAGS.
#
CC = gcc
CFLAGS = -O3
#
# The archiver and the flag(s) to use when building archive (library)
# If you system has no ranlib, set RANLIB = echo.
#
ARCH = ar
ARCHFLAGS= cr
RANLIB = ranlib
#
# Location of the extended-precision BLAS (XBLAS) Fortran library
# used for building and testing extended-precision routines. The
# relevant routines will be compiled and XBLAS will be linked only if
# USEXBLAS is defined.
#
# USEXBLAS = Yes
XBLASLIB =
# XBLASLIB = -lxblas
#
# The location of the libraries to which you will link. (The
# machine-specific, optimized BLAS library should be used whenever
# possible.)
#
#BLASLIB = ../../librefblas.a
BLASLIB = ~/src/BLAS/libblas.a
LAPACKLIB = liblapack.a
TMGLIB = libtmglib.a
LAPACKELIB = liblapacke.a
然后我输入 make 来编译 LAPACK。编译后,我将输出liblapack.a复制到~/src/octave-3.8.1。
./configure 命令行是:
./configure --prefix=$HOME/bin/octave --with-blas=./libblas.so --with-lapack=$HOME/src/octave-3.8.1/liblapack.a --disable-readline --enable-64
我可以通过 ./configure。然后我输入make 尝试构建octave 3.8.1,我得到了上述错误。
从make.inc文件可以看出我已经按照编译器“recompile with -fPIC”的建议,对make.inc进行了相应的修改。我还在OPTS 变量中添加了-shared 开关。此外,我尝试过使用旧的 LAPACK 版本但无法正常工作。我真的不知道为什么错误仍然出现。所以我想知道您是否可以告诉我如何编译LAPACK 库,以便在安装 octave 3.8.1 期间可以正确使用它。以下两点可能值得考虑。 (1) 我应该将 lapack 编译为静态库还是共享库? (2)-fPIC开关应该应用于lapack编译还是octave的make?如果是后者,如何应用-fPIC来制作?您不必局限于上述两点,因为错误可能还有其他原因。欢迎任何解决此问题的建议。如果您需要任何其他信息,请告诉我。谢谢你。
【问题讨论】:
-
您在尝试运行
make之间是否清理了辅助构建文件?关于将标志传递给 Octave 构建,您可以直接在配置步骤中进行:./configure CXXFLAGS='-O2 -fPIC'. -
谢谢。我在make之前输入了“make clean”。我在 ./configure 的命令行参数中添加了“CXXFLAGS='-O2 -fPIC'”,但出现了同样的错误。
-
@user2384994 你成功了吗?也许您还应该修改
make.inc中的CFLAGS、LOADOPTS 和NOOPT(只是猜测)。您还可以记录 lapack 构建并检查是否真的使用 -fPIC 标志调用了编译器。
标签: gcc installation fortran octave lapack