Installing GF on Windows

Inari Listenmaa
inari.listenmaa@gmail.com
July 2013–August 2020

1. Install GF

Easiest option: download and unpack Windows binary package

Go to the page grammaticalframework.org/download and download the Windows package, a zip file named gf-<VERSION>-bin-windows.zip. At the moment of writing this (August 2020), the latest version is gf-3.10.

See section 2 for setting up environment variables.

Alternative options: compile from source or install from Hackage

See general instructions on GF website. If you want to compile from source on Windows, you need some kind of Unix-like compatibility layer, like Cygwin or MinGW.

If you run into any problems on Windows, consider reporting it on GitHub issues.

(If you're running an old computer, you can try your luck with these instructions from 2013.)

2. Add GF to your PATH and libraries to GF_LIB_PATH

You need to edit or create two environment variables: Path and GF_LIB_PATH. If you don't know where to edit them, you can search google.com/search?hl=en&q=windows 10 environment variables.

Setting environment variables for the path C:\Users\2jtsm\OneDrive\Documents\Grammatical-Framework-tutorial\gf-3.10 The picture shows the environment variables of a user who downloaded the GF binary in the location shown in the picture. If you compiled from source, use the appropriate path instead (it won't probably be called gf-3.10).

With these variables, you can use GF from command line and import RGL modules in the GF shell anywhere.

Possible problems

UTF-8 decoding error while compiling (while compiling from source)
For the error message
    <built-in>:0:4: lexical error (UTF-8 decoding error)
write set lang=C in the command prompt and try cabal install or stack install again.


Invalid characters (while using GF)
First, a warning: Windows can be still very difficult with encodings.
Some solutions:
  1. Check your font. If you are using raster fonts, they can't display all characters. Right click your command prompt, go to Properties and Font tab, and choose Lucida or Consolas.
  2. Check your code page. Type chcp in your command prompt to see your active code page. You can change it to Latin 1 by typing chcp 1252, Latin 2 by typing chcp 852, etc. -- see list of code pages. In principle you can change it to UTF-8 by typing chcp 65001, but there are problems with GF, it might not work.
    • You can change the code page also when you are running the GF shell. To give any system command without leaving GF, just write a ! before the command. ! chcp shows you the code page and ! chcp XXXX changes it.

Out of memory when linking (while using GF)
This is not a Windows specific problem, it happens with some bigger .gfo files. You can start GF giving it a little more memory. For 100 MB, start GF by typing gf +RTS -K100M -RTS in the command prompt.

Libraries not found (while using GF)
When you try to import e.g. LangIta.gfo, it says something like
None of these files exists:
  LangIta.gfo
  C:\Users\YourName\SomePath\LangIta.gfo
Look at the second line prior to the filename (C:\...\SomePath\). Is it really the path where you have your libraries? If not, go change (or create) your GF_LIB_PATH environment variable, see instructions at section 2.

Something else
Report the issue on GitHub.
Alternatively, you can ask by email: join the gf-dev mailing list and search for your problem/send your question.
Third alternative, you can ask on IRC: join the GF IRC channel #gf on Freenode or ask me directly, my nick is inariksit. (This is still current in 2020.)