[Mapserver-users] Compiling Postgis with Mapserver

Swaminathan, Gayathri gayathri at ou.edu
Thu Apr 24 22:24:13 EDT 2003


Hi All,

I figured the way to compile Postgis with mapserver... I thought I will
forward the steps to the list,
incase it may be handy for someone, or myself if I forget to do this again.
Probably should also consider 
adding this to the wiki or Mapserver Win32 compilation how to.

1) Get the Postgres client library files of this url.
http://www.vso.cape.com/~nhv/files/postgres/libpq.lib.tgz
thanks Norman! , but probably these are available of
http://postgis.refractions.net/

2) You will require to copy libpq-fe.h from the native  windows32 Postgresql

3) Changes in mapserver makefile.vc are as follows:
Add the following lines,
# Optional PostGIS Support.  See http://postgis.refractions.net/
POSTGIS_DIR=  ..\libpq.lib
POSTGIS_LIB=  $(POSTGIS_DIR)/interfaces/libpq/libpqdll.lib
POSTGIS_INC=  -I$(POSTGIS_DIR)/include/

POSTGIS=-DUSE_POSTGIS

ADD the $(POSTGIS_LIB) to the LIBS= line,right after the
 "MS_EXE = 	mapserv.exe \
            shp2img.exe legend.exe  \
		shptree.exe scalebar.exe sortshp.exe tile4ms.exe" line
Also ADD $(POSTGIS_LIB) to the INCLUDES= line, and if you wish to see the
path of Postgis displayed during compile,
include the $(POSTGIS) in the CFLAGS= line.

4)Open mappostgis.c and edit the line 322
  //pos_paren =3D strstr(pos_ftab, ")"); // Closing paren of clause
  pos_paren =3D rindex(pos_ftab,')');

to

  pos_paren =3D strstr(pos_ftab, ")"); // Closing paren of clause
//  pos_paren =3D rindex(pos_ftab,')');

 I am not sure if this is a bug or if it is something that I am doing
wrong...but the above changes were required so
 that I dont get the following error,
mapserver.lib(mappostgis.obj) : error LNK2001: unresolved external =
symbol _rindex 

5)Now do the nmake /f makefile.vc

Will get you a mapserv.exe that has INPUT=POSTGIS, thiw works for me! But as
I said, am not sure of the change number (4).

Thanks,
Gayathri



More information about the mapserver-users mailing list