Thrax is a grammar compiler developed by a team of researchers at Google Research. It depends on OpenFST. See for more details on how to configure and compile OpenFST.

Download and unpack the source of Thrax version 1.2.2 or newer.

See what options configure provides:

./configure –help

Since I need the static libraries, I added this option:


I also enabled the command line binaries:


and the readline library in the rewrite tester:


The last option presupposes that you have installed the devel-package for libreadline on your Mac OSX, Fedora, Ubuntu, or Windows with Cygwin.

You have to have the complete OpenFST library compiled and installed on your system. Thrax depends on some more extensions that are not compiled with the default configuration of OpenFST. Follow the instructions on the blog post how to compile OpenFST.

I also set the environment variable for Windows with Cygwin. In particular the library path information seems to be necessary since the make process might stop with the message that it cannot find libfst and libfstfar:

export CXXFLAGS=”-O -D_POSIX_SOURCE  -L/usr/local/lib -I/usr/local/include”

My complete configure command in the thrax-1.2.2 folder:

./configure –enable-static –enable-bin –enable-readline

To avoid issues with undefined ACCESSPERMS in the file thrax-1.2.2/src/lib/util/ you can add these three lines of code below the include statements (for example below line 31):


The maintainers of the Thrax code-base might want to add this anyway, since some operating systems do not declare ACCESSPERMS in the default. Cygwin on Windows does not.

To compile Thrax run:


Then follow up with a:

make install

On Mac OSX or Linux you might want to prepend a sudo to the command above.

That was it.