[Mapserver-users] Mapserver win32 compilation problems

Swaminathan, Gayathri gayathri at ou.edu
Fri Feb 7 16:10:52 EST 2003


Hi All:
I have been trying to compile mapserver 3.6.3 and come up with the following
errors. Please anyone, has come across the errors or have pointers?

LIBCMT.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in
LIBC.lib(
dosmap.obj)
LIBCMT.lib(tolower.obj) : error LNK2005: __tolower already defined in
LIBC.lib(t
olower.obj)
LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in
LIBC.lib(to
lower.obj)
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other
libs; us
e /NODEFAULTLIB:library
mapserv.exe : fatal error LNK1169: one or more multiply defined symbols
found
NMAKE : fatal error U1077: 'link' : return code '0x491'
Stop.


This is how my makefile.vc looks,

#
# makefile.vc - Main MapServer makefile for MSVC++
#
# This VC++ makefile will build MAPSERVER.LIB, MAPSERV.EXE, and the other
# MapServer command-line programs.
#
# To use the makefile:
#  - Open a DOS prompt window
#  - Run the VCVARS32.BAT script to initialize the VC++ environment
variables
#  - Start the build with:  nmake /f makefile.vc
#
# $Id: Makefile.vc,v 1.21.2.1 2002/08/01 14:46:45 assefa Exp $
#

OPTFLAGS =	/nologo /Zi /W3 /DDEBUG /DWIN32
#OPTFLAGS =	/nologo /Zi 
BASE_CFLAGS = 	$(OPTFLAGS) 
LDFLAGS =	/NODEFAULTLIB:libcd /DEBUG

CC=     cl
LINK=   link /debug

#
# If you want to ignore missing datafile errors uncomment the following
# line. This is especially useful with large tiled datasets that may not
# have complete data for each tile.
#
IGNORE_MISSING_DATA=-DIGNORE_MISSING_DATA

#
# Apparently these aren't as commonplace as I'd hoped. Edit the
# following line to reflect the missing functions on your platform.
#
#STRINGS=-DNEED_STRCASECMP -DNEED_STRNCASECMP -DNEED_STRDUP
STRINGS=-DNEED_STRCASECMP -DNEED_STRNCASECMP

# Proj.4 distribution (cartographic projection routines). Not required for
normal use. (EXPERIMENTAL)
PROJ_LIB=../proj-4.4.3/src/proj.lib
PROJ_INC=-I../proj-4.4.3/src
PROJ=-DUSE_PROJ -DUSE_PROJ_API_H

#Use this flag to compile with WMS support
WMS=-DUSE_WMS

#Use this flag to compile with WMS Client support
#you need the libwww from http://www.w3.org/Library/.
#WMSCLIENT= -DUSE_WMS_LYR

#WWWLIB_INC=-I../Libwww/library/src -I../libwww/modules/expat/xmlparse
#WWWLIB_LIB=../Libwww/bin/wwwcore.lib ../Libwww/bin/wwwapp.lib
../Libwww/bin/wwwinit.lib ../Libwww/bin/wwwutils.lib

# GD distribution (graphics library GIF and/or PNG support). (REQUIRED)
#
#   - Version 1.2 is included and writes LZW GIF (-DUSE_GD_GIF
-DUSE_GD_SWAP_XY).
#   - Versions 1.3 to 1.5 write non-LZW GIF (-DUSE_GD_GIF).
#   - Versions 1.6 and greater write PNG (-DUSE_GD_PNG). Add -lpng -lz to
GD_LIB line.
#   - Versions 1.8 (or was it 1.7?) also supports JPEG and WBMP
(-DUSE_GD_JPEG -DUSE_GD_WBMP)
#
# The following lines will compile GD 1.2:
#GDFONT_OBJ=	gd-1.2/gdfontt.obj gd-1.2/gdfonts.obj gd-1.2/gdfontmb.obj \
#		gd-1.2/gdfontl.obj gd-1.2/gdfontg.obj
#GD_INC=	-I./gd-1.2
#GD_LIB=	gd-1.2/gd.lib
#GD= -DUSE_GD_GIF -DUSE_GD_SWAP_XY
#MAKE_GD=gd

