日期:2014-05-16  浏览次数:20733 次

求教怎么编译这个数学工具的源文件
最近要用这个数学工具来解一个问题,在网上找到了使用相应的代码包。我在Redhat中解压这个包,得到了一个名为pomdp-solve-4.0的文件夹,里面有一个main.c文件,还有定义了其他函数和变量的头文件和相应的C文件。另外pomdp-solve-4.0文件夹里还有lp_solve和mdp这两个文件夹。我估计里面的函数用来解lp和mdp这两个问题,而主函数可能会调用这两个文件夹中的函数。

代码的作者给出了一些编译和运行的说明。但是我是由于要用这个工具才刚接触的linux,对他的说明不是明白,希望有高手能指点一下。他的一段话是教怎么编译,标题是“Compiling”。内容如下:
“To build the thing, do this:

  make clean
  make dep
  make pomdp-solve

Makefiles are still a bit mysterious to me, and I haven't had the time to do the IMakefile or "autoconfig" thing, so no guarantees that I actually have this set up to work properly on your system. It works on the few systems I have tried (Linux, Solaris, Solaris with CPLEX 3.0 and 4.0) , and I have tried to make it so it would work other places, but that's all I know.

Also, you can do:

  make test

to build and execute a program which automatically runs the code through some simple tests This is used to ensure that installation went well and for regression testing on subsequent versions (if you or I change the code around).

If you want, you can also do:

  make clean

to clean up all the object files, libraries, etc. or

  make clean-local

to leave the libraries in tact, but clean up the main pomdp-solve code. This leaves the libraries in-tact and helps speed up development and compilation time. ”

是不是照他这几条“make”的指令就可以完成编译了?具体步骤是先cd 进入pomdp-solve-4.0 文件夹,然后输入make指令对吧?

我奇怪的是他还有一段话讲“Compilation Transcript”,我有点不太明白这个“Compilation Transcript”是要输入的指令还是执行make编译过程中系统显示出来的东西。具体内容如下:
“Not sure if this will be helpful or not, but here is the transcript of what it looks like when I compile the code on linux without CPLEX.

arc on marie % make dep
make -C ./mdp dep
make[1]: Entering directory `/u/arc/proj/pomdp-solve-4.0/mdp'
gcc -E -M *.[c] > Makefile.depend
make[1]: Leaving directory `/u/arc/proj/pomdp-solve-4.0/mdp'
gcc -E -M -I./mdp -I./lp_solve *.[c] > Makefile.depend
arc on marie % make
make -C ./mdp libmdp.a
make[1]: Entering directory `/u/arc/proj/pomdp-solve-4.0/mdp'
bison -v -d parser.y
gcc -g -c parser.tab.c
flex scanner.l
gcc -g -c lex.yy.c
gcc -g -c imm-reward.c
gcc -g -c parse_err.c
gcc -g -c parse_hash.c
gcc -g -c sparse-matrix.c
gcc -g -c mdp.c
ar -crv libmdp.a parser.tab.o lex.yy.o imm-reward.o parse_err.o parse_hash.o sparse-matrix.o mdp.o
a - parser.tab.o
a - lex.yy.o
a - imm-reward.o
a - parse_err.o
a - parse_hash.o
a - sparse-matrix.o
a - mdp.o
make[1]: Leaving directory `/u/arc/proj/pomdp-solve-4.0/mdp'
make -C ./lp_solve liblpk.a
make[1]: Entering directory `/u/arc/proj/pomdp-solve-4.0/lp_solve_2.2'
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c lpkit.c -o lpkit.o
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c solve.c -o solve.o
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c debug.c -o debug.o
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c read.c -o read.o
read.c: In function `read_lp_file':
read.c:572: warning: implicit declaration of function `yyparse'
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c readmps.c -o readmps.o
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c hash.c -o hash.o
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c presolve.c -o presolve.o
bison -y lp.y
mv y.tab.c lp.c
flex lex.l
mv lex.yy.c lex.c
gcc -g -Wall -pedantic -ansi -DSYSLINUX -c lp.c -o lp.o
/usr/lib/bison.simple: In function `yyparse':
/usr/lib/bison.simple:327: warning: implicit declaration of function `yyerror'
/usr/lib/bison.simple:387: warning: implicit declaration of function `yylex'
lp.y:99: warning: implicit declaration of function `check_decl'
lex.yy.c: In function `yy_