当前位置: 技术问答>linux和unix
求教怎么编译这个数学工具的源文件
来源: 互联网 发布时间:2017-03-01
本文导语: 最近要用这个数学工具来解一个问题,在网上找到了使用相应的代码包。我在Redhat中解压这个包,得到了一个名为pomdp-solve-4.0的文件夹,里面有一个main.c文件,还有定义了其他函数和变量的头文件和相应的C文件。另...
最近要用这个数学工具来解一个问题,在网上找到了使用相应的代码包。我在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_init_buffer':
In file included from lp.y:204:
lex.yy.c:1362: warning: implicit declaration of function `fileno'
lex.yy.c: At top level:
lex.yy.c:1116: warning: `yyunput' defined but not used
ar rv liblpk.a lpkit.o solve.o debug.o read.o readmps.o hash.o presolve.o lp.o
a - lpkit.o
a - solve.o
a - debug.o
a - read.o
a - readmps.o
a - hash.o
a - presolve.o
a - lp.o
ranlib liblpk.a
make[1]: Leaving directory `/u/arc/proj/pomdp-solve-4.0/lp_solve_2.2'
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c global.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c timing.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c random.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c pomdp.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c alpha.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c stats.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c params.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c projection.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c lp-interface.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c region.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c parsimonious.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c neighbor.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c common.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c witness.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c cross-sum.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c enumeration.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c inc-prune.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c two-pass.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c vertex-enum.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c linear-support.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c policy-graph.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c cmd-line.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c signal-handler.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c pomdp-solve.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c main.c
gcc -o pomdp-solve -L./mdp -L./lp_solve global.o timing.o random.o pomdp.o alpha.o stats.o params.o projection.o lp-interface.o region.o parsimonious.o neighbor.o common.o witness.o cross-sum.o enumeration.o inc-prune.o two-pass.o vertex-enum.o linear-support.o policy-graph.o cmd-line.o signal-handler.o pomdp-solve.o main.o -lmdp -llpk -lm”
确实太麻烦了哈,但还是希望能有高手帮帮我。倒是是直接输入那几条make指令就好,还是说要输入上面这一长串这么多命令呢?
代码的作者给出了一些编译和运行的说明。但是我是由于要用这个工具才刚接触的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_init_buffer':
In file included from lp.y:204:
lex.yy.c:1362: warning: implicit declaration of function `fileno'
lex.yy.c: At top level:
lex.yy.c:1116: warning: `yyunput' defined but not used
ar rv liblpk.a lpkit.o solve.o debug.o read.o readmps.o hash.o presolve.o lp.o
a - lpkit.o
a - solve.o
a - debug.o
a - read.o
a - readmps.o
a - hash.o
a - presolve.o
a - lp.o
ranlib liblpk.a
make[1]: Leaving directory `/u/arc/proj/pomdp-solve-4.0/lp_solve_2.2'
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c global.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c timing.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c random.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c pomdp.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c alpha.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c stats.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c params.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c projection.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c lp-interface.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c region.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c parsimonious.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c neighbor.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c common.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c witness.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c cross-sum.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c enumeration.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c inc-prune.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c two-pass.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c vertex-enum.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c linear-support.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c policy-graph.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c cmd-line.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c signal-handler.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c pomdp-solve.c
gcc -DSYSLINUX -g -pedantic -I./mdp -I./lp_solve -c main.c
gcc -o pomdp-solve -L./mdp -L./lp_solve global.o timing.o random.o pomdp.o alpha.o stats.o params.o projection.o lp-interface.o region.o parsimonious.o neighbor.o common.o witness.o cross-sum.o enumeration.o inc-prune.o two-pass.o vertex-enum.o linear-support.o policy-graph.o cmd-line.o signal-handler.o pomdp-solve.o main.o -lmdp -llpk -lm”
确实太麻烦了哈,但还是希望能有高手帮帮我。倒是是直接输入那几条make指令就好,还是说要输入上面这一长串这么多命令呢?
|
编译的话,当然是那几条 make指令
transcript 是为了出错时找问题用的
transcript 是为了出错时找问题用的