# A patched version of GD that supports GIF, JPEG, PNG and WBMP can be 
# downloaded from http://www.rime.com.au/gd/.
# The following defns will include the patched GD 1.8.4 with TTF:
GDFONT_OBJ=
GD_INC=	-I../gd-1.8.4
GD_LIB=	../gd-1.8.4/gd.lib \
        ../jpeg-6b/libjpeg.lib \
        ../libpng/libpng.lib \
	../zlib/zlib.lib ../freetype/lib/freetype.lib
GD=     -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_TTF \
	-DUSE_GD_TTF -DGD_HAS_GDIMAGEGIFPTR
MAKE_GD=gd

# TIFF distribution (raster support for TIFF and GEOTIFF
imagery).(RECOMMENDED)
#TIFF_INC=-I../tiff-v3.5.4/libtiff
#TIFF_LIB=../tiff-v3.5.4/libtiff/libtiff.lib
#TIFF=-DUSE_TIFF

# JPEG distribution (raster support for grayscale JPEG images, INPUT ONLY).
#JPEG_INC=
#JPEG_LIB=-ljpeg
#JPEG=-DUSE_JPEG

# EPPL7 Support (this activates ERDAS as well) Included in the distribution.
Probably the best raster alternative if
# you've got EPPL7 laying around. See http://www.lmic.state.mn.us/ for more
information. (RECOMMENDED)
#EPPL=-DUSE_EPPL
#EPPL_OBJ=epplib.obj

# OGR Support OGC Simple Feature inspired interface for vector
# formats.  See http://gdal.velocet.ca/projects/opengis/
#GDAL_DIR= ..\gdal
#OGR=-DUSE_OGR
#OGR_LIB =  $(GDAL_DIR)/gdal.lib $(GDAL_DIR)/ogr/ogrsf_frmts/ogrsf_frmts.lib
$(GDAL_DIR)/ogr/ogrsf_frmts/ogrsf_frmts_sup.lib $(GDAL_DIR)/ogr/ogr.lib
$(GDAL_DIR)/ogr/../port/cpl.lib
#OGR_INC = -I$(GDAL_DIR)/ogr/ogrsf_frmts -I$(GDAL_DIR)/ogr
-I$(GDAL_DIR)/ogr/../port -I$(GDAL_DIR)/core

#GDAL=-DUSE_GDAL

# ESRI SDE support.
#SDE_OPT=-DUSE_SDE -DWIN32
#SDE_INC=-I../arcsde/include
#SDE_LIB=../arcsde/lib/sde80.lib ../arcsde/lib/sg80.lib
../arcsde/lib/pe80.lib

#
# UofMN GIS/Image Processing Extension (very experimental)
#
#EGIS=-DUSE_EGIS

#ERR_OBJ=./errLog/errLog.o
#ERR_INC=-I./errLog
#ERR_LIB=-L./errLog -lerrLog

#IMGGEN_OBJ=./imgSrc/imgLib.o
#IMGGEN_INC=-I./imgSrc
#IMGGEN_LIB=-L./imgSrc -limgGEN

#ECWDIR= C:\ProgFile\ECW_SDK
#ECW_LIB=$(ECWDIR)\lib\NCSEcw.lib $(ECWDIR)\lib\NCSEcwC.lib \
#        $(ECWDIR)\lib\NCSUtil.lib
#
# VC++ does not include the REGEX library... so we must provide our one.
# The following definitions will try to build GNU regex-0.12 located in the
# regex-0.12 sub-directory.
# If it was not included in the source distribution, then you can get it
from:
#    ftp://ftp.gnu.org/pub/gnu/regex/regex-0.12.tar.gz
#
REGEX_OBJ=..\regex-0.12\regex.obj
REGEX_INC=-I../regex-0.12

