desilinguist / swig-srilm Goto Github PK
View Code? Open in Web Editor NEWSWIG Wrapper for the SRILM toolkit
SWIG Wrapper for the SRILM toolkit
โก make
...
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
srilm.c:142:11: error: use of undeclared identifier 'strdupa'; did you mean 'strdup'?
scp = strdupa(ngramstr);
^~~~~~~
strdup
/usr/include/string.h:117:7: note: 'strdup' declared here
char strdup(const char *);
^
srilm.c:176:11: error: use of undeclared identifier 'strdupa'; did you mean 'strdup'?
scp = strdupa(ngramstr);
^~~~~~~
strdup
/usr/include/string.h:117:7: note: 'strdup' declared here
char *strdup(const char *);
^
srilm.c:206:11: error: use of undeclared identifier 'strdupa'; did you mean 'strdup'?
scp = strdupa(sentence);
^~~~~~~
strdup
/usr/include/string.h:117:7: note: 'strdup' declared here
char *strdup(const char *);
^
3 errors generated.
make: ** [srilm.o] Error 1
I guess instead of strdupa strdup should be used for the sake of the compilation of the modules.
Is it possible to get the probability of higher than trigram like 4-gram or 5-gram?
Some information:
I'm trying to make the perl module in the swig-srilm.
I was doing it like it is in the README file. I already followed all the previous steps, changed the paths of the variables in the file Makefile, but when I try to execute the command "make perl" I keep getting this error:
g++ -shared srilm.o srilm_perl_wrap.o -loolm -ldstruct -lmisc -lz -lgomp -L/home/farid/Documents/6to/NLP/SRLIM/lib/i686-m64/ -o srilm.so
/usr/bin/ld: /home/farid/Documents/6to/NLP/SRLIM/lib/i686-m64//liboolm.a(Prob.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/farid/Documents/6to/NLP/SRLIM/lib/i686-m64//liboolm.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:20: recipe for target 'srilm.so' failed
make: *** [srilm.so] Error 1
I already tried including the -fPIC but the error is still there, I tried deleting the shared field in the command but instead I get another error:
g++ srilm.o srilm_perl_wrap.o -loolm -ldstruct -lmisc -lz -lgomp -L/home/farid/Documents/6to/NLP/SRLIM/lib/i686-m64/ -o srilm.so
/usr/bin/ld: /home/farid/Documents/6to/NLP/SRLIM/lib/i686-m64//liboolm.a(Vocab.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:20: recipe for target 'srilm.so' failed
make: *** [srilm.so] Error 1
My Makefile:
SRILM_LIBS=/home/farid/Documents/6to/NLP/SRLIM/lib/i686-m64/
SRILM_INC=/home/farid/Documents/6to/NLP/SRLIM/include/
PYTHON_INC=/opt/python/2.7/include/python2.7
PERL_INC=/usr/lib/x86_64-linux-gnu/perl/5.20.2/CORE/
python: clean _srilm.so
_srilm.so: srilm.o srilm_python_wrap.o
g++ -shared $^ -loolm -ldstruct -lmisc -lz -lgomp -L$(SRILM_LIBS) -o $@
srilm_python_wrap.o: srilm_python_wrap.c
g++ -c -fpic $< -I/usr/local/include/ -I$(SRILM_INC) -I$(PYTHON_INC)
srilm_python_wrap.c: srilm_python.i
swig -python $<
perl: clean srilm.so
srilm.so: srilm.o srilm_perl_wrap.o
g++ -shared $^ -loolm -ldstruct -lmisc -lz -lgomp -L$(SRILM_LIBS) -o $@
srilm_perl_wrap.o: srilm_perl_wrap.c
g++ -c -fpic $< -I/usr/local/include/ -I$(SRILM_INC) -I$(PERL_INC)
srilm_perl_wrap.c: srilm_perl.i
swig -perl $<
srilm.o: srilm.c
g++ -c -fpic $< -I/usr/local/include/ -I$(SRILM_INC) -I$(PYTHON_INC)
clean:
\rm -fr srilm.o srilm_*_wrap.* *.so srilm.py* srilm.pm
I'm trying to install the wrapper but I keep getting multiple errors.
I've tried with the OS X shipped GCC and GCC installed using home-brew (versions 4.9 and 5).
Any other suggestions?
/Users/zeerakw/Masters/Projects/Haiku_Project/System/lib/srilm/include/zio.h:105:49: error: conflicting declaration of C function 'FILE* zopen(const char_, const char_)'
FILE * zopen (const char name, const char *mode);
^
In file included from /usr/include/wchar.h:90:0,
from /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/cwchar:44,
from /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/bits/postypes.h:40,
from /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/iosfwd:40,
from /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/ios:38,
from /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/ostream:38,
from /usr/local/Cellar/gcc49/4.9.3/include/c++/4.9.3/iostream:39,
from /Users/zeerakw/Masters/Projects/Haiku_Project/System/lib/srilm/include/Counts.h:17,
from /Users/zeerakw/Masters/Projects/Haiku_Project/System/lib/srilm/include/Prob.h:20,
from srilm.c:1:
/usr/include/stdio.h:463:7: note: previous declaration 'FILE zopen(const char_, const char_, int)'
FILE zopen(const char *, const char *, int);
^
srilm.c: In function 'float getBigramProb(Ngram, const char_)':
srilm.c:88:27: error: 'strdupa' was not declared in this scope
scp = strdupa(ngramstr);
^
srilm.c: In function 'float getTrigramProb(Ngram_, const char_)':
srilm.c:122:27: error: 'strdupa' was not declared in this scope
scp = strdupa(ngramstr);
^
srilm.c: In function 'float getNgramProb(Ngram_, const char_, unsigned int)':
srilm.c:151:27: error: 'strdupa' was not declared in this scope
scp = strdupa(ngramstr);
^
srilm.c: In function 'unsigned int sentenceStats(Ngram_, const char_, unsigned int, TextStats&)':
srilm.c:191:27: error: 'strdupa' was not declared in this scope
scp = strdupa(sentence);
^
make: *_* [srilm.o] Error 1
I ran into a problem getting swig-srilm to play nicely with the srilm libraries on my system, with the error:
/usr/bin/ld: /home/jmoore/src/loglanguage/srilm/srilm/lib/i686-m64/liboolm.a(Prob.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/jmoore/src/loglanguage/srilm/srilm/lib/i686-m64/liboolm.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [_srilm.so] Error 1
As the error states, I needed to recompile Prob.o (and all the other srilm libraries) with the -fPIC flag to G++.
I couldn't find how to do that the "right" way, so I ended up editing the $SRILM/common/Makefile.machine.i686-m64 to add -fPIC to the GCC_FLAGS line.
My suggestion is to mention this in the documentation (readme or somewhere) in case somebody else runs into this same problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.