Prev (Coding Guideline) | Home | Manual | (Add translations) Next


Compiling and Building QMapShack for Windows

Foreword

The following description explains how the QMapShack windows binaries provided for download at https://bitbucket.org/maproom/qmapshack/downloads are created.

I try to keep a balance between providing a complete but still reasonably compact description. So, depending on the setup of your development machine (e.g. language settings) you might have to make some adaptations which may not be described here in full detail. So please be prepared for some improvizatizon, e.g. when adapting path names or resolving start menu entries.

Of course, there might be other ways to create windows binaries, e.g. with other compiler tool chains. If you succeed, you are encouraged to create a build description on a separate Wiki page.

General remarks

QMapShack for Windows (short: QMS) is build with Visual Studio 2013 as 64bit application.

Note: You don’t have to buy Visual Studio 2013. The free-of-charge Visual Studio 2013 Community-Edition works, too. Instead of Visual Studio 2013, Visual Studio 2015 should also work. Maybe we switch to 2015 sooner or later due to its improved C++-11 support (https://msdn.microsoft.com/library/hh567368.aspx#featurelist)

Required tools for building and installing

Compile instructions

C1.) Compile the GDAL library, http://www.gdal.org/

Build instructions inspired by http://trac.osgeo.org/gdal/wiki/BuildingOnWindows, http://dominoc925.blogspot.de/2013/03/build-64-bit-gdal-for-windows.html

  MSVC_VER=1800
  # NOTE: MSVC_VER=1800 corresponds to Visual Studio 2013
  GDAL_HOME = "M:\lib\gdal"
  # NOTE: GDAL_HOME specifies where the build results will be stored
  # NOTE: try to avoid path names with spaces and non-ASCII characters and in case of trouble try without quotes
  WIN64=YES
  nmake /f makefile.vc
  nmake /f makefile.vc devinstall

C2.) Compile the PROJ library http://trac.osgeo.org/proj/

  INSTDIR=M:\lib\PROJ

C3.) Compile the routino library http://www.routino.org

  svn co http://routino.org/svn/trunk routino

Note: you might have to install TortoiseSVN or any other svn client

C4.) Install Qt5.5 http://qt-project.org

Note: QMS should compile with Qt5.4 as well but Qt5.4 has a nasty bug in list scrolling. Qt5.6 on the other hand will not work as QWebkit is used in QMS which has been removed from Qt5.6.

Note: if you prefer offline installation you can choose the right package in OFFLINE INSTALLERS section of that page

C5.) Get the QMapShack source from the repository, e.g.

   hg clone https://bitbucket.org/maproom/qmapshack QMapShack  

Note: you might have to install TortoiseHG or any other mercurial client

C6.) Start the CMake GUI (you did install CMake before, didn’t you)

C7.) Open the generated build\QMapShack.sln with VS2013

Creating a Windows binary installer

I1.) Download the VC redistributable installer

from http://www.microsoft.com/en-us/download/details.aspx?id=40784 Note: in case the redistributable files are already installed in your system, this step is not necessary.

I2.) [Optional] Download libmysql.dll from mariadb

Download mariadb-10.1.11-winx64.zip (large file - ca 260MB) from https://downloads.mariadb.org/mariadb/10.1.11/ and extract libmysql.dll. Or copy libmysql.dll from an existing QMS installation This library is only needed at runtime for mysql/mariadb support

Note: If you don’t download/copy it, you have to comment out the respective lines in the copyfiles.bat and QMapShack_Installer.nsi scripts which are described in the next steps.

I3.) Copy all required files to intermediate directory

I4.) Create the installer with NSIS(3.0b1)

Note: there also are the options to run the script on command prompt with commandline version(makensis.exe). Or you can start windows version (makensisw.exe) to run the script.

TroubleShooting

If QMapShack does not behave as you expect, please have a look at the TroubleShooting Wiki Page. If this does not help you to understand the problem, you can try to dig deeper by debugging as described in the next section.

Debugging with VS2013

For bug fixing you might want to run QMapShack with the VS2013 debugger. This requires some additional configuration

D1.) Set the solution configuration type to “RelWithDebInfo”

Note: you would expect the solution configuration “Debug” to be used. But with “Debug” you will get a crash in pj_init_plus() shortly after start as described in http://stackoverflow.com/questions/19197791/projapi-gis-library-heap-overflow The reason for this problem is currently unknown. Any help is welcome.

D2.) Right-click on the project qmapshack and open the settings dialog

  PATH=%PATH%;M:\lib\gdal\bin;M:\lib\PROJ\bin;M:\src\routino_pkg\lib;C:\Qt5\5.5\msvc2013_64\bin

D3.) Compile

D4.) Run/Debug preparations

Now you can in principle run QMapShack with the VS2013 debugger: step through, inspect variables, see the debug output

But as QMapShack expects some configuration files for gdal and routino in the directory where it’s executable is placed. If those files are not there, you will get some strange error messages such as “the specified XML file is not found” at startup and the functionality for map/coordinate transformations will be limited.

The easiest way to provide these files is to copy the whole content of the Files directory created by copyfiles.bat as described in step I2) except the qmapshack.exe to the directory where you RelWithDebInfo executable has been created (build\bin\RelWithDebInfo).

Note: If you really copy all those files, then you can skip the step to set the PATH as described in step D2). Alternatively you can set the path as described and only copy all those configuration files and resources (i.e. all files which are not .dll’s + all directories)

D5.) Run/Debug

Congratulations: all preparations finished. Now you can really start debugging!


Prev (Coding Guideline) | Home | Manual | (Add translations) Next