Sundials2.2.0版本编译使用
下载sundials2.2.0版本,打开安装教程(CVODE Installation Procedure):
以下命令都是Linux命令:
1.Linux gunzip 用于解压文件。
gunzip是个使用广泛的解压缩程序,它用于解开被gzip压缩过的文件,这些压缩文件预设最后的扩展名为".gz"。事实上gunzip就是gzip的硬连接,因此不论是压缩或解压缩,都可通过gzip指令单独完成。
语法:
gunzip [-acfhlLnNqrtvV][-s <压缩字尾字符串>][文件...] 或 gunzip [-acfhlLnNqrtvV][-s <压缩字尾字符串>][目录]
2.tar(tape archive )用于备份文件。
tar 是用来建立,还原备份文件的工具程序,它可以加入,解开备份文件内的文件。
例:解压文件
# tar -xzvf test.tar.gz
a.c
3.cd(change directory)用于切换当前工作目录。
语法:
cd [dirName]
其中 dirName 表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的 home 目录 (也就是刚 login 时所在的目录)。
另外,~ 也表示为 home 目录 的意思, . 则是表示目前所在的目录, … 则表示目前目录位置的上一层目录。
另,根据源文件附带安装教程:
- ‘cd’ to the sundials directory (the directory where this file resides)
and type ‘./configure’ to configure the package for your system.
If you’re using ‘csh’ on an old version of System V, you might need to
type ‘sh ./configure’ instead to prevent ‘csh’ from trying to execute
‘configure’ itself.
Running ‘configure’ takes a while. While running, it prints some
messages telling which features it is checking for. - Type `make’ to compile all existing modules.
- Type `make install’ to install the libraries and header files.
- To compile the example programs for all the existing modules, type
‘make examples’. - You can remove the libraries and object files from the source code
directories by typing `make clean’.
下载Cygwin
Windows下的Linux开发环境 Cygwin官网
具体下载步骤可百度自行解决,主要注意以下内容:
在选择需要下载安装的组件包时,展开devel,从中选择binutils、 gcc 、mingw 、gdb进行安装,找到以下选项,点击后边的skip,使其变为版本号即可。
1.binutils
2.gcc
4.gdb
3.mingw
验证Cygwin安装是否成功:
cygcheck -c cygwin
g++ --version
编译sundials2.2.0
开始编译:
cd C:\sundials\src
sh ./configure --build=arm-linux
sh ./configure --prefix=install --enable-shared --disable-static --build=arm-linux
【注】
1…configure一般都有可执行的权限,如果没有的话,用./configure是不能执行的,但是可以这样执行:
sh ./configure
2.” --enable-shared “导致构建可用sundials库的静态和共享版本;要仅构建共享库,还需要指定” --disable-static“
用于指定安装目录 如果不指定是安装的在默认的目录下,/usr/local;pwd是当前用户目录。
编译部分成功,得到如下结果:(并未设置生成文件地址,生成文件与source在同一地址)
【尝试1】设置地址为build 目录,执行以下命令,报错:
cd C:\sundials\build
sh C:\sundials\src\configure --enable-shared --disable-static --build=arm-linux
sh ..\src\configure --enable-shared --disable-static --build=arm-linux
【尝试2】设置地址为src 目录,执行以下命令
【另】可输入以下代码,获取一些相关环境变量的详细信息:
sh ./configure --help
结果如下:
`configure' configures SUNDIALS 2.2.0 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/cygdrive/c/sundials/src]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/cygdrive/c/sundials/src/bin', `/cygdrive/c/sundials/src/lib' etc. You can specify
an installation prefix other than `/cygdrive/c/sundials/src' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-cvode disable configuration of CVODE
--disable-cvodes disable configuration of CVODES
--disable-ida disable configuration of IDA
--disable-kinsol disable configuration of KINSOL
--disable-examples disable configuration of examples
--disable-f77 disable Fortran support
--disable-mpi disable MPI support
--enable-shared[=PKGS]
build shared libraries [default=no]
--enable-static[=PKGS]
build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-precision=ARG specify floating-point precision
(single/double/extended) [double]
--with-cflags add extra C compiler flags
--with-cppflags add extra C/C++ preprocessor flags
--with-ldflags add extra linker flags
--with-libs add extra libraries
--with-f77underscore=ARG
specify number of underscores to append to function
names (none/one/two) [AUTO]
--with-f77case=ARG specify case of function names (lower/upper) [AUTO]
--with-fflags add extra Fortran compiler flags
--with-mpi-root=MPIROOT use MPI root directory
--with-mpi-incdir=DIR MPI include directory [MPIROOT/include]
--with-mpi-libdir=DIR MPI library directory [MPIROOT/lib]
--with-mpi-libs=ARG MPI libraries
--with-mpi-flags MPI-specific flags
--with-mpicc[=ARG] specify MPI-C compiler to use [mpicc]
--with-mpif77[=ARG] specify MPI-Fortran compiler to use [mpif77]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-tags[=TAGS]
include additional configurations [automatic]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <radu@llnl.gov>.