Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
195 lines (137 sloc) 7.84 KB
README.WIN32 - Microsoft Visual C++ Build instructions for MapServer
The Win32 build process is not very friendly for unexperienced users.
So it is strongly recommended that you use one of the precompiled
binaries available on the MapServer site:
There are precompiled Win32 binaries available for the last stable
release and the latest nightly build and they include the most common
options... so you shouldn't have to compile your own executables.
If for some reason you still decide to compile Win32 binaries yourself,
then don't do it unless you really know what you're doing... and
hopefully the rest of this file contains some hints that may help
you. Good Luck!
For the developers using MSVC++, a NMAKE makefile ( + nmake.opt)
to build the MapServer library and executable programs is included with
the distribution.
To build the package using the and NMAKE:
- Edit nmake.opt to select (or deselect) optional components of
the MapServer. Please read the notes below about each component
before you move ahead with the compilation.
- Open a DOS prompt window
- Run the VCVARS32.BAT script to initialize the VC++ environment
variables. VCVARS32.BAT is automatically generated by the MSVC++
install procedure and should be located in the BIN sub-directory of
your MSVC++ installation.
- Then start the build with:
nmake /f
This will create "mapserv.exe" (the main MapServer CGI program), the
other command-line utilities, "mapserver.lib" and "libmap.dll" that is
used by theMapScript modules.
To compile the various versions of MapScript (Perl, PHP, etc) first compile
the main mapserver directory and then see the README files in the
mapscript/perl, mapscript/php3 or mapscript/python directory for specific
GD library
- MapServer uses the GD library from and the Win32
makefiles are set by default to work with the pre-built GD version 2.0.33
provided by These predefine "gdwin32" binaries include
freetype2, libpng, libjpeg, libz, and libgif built-in. This is very
convenient to get a mapserver build going quickly.
If you are building GD and it's supporting libraries (libpng, libjpeg,
libgif, and freetype) from source then it is very important to make sure
that you update the -DUSE_GD_* flags and various subcomponent paths in the
nmake.opt. You will also have to take great care to build the various
components in a way that is compatible with MapServer. For instance, if
the various components are statically linked into MapServer you will need
to use the same build options (ie. /MT or /MT) for all components.
Here are some useful pointers:
- The original GD library:
- libpng:
- zlib:
- libjpeg:
- Freetype:
REGEX library
- MapServer uses the REGEX library which is standard on all the Unix
systems that I know of, but does not come with VC++.
If the MapServer distribution did not include a copy of the REGEX
library, then you can get a copy from:
The default in the nmake.opt is set to compile with GNU
regex-0.12 located in the "regex-0.12" directory.
- If you are planning to compile the PHP3_MAPSCRIPT.DLL module, then it
is important to make sure that the main creates MAPSERVER.LIB
with the same version of REGEX that PHP uses.
See the notes in the main about that.
Notes on Freetype build.
- You can use the Visual Workspace in freetype/lib/arch/win32 to build
the library.
Notes on the proj module
- The Proj.4 (cartographic projection routines) is located at
Note on the epsg files location and the nad directory :
* there is an environnemnt variable PROJ_LIB_DIR that can be set to locate
the directory where the epsg file is located
* if you build this module, at the top of the makefile (./src/, you
can set the PROJ_LIB variable and this setting will be used to
locate the proj support files.
Notes on libcurl
Notes libcurl : used to support WMS client connection
Mapserver 5.x is using libcurl instead of libwww for WMS client
- the library is located at
Quick notes on how to build the library using MSVC++:
- Download and extract the library (at this time it is known to work
with version 7.10.2 or more recent)
- Open the workspace curlib.dsw located under curl-XXX/lib
- Build libcurl.dll. Note that the default active configuraion of the project
is Win32 Debug. You can modify the configuarion to Release version
(Build/Set Active Configuration)
Notes on mapserver's nmake.opt modifications :
- uncomment the flag WMSCLIENT= -DUSE_WMS_LYR
- uncomment and modify according to your installation the flags
related to libcurl :
* CURL_INC = -I../curl-7.10.2/include
* CURL_LIB = ../curl-7.10.2/lib/Relase/libcurl.lib
* WINSOCK_LIB = "C:\Program Files\Microsoft Visual Studio\VC98\Lib\WSOCK32.LIB"
You also need to install the libcurl.dll in your system directory. (The dll will
be located in libc-XXX/lib/Relase abfter your build of the library)
Notes on GDAL
- If you are compiling the GDAL library (
with the PNG support, make sure that the libpng that you use in mapserver
is the same as the one used in GDAL.
Notes on PDF suuport
The PDF support allows the output of a map file as a PDF file.
To be able to build mapserver with the PDF support, you need to download
and build a PDF library from (
The best option is to download the zip file containing the source code and build it. Please refer to the docs inside the zip for informations on how to build the library. Here are some quick notes that can help in building mapserver with PDF :
1) Build the PDF lib
- open the project PDFLib.dsw
- build the project pdflib_dll
- after a sucessful build, you should have a pdflib.lib and pdblib.dll under the
pdflib directory
- copy the pdflib.dll under your system directory (ex : c:/winnt/system32)
2) Build mapserver with PDF
- uncomment in the nmake.opt the flags related to PDF
Jump to Line
Something went wrong with that request. Please try again.