[Mapserver-users] Re: Compiling Postgis with Mapserver

Rosangela Silva rosangela.silva at zenitpolar.com.br
Thu May 8 16:41:06 EDT 2003


Hello Gayathri and list,

First, thanks for the initiative to give us this material and file.

Well, I would like to have the mapserver and postgis working together,
and I will use this guide.

But, I have the postgresql 7.3.2-1 installed and running in my computer
(winxp) with
cygwin 1.3.2.2.1 and I'm having some problems to generate the
libraries libpqdll.lib and libpq.lib. (I'm trying to solve this problem
but... for while...)

My question is if you have the file libpqdll.lib to send me (I know that you
generate
it for postgresql 7.3.1) and do you think that if I'll use this files to
compile mapserver,
it will run with my postgresql 7.3.2-1 version ??

Thanks
Rosângela
___________________________________________________________
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