1BUILDING on Windows (MinGW/MSYS2) 2================================= 3 4General 5------- 6In this document we will suppose you use a 64-bit machine. 7 8MinGW/MSYS2 uses the Gnu toolset to compile Windows programs for 9Windows. This is probably the easiest way to obtain workable Java 10bindings for Windows. 11 12In order to prepare this document, MSYS2 version 20161025 was installed. 13 14A note for new MSYS2 users 15-------------------------- 16Download and install MinGW/MSYS2 from http://msys2.org. 17 18MSYS2 uses the `pacman` package management. If you are not familiar 19with it, consult the 20[Pacman Rosetta](https://wiki.archlinux.org/index.php/Pacman/Rosetta). 21 22Also note that MSYS2 have two working modes (shells): MSYS and MINGW64. 23The difference between them is the value of environment variables, e.g. 24PATH, PKG_CONFIG_PATH and MANPATH. For native Windows software 25development, the MINGW64 shell must be used (the MSYS shell is for 26MinGW/MSYS2 development- applications compiled from it recognize the MSYS 27virtual filesystem). 28 29First install `mingw-w64-x86_64-toolchain`. Also install the rest of the 30prerequisite tools from the list in the main 31[README](/README.md#building-from-the-github-repository). 32 33NOTE: You must also install **mingw-w64-x86_64-pkg-config** . 34 35You may find that the system is extremely slow. In that case, consult the 36Web for how to make tweaks that considerably speed it up. In addition, to 37avoid I/O trashing, don't use a too high `make` parallelism (maybe even 38only `-j 2`). 39 40Packages that are used by the link-grammar library 41-------------------------------------------------- 42 43mingw-w64-x86_64-sqlite3<br> 44mingw-w64-x86_64-libtre-git<br> 45mingw-w64-x86_64-gettext<br> 46mingw-w64-x86_64-hunspell, mingw-w64-x86_64-hunspell-en (optional)<br> 47zlib-devel (optional - for the SAT parser)<br> 48mingw-w64-x86_64-python2<br> 49mingw-w64-x86_64-python3<br> 50 51Java bindings 52------------- 53Install [Apache Ant](ant.apache.org/manual/install.html) and 54Java JDK & JRE (both under Windows). Make sure you have 55the environment variable JAVA_HOME set as needed (under Windows, 56the MINGW64 shell will inherit it). 57 58Then build and install link-grammar with 59 60 mkdir build 61 cd build 62 ../configure 63 make 64 make install 65 66In MINGW64, the default install prefix is `/mingw64` which is mapped to 67`C:\msys64\mingw64`, so after 'make install', the libraries and executable 68will be found at `C:\msys64\mingw64\bin` and the dictionary files at 69`C:\msys64\mingw64\share\link-grammar`. 70 71 72Python bindings 73--------------- 74The bindings for Python2 (2.7.15) and Python3 (3.7.0) work fine.<br> 75All the tests pass (when configured with `hunspell` and the SAT parser). 76 77Here is a way to work with python3 from Windows: 78``` 79C:\>cd \msys64\mingw64\bin 80C:\msys64\mingw64\bin>.\python3 81Python 3.7.0 (default, Jul 14 2018, 09:27:14) [GCC 7.3.0 64 bit (AMD64)] on win32 82Type "help", "copyright", "credits" or "license" for more information. 83>>> from linkgrammar import * 84>>> print(Sentence("This is a test",Dictionary(),ParseOptions()).parse().next().diagram()) 85 86 +----->WV----->+---Ost--+ 87 +-->Wd---+-Ss*b+ +Ds**c+ 88 | | | | | 89LEFT-WALL this.p is.v a test.n 90 91>>> 92``` 93 94Test results 95------------ 96All the `tests.py` tests pass, and also `make installcheck` is fine. 97From the tests in the `tests/`directory, the `multi-thread` test fails due to segfault 98at the hunspell library (a fix for that is being investigated). Regretfully, using 99Aspell for now is not an option, as it is not available yet for MinGW. 100 101BTW, here is how to run the `java-multi` test directly:<br> 102`cd tests; make TEST_LOGS=multi-java check-TESTS` 103 104Running 105------- 106On MINGW64, just invoke `link-parser`.<br> 107In Windows, put `C:\msys64\mingw64\bin` in your PATH (or `cd` to it), then invoke `link-parser`. 108On both MINGW64 and Windows console, you can invoke `mingw/link-parser.bat`, which also 109sets PATH for the `dot` and `PhotoViewer` commands (needed for the wordgraph display feature). 110For more details see [RUNNING the program](/README.md#running-the-program). 111