EDIT: This is my original post, but the comments have newer and better instructions.
I always encounter problems when compiling SRILM on Ubuntu. Assuming the basic SRILM dependencies are installed on your system (see the Prerequisites), this works for SRILM 1.5.11 on Ubuntu 9.04 (Jaunty) and 10.04 (Lucid):
- Install tcsh if not already installed
- Install all the TCL developer libraries: tcl8.4-dev, tcl-dev, tcl-lib, tclx8.4, tclx8.4-dev. This step may not be necessary, let me know what works for you.
- Uncomment the “
SRILM =
” line in the top level Makefile and replace the existing path with the absolute path of the SRILM top-level directory on your system (where the Makefile resides) - Start the tcsh shell
- Type “
make NO_TCL=X MACHINE_TYPE=i686-gcc4 World > & make.log.txt
” to begin the build and capture stderr and stdout in a file - If you can run “
./bin/i686-gcc4/ngram-count -help
“, the build was probably a success
Please add simplifications to this recipe or extensions to other versions of Ubuntu in the comments.
December 1, 2010 at 1:31 pm |
Thank you so much for the instructions, they really helped me a lot.
A few notes:
It is necessary to install gawk (Ubuntu by default uses mawk) otherwise ALL tests will fail!
It is enough to just install tcl-dev (at least in Ubuntu 10.10). All other necessary Tcl libraries will be installed that way. Why one must install the tcl-dev when compiling without Tcl I don’t understand.
For me it wasn’t necessary to start tcsh. Using bash worked just as well.
It is possible to set machine type to MACHINE_TYPE=i686-ubuntu. I don’t know if that brings any advantages though
So here is my simplified version:
Install the following packages:
build-essential csh tcl-dev gawk
Uncomment the “SRILM =” line in the Makefile and set it to your directroy
run:
make NO_TCL=1 MACHINE_TYPE=i686-ubuntu World
To run the tests type do the following:
run:
export PATH=$PATH:/path_to_srilm_dir/bin/i686-ubuntu:/path_to_srilm_dir/bin
where path_to_srilm_dir is replaced with the actual SRILM directory
and then run:
make test
I tested that it works on a fresh Ubuntu 10.10 installation.
October 1, 2012 at 3:20 pm |
Thanks so much! Installing gawk solved my problem :)
May 26, 2011 at 11:56 am |
I’m still getting the following errors! :
ubuntu:~/MOSES/tools/srilm> make NO_TCL=1 MACHINE_TYPE=i686-ubuntu World
mkdir include lib bin
mkdir: cannot create directory `include’: File exists
mkdir: cannot create directory `lib’: File exists
mkdir: cannot create directory `bin’: File exists
make: [dirs] Error 1 (ignored)
make init
make[1]: Entering directory `/home/anakin/MOSES/tools/srilm’
for subdir in misc dstruct lm flm lattice utils; do \
(cd $subir/srcc; make SRILM=/home/anakin/MOSES/tools/srilm MACHINE_TYPE=i686-ubuntu OPTION= MAKE_PIC= init) || exit 1; \
dnee
/bin/sh: Syntax error: end of file unexpected (expecting “done”)
make[1]: *** [init] Error 2
make[1]: Leaving directory `/home/anakin/MOSES/tools/srilm’
make: *** [World] Error 2
May 26, 2011 at 5:49 pm |
It looks like the “Syntax error” is referencing the fact that the script has “dnee” where there should be the word “done”? Try correcting this in the script/makefile and see if that helps.
I’ll be playing around with new Ubuntu installs late next week, so I’ll try compiling SRILM again and report back.
June 26, 2011 at 5:36 pm |
I finally upgraded to Ubuntu 11.04 (Natty Narwhal) and compiled SRILM 1.5.12. The instructions by Jonas in an above comment are fantastic.
I had to use the “MACHINE_TYPE=i686-gcc4” flag because make complained about “gnu/stubs-64.h” when I used the “MACHINE_TYPE=i686-ubuntu” flag. I have a 32-bit processor/OS, so perhaps if you have a 64-bit OS the i686-ubuntu flag would work well or better?
Thanks again, Jonas!
June 26, 2011 at 6:00 pm |
I’m glad it helped
August 10, 2011 at 9:41 pm |
(In Ubuntu 10.10)
Yap…romanows is absolutely right. I have a 32-bit OS so i had to change to the previous flag(i686-gcc4). But otherwise Jonas instrcutions are just fine.
October 4, 2011 at 7:32 am |
everything wroked as per Jonas except this error
make init
make[1]: execvp: /home/ds/Project/srilm: Permission denied
…always encountering it . help
October 5, 2011 at 2:51 pm |
Maybe the file permissions prevent you from writing to one of the files in the srilm directory?
Try running “chmod -R u+wr srilm” from the “Project” directory. That should recursively set permissions on all files in srilm to allow reading and writing.
October 6, 2011 at 5:40 pm |
Done that, but still the problem persists
ds@Halo:~/Project/srilm$ make test
make: execvp: /home/ds/Project/srilm: Permission denied
….
….
October 13, 2011 at 2:50 pm |
Sorry, for the lag in replying. I don’t know what is going on with your install, unfortunately. There is an SRILM mailing list, I believe, and they could probably be of more help if you were able to post the full output from the makefile.
November 6, 2011 at 10:22 am |
Done, reinstalled it on upgraded Ubuntu 11.10. Use MACHINE_TYPE=i686-gcc4 instead of MACHINE_TYPE=i686-ubuntu(this gave errors in 11.10).
November 23, 2012 at 10:30 am |
If you’re running a 64-bit machine and encounter “fatal error: bits/predefs.h: No such file or directory”, you might need to install libc6-dev-i386
March 12, 2013 at 5:36 pm |
make init
make[1]: execvp: /home/ds/Project/srilm: Permission denied
I figured out that above error was occuring in my case under ubuntu 12.04 due to files being upacked into a folder named srilm. After unpacking files into a folder named srilmx.x.x where x.x.x is version number it worked fine.