#
# IMPORTANT NOTE ABOUT REGEX FOR PHP_MAPSCRIPT USERS:
#
# If you want to compile the PHP_MAPSCRIPT module, then you have to make
# MapServer uses the same version of the REGEX library that PHP was 
# compiled with:
#
#PHP_REGEX=..\php-3.0.14\regex
#PHP_REGEX=..\php-4.0.6\regex
#PHP_REGEX=..\php-4.1.2\regex
#PHP_REGEX=..\php-4.2.1\regex
#PHP_REGEX=..\php-4.2.2\regex
#REGEX_OBJ=$(PHP_REGEX)\regcomp.obj $(PHP_REGEX)\regerror.obj \
#          $(PHP_REGEX)\regexec.obj $(PHP_REGEX)\regfree.obj
#REGEX_INC=-I$(PHP_REGEX) -DPHP_NO_ALIASES

#
# REGEX needs some special flags... here they are for VC++ 6.0
#
REGEX_OPT=-DHAVE_STRING_H -DREGEX_MALLOC



#
# --- You shouldn't have to edit anything else. ---
#

#
# Main MapServer library.
#
MS_LIB  =	mapserver.lib
MS_OBJS = 	mapbits.obj maphash.obj mapshape.obj mapxbase.obj \
		mapparser.obj maplexer.obj mapindex.obj maptree.obj \
		mapsearch.obj mapstring.obj mapsymbol.obj mapfile.obj \
		maplegend.obj maputil.obj mapscale.obj mapquery.obj \
		maplabel.obj maperror.obj mapprimitive.obj mapproject.obj\
		mapraster.obj cgiutil.obj mapsde.obj mapogr.obj \
        maptemplate.obj mappostgis.obj maplayer.obj mapresample.obj \
        mapwms.obj mapwmslayer.obj mapgml.obj maporaclespatial.obj \
        mapprojhack.obj \
		$(EPPL_OBJ) $(REGEX_OBJ)

MS_HDRS = 	map.h mapfile.h

MS_EXE = 	mapserv.exe \
                shp2img.exe legend.exe  \
		shptree.exe scalebar.exe sortshp.exe tile4ms.exe

#
#
#
LIBS	=	$(MS_LIB) $(GD_LIB) $(TIFF_LIB) $(JPEG_LIB) \
		$(PROJ_LIB) $(ERR_LIB) $(IMGGEN_LIB) $(OGR_LIB) \
                $(WWWLIB_LIB) $(ECW_LIB)

INCLUDES =	$(GD_INC) $(TIFF_INC) $(JPEG_INC) \
		$(PROJ_INC) $(ERR_INC) $(IMGGEN_INC) $(REGEX_INC) $(OGR_INC)
\
                $(WWWLIB_INC)

CFLAGS =	$(BASE_CFLAGS) $(INCLUDES) $(REGEX_OPT) $(STRINGS)  \
		$(EPPL) $(PROJ) $(TIFF) $(JPEG) $(GD) $(OGR) $(WMS)
$(WMSCLIENT) \
                $(IGNORE_MISSING_DATA) $(GDAL) -DFEATURE_INFO_HTML

default: 	all

all:		$(MS_LIB) $(MS_EXE)

$(MS_OBJS):	$(MS_HDRS)

$(MS_LIB):	$(MS_OBJS)
#	copy $(GDAL_DIR)\gdal.pdb .
	lib /out:$(MS_LIB) $(MS_OBJS)

$(MS_EXE):	$(LIBS)

gd::
	cd gd-1.2
	nmake /f makefile.nt OPTFLAGS="$(OPTFLAGS)"
	cd ..

.c.obj:	
	$(CC) $(CFLAGS) /c $*.c /Fo$*.obj

.cpp.obj:	
	$(CC) $(CFLAGS) /c $*.cpp /Fo$*.obj

.c.exe:
	$(CC) $(CFLAGS) /c $*.c /Fo$*.obj
	$(LINK) $(LDFLAGS) $*.obj $(LIBS)

.cpp.exe:
	$(CC) $(CFLAGS) /c $*.cpp /Fo$*.obj
	$(LINK) $(LDFLAGS) $*.obj $(LIBS)


clean:
	del *.obj
#	del $(REGEX_OBJ)
	del $(MS_LIB)
	del $(MS_EXE)
	del *.pdb
	del *.exp
	del *.ilk
#	cd gd-1.2
#	nmake -f makefile.nt clean
#	cd ..


Thanks,
Gayathri




More information about the mapserver-users mailing list