简体   繁体   English

MLton静态编译

[英]MLton compile statically

I've got an issue with the compilation of a program in Standard ML. 我在标准ML中编译程序时遇到了问题。

This program is working perfectly and compiling perfectly on my local machine. 这个程序完美地工作,并在我的本地机器上完美编译。 But I would like to be able to compile it statically in order to execute it somewhere else on a Cluster. 但我希望能够静态编译它,以便在集群上的其他地方执行它。

Here is the command that I'm using to compile my program : 这是我用来编译程序的命令:

mton -verbose 3 -codegen native -output spartacus src/spartacus.mlb

Here is the file src/spartacus.mlb : 这是文件src/spartacus.mlb

/usr/lib/mlton/sml/basis/basis.mlb
/usr/lib/mlton/sml/smlnj-lib/Util/smlnj-lib.mlb
/usr/lib/mlton/sml/mlyacc-lib/mlyacc-lib.mlb

util/listsort.sig.sml
util/listsort.sml

smlnj-lib/Binarymap.sml
smlnj-lib/Binaryset.sml

ds/dict.sig.sml
ds/binarydict.sml
ds/dynarraydict.sml

core/settings.sml

util/debug.sml
util/util.sml
util/exn.sig.sml
util/exn.sml
util/ref.sig.sml
util/ref.sml

ds/ubtree.sig.sml
ds/ubtree.sml
ds/bitmatrix.sig.sml
ds/bitmatrix.sml
ds/btprioq.sig.sml
ds/btprioq.sml

core/relationmgr.sig.sml
core/relationmgr.sml

preprocessing/parsetree.sml

core/term.sml

parsers/owlfs/owlfs.grm.sig
parsers/owlfs/owlfs.lex.sml
parsers/owlfs/owlfs.grm.sml
parsers/owlfs/owlfsparser.sml

parsers/lwb/lwb.grm.sig
parsers/lwb/lwb.lex.sml
parsers/lwb/lwb.grm.sml
parsers/lwb/lwbparser.sml

parsers/parser/grmspec.grm.sig
parsers/parser/lexspec.lex.sml
parsers/parser/grmspec.grm.sml
parsers/parser/parser.sml

parsers/ksatc/ksatc.grm.sig
parsers/ksatc/ksatc.lex.sml
parsers/ksatc/ksatc.grm.sml
parsers/ksatc/ksatcparser.sml

parsers/intohylo/intohylo.grm.sig
parsers/intohylo/intohylo.lex.sml
parsers/intohylo/intohylo.grm.sml
parsers/intohylo/intohyloparser.sml

parsers/alc/alc.grm.sig
parsers/alc/alc.lex.sml
parsers/alc/alc.grm.sml
parsers/alc/alcparser.sml

parsers/dimacs/dimacs.grm.sig
parsers/dimacs/dimacs.lex.sml
parsers/dimacs/dimacs.grm.sml
parsers/dimacs/dimacsparser.sml

parsers/dfg/dfg.grm.sig
parsers/dfg/dfg.lex.sml
parsers/dfg/dfg.grm.sml
parsers/dfg/dfgparser.sml

parsers/advtkb/tkbtree.sml
parsers/advtkb/advtkb.grm.sig
parsers/advtkb/advtkb.lex.sml
parsers/advtkb/advtkb.grm.sml
parsers/advtkb/advtkbparser.sml

parsers/tancs/tancs.grm.sig
parsers/tancs/tancs.lex.sml
parsers/tancs/tancs.grm.sml
parsers/tancs/tancsparser.sml

preprocessing/translator.sig.sml
preprocessing/translator.sml

util/dependency.sig.sml
util/dependency.sml

heuristics/penaltymap.sig.sml
heuristics/penaltymap.sml
heuristics/disjunctionpenalties.sig.sml
heuristics/disjunctionpenalties.sml

core/agenda.sig.sml
core/agenda.sml

ds/propstore.sig.sml
ds/propstore.sml
ds/termstore.sig.sml
ds/termstore.sml

opt/lazystore.sig.sml
opt/lazystore.sml
opt/lazyboxstore.sig.sml
opt/lazyboxstore.sml
opt/lazynomstore.sig.sml
opt/lazynomstore.sml

core/universalstore.sig.sml
core/universalstore.sml

core/existentialstore.sig.sml
core/existentialstore.sml

opt/cache.sig.sml
opt/treecache.sml
opt/mtrxcache.sml
opt/cache.sml

core/node.sig.sml
core/node.sml
core/nodestore.sig.sml
core/nodestore.sml

