undefined reference to `gzopen' 'gzwrite' and 'gzclose'

There is one problem puzzled me two days when I compile the newest Moses download fromhttp://www.statmt.org/moses/

The decoder is carried out very well, while compiling the SCRIPS directories, here comes the problem as shown in Fingure 1:

/home/tianliang/research/moses-smt/scripts/training/lexical reordering/reordering_classes.cpp:379: undefined reference to `gzopen'

/home/tianliang/research/moses-smt/scripts/training/lexical-reordering/reordering_classes.cpp:383: undefined reference to `gzwrite'

/home/tianliang/research/moses-smt/scripts/training/lexical-reordering/reordering_classes.cpp:386: undefined reference to `gzclose'


 

Figure 1: The problem that I have met during the compilation

I have googled but failed to find any relevant answer, fortunately I finally found the answer:

Go the the folder:

/research/moses-smt/scripts/training/lexical-reordering/

and then edit the Makefile:The origianl Makefile is:

all: score

clean:

         rm -f *.o

.cpp.o:

          $(CXX) -O6 -g -c {1}lt;

score: score.cpp reordering_classes.o

          $(CXX) -lz score.cpp reordering_classes.o -o score

#reordering_classes.o: reordering_classes.h reordering_classes.cpp

#        $(CXX) reordering_classes.cpp 

Now change the file codes to:

all: score

clean:

         rm -f *.o

.cpp.o:

          $(CXX) -O6 -g -c {1}lt;

score: score.cpp reordering_classes.o

          $(CXX) score.cpp reordering_classes.o-lz -o score

#reordering_classes.o: reordering_classes.h reordering_classes.cpp

#        $(CXX) reordering_classes.cpp 

That's to say, Editing the Makefile to put -lz afterwards.
Now it can work!!!!

 

你可能感兴趣的:(系统开发)