[mapserver-dev] MapCache IIS FastCGI Builds
sethg at geographika.co.uk
Wed Sep 20 09:19:09 PDT 2017
I think I missed your message as it got blocked on the mailing list.
My notes below are the only details I have on building for Windows.
There is a MAKE script for previous builds at
but these don't work with the latest source.
At some point I'll clean up the notes and send a pull request to the
On Thu, Sep 14, 2017, at 08:51 AM, Sven Schroeter wrote:
> Hi Seth,
> we are using mapcache for some of our customers on Windows (2012 Server
> with ms4w) and I just read your post, that you got running mapcache under
> Is there a documentation how to install it and get it run? Where can I
> find a package that runs stable?
> -----Ursprüngliche Nachricht-----
> Von: mapserver-dev [mailto:mapserver-dev-bounces at lists.osgeo.org] Im
> Auftrag von Seth G
> Gesendet: Donnerstag, 14. September 2017 01:20
> An: mapserver-dev at lists.osgeo.org
> Betreff: [mapserver-dev] MapCache IIS FastCGI Builds
> Hi list,
> I've been trying to get the 1.6.0 release of Mapcache working under IIS
> as a FastCGI application on Windows 10 x64 (the end result was a
> success!). Below are a list of notes and questions in case anyone can
> provide any more details on this setup.
> I used the SDK from GISInternals for the build with a few additions. The
> apr-util and sqlite3 dependencies are missing from this, but could be
> added using https://github.com/Microsoft/vcpkg
> ./vcpkg.exe install apr-util:x64-windows
> ./vcpkg.exe install sqlite3:x64-windows
> The Cmake command was as follows:
> C:\MapServerBuild\cmake-3.9.1-win64-x64\bin\cmake ..\ -G "Visual
> Studio 15 2017 Win64"
> "-DWITH_APACHE=OFF" "-DWITH_MAPSERVER=OFF"
> "-DWITH_FCGI=ON" "-DREGEX_DIR=C:\MapServerBuild\regex-0.12"^
> Followed by:
> devenv /rebuild Release mapcache.sln /ProjectConfig
> I had to add in the regex dependency as this is part of a new 1.6.0
> Then I added in the required DLLs alongside the built .exe
> xcopy /Y C:\MapServerBuild\mapcache\vc17x64\Release\*.dll
> xcopy /Y C:\MapServerBuild\mapcache\vc17x64\cgi\Release\*.exe
> xcopy /Y C:\MapServerBuild\mapcache\vc17x64\util\Release\*.exe
> xcopy /Y
> xcopy /Y
> xcopy /Y
> To get the mapcache.fcgi.exe working I had to make a few source code
> changes (see https://github.com/geographika/mapcache/).
> getenv in Linux returns both system environment variables (such as
> MAPCACHE_CONFIG_FILE), and individual request variables (such as
> QUERY_STRING). In Windows (or at least
> when using IIS) getenv doesn't return the request variables. A separate
> request environment needs to be queried using FCGX_GetParam.
> In addition the printf and fwrite (these are aliases for FastCGI
> functions FCGI_fprintf and FCGI_fwrite) functions returned HTTP 500
> errors in IIS (further details were "The system cannot open the file.
> Changing these to FCGX_FPrintF and FCGX_PutStr and passing in the out
> FCGX_Stream got things working again.
> A clear downside to these edits is that the program will no longer
> function as a CGI/ command line application as the functions are FastCGI
> specific. One option is to copy all required variables from the
> request environment to the standard one using the function below:
> #ifdef _WIN32
> char *update_environ(apr_pool_t *pool, char *key, char **envp)
> char *value = FCGX_GetParam(key, envp);
> char *pair;
> // request environment variables are not available in
> // using getenv so copy them across as getenv is used in
> several places
> pair = apr_psprintf(pool, "%s=%s", key, value);
> This still leaves the FCGX_FPrintF and FCGX_PutStr functions. I guess a
> series of #ifdef _WIN32 could resolve this, but maybe there is a cleaner
> way. I've tried a few times to understand how MapServer achieves
> the same thing but it is beyond me at the moment. Anyway it is running
> fine now in IIS, and is very fast.
> twitter: @geographika
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
More information about the mapserver-dev