Error while running make command for srilm

1.3k views Asked by At

While executing make command, I recieve the following error:

/home/cse/phd/16071009/NLP//lib/i686-m64/libmisc.a(File.o): In function File::~File()': /home/cse/phd/16071009/NLP/misc/src/File.cc:127: undefined reference tolibiconv_close' /home/cse/phd/16071009/NLP//lib/i686-m64/libmisc.a(File.o): In function File::reopen(char const*, char const*)': /home/cse/phd/16071009/NLP/misc/src/File.cc:167: undefined reference tolibiconv_close' /home/cse/phd/16071009/NLP//lib/i686-m64/libmisc.a(File.o): In function File::reopen(char const*)': /home/cse/phd/16071009/NLP/misc/src/File.cc:217: undefined reference tolibiconv_close' /home/cse/phd/16071009/NLP//lib/i686-m64/libmisc.a(File.o): In function File::reopen(char const*, unsigned long, int)': /home/cse/phd/16071009/NLP/misc/src/File.cc:249: undefined reference tolibiconv_close' /home/cse/phd/16071009/NLP//lib/i686-m64/libmisc.a(File.o): In function File::reopen(std::string&, int)': /home/cse/phd/16071009/NLP/misc/src/File.cc:273: undefined reference tolibiconv_close' /home/cse/phd/16071009/NLP//lib/i686-m64/libmisc.a(File.o): In function File::fgetsUTF8(char*, int)': /home/cse/phd/16071009/NLP/misc/src/File.cc:387: undefined reference tolibiconv' /home/cse/phd/16071009/NLP/misc/src/File.cc:345: undefined reference to libiconv_open' /home/cse/phd/16071009/NLP/misc/src/File.cc:349: undefined reference tolibiconv_open' collect2: error: ld returned 1 exit status test -f ../bin/i686-m64/ngram make[2]: * [../bin/i686-m64/ngram] Error 1 make[2]: Leaving directory /home/cse/phd/16071009/NLP/lm/src' make[1]: *** [release-programs] Error 1 make[1]: Leaving directory/home/cse/phd/16071009/NLP' make: * [World] Error 2 [16071009@compute-01 NLP]$

1

There are 1 answers

0
Hieu Nguyen On

The -liconv appears nowhere in the link command, so that's why you're getting the undefined references. Try putting:

 SYS_LIBRARIES = -L<path-to-libiconv_install> -liconv

For example, if you install srilm on Ubuntu x64, edit this file: common/Makefile.site.i686-m64. Make sure the -L option points to the directory that has the libiconv.so or libiconv.a file.

For me, libiconv install srilm on Ubuntu 18.04 x64 using make are locate on /usr/local/lib. So I add following line to common/Makefile.site.i686-m64:

SYS_LIBRARIES = -L/usr/local/lib -liconv

Solution from: http://mailman.speech.sri.com/pipermail/srilm-user/2014q3/001694.html