[[TOC]] = Compiling GRASS on MS-Windows = == Dependencies required for building with MinGW == Compiling your own copy of '''GRASS''' is greatly simplified by using the '''MSYS2''' and '''OSGeo4W''' directory structure to install most dependencies and downloading the rest from a few other locations. Follow the steps below to set up the build environment for GRASS GIS. === Install the OSGeo4W directory structure === OSGeo4W has several of the required dependencies for compiling GRASS GIS: 1. Download the '''OSGeo4W installer''' - [http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe 32bit] or [http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe 64bit] 2. Run the installer. 3. Select `Advanced Install`, and `Next`. 4. Set the install directory to `C:\OSGeo4W` (32bit) or `C:\OSGeo4W64` (64bit) (other directories are fine if there are no spaces in the path but make sure to adjust the instructions below). The MSYS maintainers have made it clear that they [https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1511614&group_id=2435 will not support spaces in path names] nor accept patches fixing those issues. With some patches to `msys.bat` however it is possible to install a built GRASS into `C:\Program Files\`. 5. Select: * '''cairo''' * '''gdal''' * '''geos''' * '''fftw''' * '''fftw-devel''' (32bit only) * '''freetype-devel''' * '''freetype-devel-mingw''' (32bit only) * '''iconv''' * '''libjpeg''' * '''liblas-devel''' * '''libpng''' * '''libpq''' * '''libtiff''' * '''libxdr''' * '''pdcurses''' * '''proj''' * '''regex-devel''' * '''sqlite3''' * '''zlib''' 7. Optionally select also GDAL plugins for common GIS formats (be careful not to introduce GPL incompatibilities) * '''gdal-ecw''' * '''gdal-mrsid''' 8. Click `Next`, the selected packages and their required subpackages will be downloaded and installed automatically. === Install the MSYS2 directory structure === [https://msys2.github.io/ MSYS2] has several of the required dependencies for compiling GRASS GIS (like `gcc` and others): 1. Download and install MSYS2 - [http://repo.msys2.org/distrib/i686/msys2-i686-20150916.exe 32bit] or [http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20150916.exe 64bit]. 2. Start MSYS2 terminal and install requirements (both 32bit and 64bit): {{{ pacman -S tar libintl make bison diffutils subversion dos2unix }}} 3. Install MinGW-w64 toolchain: * 32bit: {{{ pacman -S mingw-w64-i686-toolchain mingw-w64-i686-cairo mingw-w64-i686-python2-numpy mingw-w64-i686-sqlite3 }}} * 64-bit: {{{ pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cairo mingw-w64-x86_64-python2-numpy mingw-w64-x86_64-sqlite3 }}} == Compiling and Installing GRASS GIS == Start '''MSYS2''' terminal - `mingw32_shell.bat` (32bit) or `mingw64_shell.bat` (64bit). 1. Download GRASS source code (see wiki:DownloadSource for details). Example for development version (trunk): {{{ cd /usr/src svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk }}} 2. Switch to GRASS GIS source code directory (in our case `grass_trunk`) and run `package.sh` compilation script: {{{ cd grass_trunk # for release builds on 32bit ./mswindows/osgeo4w/package.sh # for daily builds on 32bit PACKAGE_POSTFIX=-daily ./mswindows/osgeo4w/package.sh # for release builds on 64bit OSGEO4W_POSTFIX=64 ./mswindows/osgeo4w/package.sh # for daily builds on 64bit PACKAGE_POSTFIX=-daily OSGEO4W_POSTFIX=64 ./mswindows/osgeo4w/package.sh }}} 3. Check {{{error.log}}} for any error messages and {{{mswindows/osgeo4w/package.log}}} if you're having problems. GRASS GIS should now be installed in {{{c:\osgeo4w\apps\grass\grass-7.1.svn}}}. === Usage === To start GRASS use the icon on the desktop or if you want to be able to use the command line from within GRASS. Type in cmd console (assuming that we compiled GRASS 7.1): {{{ c:\osgeo4w\bin\grass71svn.bat }}} == Creating a WinGRASS Installer == The instructions for creating a WinGRASS native installer (self-contained package installer) using the scripts contained in the [source:grass/trunk/mswindows mswindows] directory. In order to avoid mistakes or misunderstandings, we highly recommend to follow each step and command exactly as they are written in this document. See also [source:grass-addons/tools/wingrass-packager scripts] used for [http://wingrass.fsv.cvut.cz daily builds]. === Install MSYS2/OSGeo4W Tree and Compile GRASS === First of all download the MSYS2, OSGeo4W installers, install the required dependencies, and build GRASS GIS from source (see notes above). Do not move on to step two until you have successfully [wiki:HowToTestGrass6 tested] your new version of GRASS. === Create a GRASS self-contained Package === 1. Copy all the content of the {{{mswindows}}} directory to a temporary directory, for example {{{c:\temp}}}. 2. Launch the file {{{c:\temp\GRASS-Packager.bat}}}. 4. When finished, you should have a GRASS self-contained release package in {{{c:\temp\GRASS--Package}}}, e.g. {{{c:\temp\GRASS-70-Package}}}. === Install NSIS (2.46) === 1. Download the [http://sourceforge.net/projects/nsis/files/NSIS%202/2.46/nsis-2.46-setup.exe/download NSIS installer] 2. Install to {{{c:\DevTools}}} === Install NSIS: Untgz Plugin (1.0.16) === 1. Download the [http://www.fdos.org/win32/nsis/plugins/untgz.1.0.16.zip NSIS Untgz Plugin] 2. Unzip to {{{c:\DevTools\Plugins\}}} === Install NSIS: !AccessControl Plugin === 1. Download the [http://nsis.sourceforge.net/AccessControl_plug-in NSIS AccessControl Plugin] 2. Unzip to {{{c:\DevTools\}}} === Create the WinGRASS Installer === 1. Launch {{{c:\temp\GRASS-Installer.nsi}}}. 5. When finished, you should have the WinGRASS release installer in {{{c:\temp}}}. == Misc == === Ghostscript === [http://grass.osgeo.org/wiki/WxGUI_Cartographic_Composer wxGUI Cartographic Composer] requires [http://www.ghostscript.com/ Ghostscript]. Install [http://trac.osgeo.org/osgeo4w/wiki/pkg-gs gs package] from OSGeo4W. === LibreDWG === Required by GRASS Addons [source:grass-addons/grass7/vector/v.in.redwg v.in.redwg]. 1. Download http://www.gnu.org/software/libredwg/ TODO: Finish this part. === E00conv === (dependency for G7:v.in.e00) Download http://avce00.maptools.org/e00compr/e00conv.exe and copy to C:\OSGeo4W\bin. == TODO == * Establish 64bit builds == winGRASS-64bit-notes == external notes for building windows 64bit-binaries: * [http://lists.osgeo.org/pipermail/osgeo4w-dev/2013-August/002362.html OSGeo4W-64bit inital notes] * [http://trac.osgeo.org/grass/ticket/2095 GRASS changes for OSGeo4W 64bit] * [http://cran.r-project.org/doc/manuals/R-admin.html#Building-R-for-64_002dbit-Windows Building R for 64-bit Windows] * [http://www.gaia-gis.it/gaia-sins/mingw64_how_to.html Building SpatiaLite for 64-bit Windows] * [http://gvsigce.sourceforge.net/wiki/index.php/Setting_up_the_GNU_Compiler_Collection#Windows gvSIG and MinGW-w64 (C/C++ compiler)] * [http://download.osgeo.org/osgeo4w/x86_64/release/grass/grass-6.4.3-5-src.tar.bz2 recipe used to build GRASS 6.4.3 on OSGeo4W in 64bit] tool chains for building windows 64bit-binaries: * [http://mingw-w64.sourceforge.net/ MinGW-w64 - GCC for both 64 & 32 bits Windows] * [http://tdm-gcc.tdragon.net/ TDM-GCC - A compiler suite for 32- and 64-bit Windows based on the GNU toolchain] * [http://www.drangon.org/mingw/ Native windows x64 software develop with Mingw-w64] packages to include in OSGeo4W-64bit for a build/compile environment: * update `mingw` package * [http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_i686-mingw_20111220.zip MinGW-w64] or [http://sourceforge.net/projects/mingwbuilds/ MinGW-builds] * [http://www.drangon.org/mirror.fcgi?num=3&fname=mingw_dgn_lib-w64-bin-x86_64-20140518.7z mingw devel library] or [http://sourceforge.net/projects/mingw-w64-dgn/ mingw-w64-dgn at sourceforge] missing packages in OSGeo4W-64bit * `libintl` * `tcltk` * `freetype-mingw` * `libcairo` == Hints == == Startup errors after installation == See here: http://grass.osgeo.org/wiki/WinGRASS_errors == See also == * [http://trac.osgeo.org/osgeo4w/wiki/pkg-grass GRASS package page in OSGeo4W] (including [http://trac.osgeo.org/osgeo4w/wiki/pkg-grass#PackagerNotes packaging notes]) * [wiki:BuildingOnWindows Develop your own GRASS modules on MS-Windows] * http://wiki.qgis.org/qgiswiki/BuildingFromSource by QGIS Team * http://www.webalice.it/marco.pasetti/grass/BuildFromSource.html by Marco Pasetti * http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html by Marco Pasetti * Besides Cygwin and MinGW there is another along similar lines called "som" or "gow" or something? == Errata == * see also [http://trac.osgeo.org/osgeo4w/wiki/pkg-grass#Errata OSGeo4W pkg-grass buglist] * Some anti-virus software seem to think that the ''r.out.png.exe'' module (etc.) is a sneaky attempt to fool you into thinking it's an image instead of what it really is: a program which exports a PNG file. ''g.version'' is also reported to set them off. You'll have to bypass these over-zealous warnings as appropriate. * Large File support ("LFS", >2GiB) is currently not supported for 32bit versions of Windows. A 64bit build of GRASS (or more accurately a build of the support libraries needed to build 64bit GRASS) is still in development. === Open Tickets === '''winGRASS 6:''' [[TicketQuery(status=new|assigned|reopened&keywords~=wingrass&milestone=!7.0.0)]] '''winGRASS 7:''' [[TicketQuery(status=new|assigned|reopened&keywords~=wingrass&milestone=7.0.0)]] === Closed Tickets === [[TicketQuery(status=closed&keywords~=wingrass)]]