blocking/patternstore.sig.sml
blocking/listpatternstore.sml
blocking/treepatternstore.sml
blocking/mtrxpatternstore.sml
blocking/patternstore.sml
blocking/blockingmgr.sig.sml
blocking/blockingmgr.sml

core/branchingmgr.sig.sml
core/branchingmgr.sml
core/solver.sig.sml
core/solver.sml

output/helpmsg.sml
output/printsettings.sml
output/csvoutput.sml
output/modeloutput.sml
preprocessing/parser.sml
preprocessing/readargs.sml

core/main.sml

And here is the StackTrace of the last part of the compilation : 这是编译的最后部分的StackTrace:

Compile and Assemble starting
        gcc -std=gnu99 -c -I/usr/lib/mlton/targets/self/include \
            -I/usr/lib/mlton/include -O1 -fno-common -fno-strict-aliasing \
            -fomit-frame-pointer -w -m64 -o /tmp/file97aS8t.o \
            /tmp/fileTVXUNZ.16.c
        gcc -c -m64 -o /tmp/fileEW5l8Q.o /tmp/filelhsimY.15.s
        gcc -c -m64 -o /tmp/filea6cMXC.o /tmp/fileGkFaoi.14.s
        gcc -c -m64 -o /tmp/filefyCq0e.o /tmp/fileXt7CAu.13.s
        gcc -c -m64 -o /tmp/file6aM9Ln.o /tmp/filemFDLpo.12.s
        gcc -c -m64 -o /tmp/file0xIwuN.o /tmp/fileRzsHqU.11.s
        gcc -c -m64 -o /tmp/file1sxl2Y.o /tmp/fileqwIZGn.10.s
        gcc -c -m64 -o /tmp/filetuKGWV.o /tmp/fileTg7gK0.9.s
        gcc -c -m64 -o /tmp/filebtu3gE.o /tmp/fileLAXFmK.8.s
        gcc -c -m64 -o /tmp/file0pRNH2.o /tmp/fileNOAFB8.7.s
        gcc -c -m64 -o /tmp/fileTxaQrb.o /tmp/fileWkQghY.6.s
        gcc -c -m64 -o /tmp/fileqh3aE2.o /tmp/filesqqcMD.5.s
        gcc -c -m64 -o /tmp/fileYYijnB.o /tmp/fileaRCFoK.4.s
        gcc -c -m64 -o /tmp/file7xPbic.o /tmp/fileXYwRmD.3.s
        gcc -c -m64 -o /tmp/fileVsXNP1.o /tmp/filefrBd1m.2.s
        gcc -c -m64 -o /tmp/fileykpidV.o /tmp/fileMIX5MM.1.s
        gcc -c -m64 -o /tmp/file4eH2rC.o /tmp/filegwauVv.0.s
     Compile and Assemble finished in 0.96 + 0.00 (0% GC)
     Link starting
        gcc -o spartacus /tmp/file97aS8t.o /tmp/fileEW5l8Q.o /tmp/filea6cMXC.o \
            /tmp/filefyCq0e.o /tmp/file6aM9Ln.o /tmp/file0xIwuN.o \
            /tmp/file1sxl2Y.o /tmp/filetuKGWV.o /tmp/filebtu3gE.o \
            /tmp/file0pRNH2.o /tmp/fileTxaQrb.o /tmp/fileqh3aE2.o \
            /tmp/fileYYijnB.o /tmp/file7xPbic.o /tmp/fileVsXNP1.o \
            /tmp/fileykpidV.o /tmp/file4eH2rC.o -L/usr/lib/mlton/targets/self \
            -lmlton -lgdtoa -lm -lgmp -m64 -Wl,-znoexecstack
     Link finished in 0.14 + 0.00 (0% GC)
  MLton finished in 46.39 + 7.31 (14% GC)

I checked the MLTon documentation but I didn't see any information relative to the static compilation :/ 我检查了MLTon文档,但是我没有看到任何与静态编译有关的信息:/

If someone knows how to do it it will help me a lot ! 如果有人知道该怎么做,它会帮助我很多! Thanks in advance, 提前致谢,

Best Regards; 最好的祝福;


EDIT 编辑

On the Cluster, when I try to execute ./spartacus 在群集上,当我尝试执行./spartacus时

./spartacus: error while loading shared libraries: 
libgmp.so.10: cannot open shared object file: No such file or directory

You need to compile using -link-opt '-static' : 你需要使用-link-opt '-static'进行编译:

mlton -verbose 3 \
      -codegen native \
      -link-opt '-static' \
      -output spartacus \
      src/spartacus.mlb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM