Closed GoogleCodeExporter closed 8 years ago
hi, which linux distro. are you using?
try this slightly modified Makefile, it works on (some of) my 32bit machines.
################################################################################
INC = -Isrc
CXXFLAGS = -g -Wall -fPIC -fmessage-length=0 $(INC)
FFLAGS = -g -fPIC -fmessage-length=0
LDFLAGS = -L. -lmitlm -lgfortran
FORTRAN = gfortran
FC = gfortran
F77 = gfortran
ifdef GPROF
CXXFLAGS += -pg
LDFLAGS += -pg
endif
ifdef DEBUG
CXXFLAGS += -O0 -fno-inline
else
CXXFLAGS += -O2 -DNDEBUG -funroll-loops
FFLAGS += -O2 -DNDEBUG -funroll-loops
LDFLAGS += -O2 -funroll-loops
endif
UTIL_SOURCES = src/util/RefCounter.cpp src/util/Logger.cpp
src/util/CommandOptions.cpp
SOURCES = $(UTIL_SOURCES) src/Vocab.cpp src/NgramVector.cpp \
src/NgramModel.cpp src/NgramLM.cpp src/InterpolatedNgramLM.cpp \
src/Smoothing.cpp src/MaxLikelihoodSmoothing.cpp
src/KneserNeySmoothing.cpp \
src/PerplexityOptimizer.cpp src/WordErrorRateOptimizer.cpp \
src/Lattice.cpp
UTIL_OBJECTS = $(UTIL_SOURCES:.cpp=.o)
OBJECTS = $(SOURCES:.cpp=.o) src/optimize/lbfgsb.o src/optimize/lbfgs.o
# Core MITLM utilities
all: estimate-ngram interpolate-ngram evaluate-ngram
libmitlm.a: $(OBJECTS)
ar rcs $@ $(OBJECTS)
estimate-ngram: libmitlm.a src/estimate-ngram.o
$(CXX) src/estimate-ngram.o -o $@ $(LDFLAGS)
interpolate-ngram: libmitlm.a src/interpolate-ngram.o
$(CXX) src/interpolate-ngram.o -o $@ $(LDFLAGS)
evaluate-ngram: libmitlm.a src/evaluate-ngram.o
$(CXX) src/evaluate-ngram.o -o $@ $(LDFLAGS)
# Build scripts
clean:
rm -f $(OBJECTS) src/*.o test/*.o mitlm.tgz
rm -f estimate-ngram interpolate-ngram evaluate-ngram libmitlm.a
dist: clean
cd ..; tar czvf mitlm.tgz --exclude=".*" mitlm/; cd mitlm; mv ../mitlm.tgz .
################################################################################
##
Yet I couldn't managed to compile it on any 64bit machine, keep saying
src/NgramLM.cpp:XXX: undefined reference to 'void NgramModel::ApplySort<int>....
any luck out there?
Original comment by Newway....@gmail.com
on 4 Jan 2010 at 6:16
Thanks for the suggestion. I was using Debian 4.0, where it worked for both 32
and
64 bits.
NgramModel::ApplySort<T> is declared in NgramModel.h and defined in
NgramModel.cpp.
The particular template instantiations for ApplySort<int> and ApplySort<double>
are
further defined in NgramModel.cpp. I hypothesize that the 64-bit compiler you
are
using does not fully support C++ templates.
Since I cannot reproduce your error, can you please try moving the template
instantiations of ApplySort<int> and ApplySort<double> (NgramModel.cpp:812-817)
to
NgramModel.h:121?
Thanks.
Paul
Original comment by bojune...@gmail.com
on 5 Jan 2010 at 5:22
I had the same problems with Debian 6.0 with gcc 4.4.5.
The compiler not found issue is resolved by using the suggested Makefile, or by
using the autotools build system in revision 45. You have to install autoconf,
automake and libtool to use this build system. Then issue
./autogen.sh --prefix=$(pwd)/usr
make
make install
to build mitlm.
The undefined reference issue is resolved by moving the template from the
NgramModel.cpp to the NgramModel.h file. It should be fixed in revision 42.
Does revision 45 solves these issue for you too?
Original comment by giuliop...@gmail.com
on 17 Nov 2010 at 10:59
Original comment by giuliop...@gmail.com
on 29 Jan 2013 at 7:11
Original issue reported on code.google.com by
hlo...@gmail.com
on 5 Nov 2009 at 12:56