nuance1979 / srilm-python

Python binding for SRI Language Modeling Toolkit implemented in Cython
MIT License
29 stars 7 forks source link

srilm-python won't compile with srilm make World OPTION=_c; mention in docs (or fixable?) #1

Closed muneson closed 8 years ago

muneson commented 8 years ago

Hi,

probably a documentation bug. The srilm INSTALL mentions several flags that can be used to make World, notably OPTION=_c for a somewhat slower but less memory-hungry system (I use this often). Now, this option (and others?) do not play well with srilm-python. No big deal, except it should be mentioned in the docs, as the output from c++ (below) is not so enlightening.

c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/srilm/vocab.o ../lib/i686-m64/liboolm.a ../lib/i686-m64/libdstruct.a ../lib/i686-m64/libmisc.a ../lib/i686-m64/libz.a -L../lib/i686-m64 -llbfgs -o build/lib.linux-x86_64-2.7/srilm/vocab.so -fopenmp
/usr/bin/ld: ../lib/i686-m64/liboolm.a(Vocab.o): relocation R_X86_64_32S against `_ZN5Vocab7getWordEj' can not be used when making a shared object; recompile with -fPIC
../lib/i686-m64/liboolm.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'c++' failed with exit status 1
nuance1979 commented 8 years ago

Thanks for reporting the issue! And sorry for the late reply. I've found the problem and fixed it.

However, looking at your error message, you should rebuild your SRILM with MAKE_PIC=1:

$ make OPTION=_c HAVE_LIBLBFGS=1 MAKE_PIC=1 World

After that, just supply the same OPTION to make srilm-python:

$ cd srilm-python
$ make OPTION=_c

Note that you'll see one test failure. I believe it's a minor SRILM bug in CacheLM.