Damir Cavar's Homepage

Logo

Damir Cavar is a Natural Language Processing, AI, and Knowledge Representation scientist

curriculum vitae

publications

talks

research

teaching

code

blog

View My GitHub Profile

17 July 2016

Compiling OpenFST on Windows 10 using Cygwin

by Damir Cavar

What might compile on Fedora or Ubuntu out of the box, can be somewhat more complicated on Windows. Assuming that you are able to set up Cygwin on your Windows 10 (in my case) and also install all the development tools (e.g. GCC, G++, bison, flex, etc.), here is how I compiled the newest OpenFST (v. 1.5.3 in this case) library and tools for Cygwin (doing a compilation to DLLs for Windows native based on Visual Studio 2015 or so might follow soon):

To avoid issues with the file too big error during compilation, switch on optimization in C++ (capital O like in Omega):

-O

To avoid issues with errors like ‘fileno’ was not declared in this scope one needs to compile the code with POSIX_SOURCE set.

In the Cygwin bash set the environment variables (first one is not necessary):

export CFLAGS=-D_POSIX_SOURCE
export CXXFLAGS=”-O -D_POSIX_SOURCE”

In the source folder openfst-1.5.3 run configure. Check for the modules and extensions that you want to have compiled (use for example ./configure –help) I activated most of the extensions for use in or required by other tools and libraries:

./configure –enable-static –enable-bin –enable-compact-fsts –enable-compress –enable-const-fsts –enable-far –enable-linear-fsts –enable-lookahead-fsts –enable-mpdt –enable-ngram-fsts –enable-pdt

If you want the Python extensions, add this parameter and make sure that your Python-dev package is installed:

–enable-python

Compile the code using:

make

Install it in the Cygwin file-structure:

make Install

That is it.

tags: OpenFST "Natural Language Processing" "Machine Learning" ML NLTK WFST C++ "Finite State" Cygwin Windows