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

遇到Moses下载最新版本后,在编译过程中遇到的问题,通过编辑Makefile将-lz参数添加到链接命令中,成功解决了编译错误。具体操作包括定位问题文件,修改Makefile配置,最终使得编译过程顺利进行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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!!!!

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值