[gdal-dev] GDAL with external zlib

Mihaela Gaspar mihaela.gaspar at urbanrobotics.net
Wed May 15 16:18:16 PDT 2013


I have built GDAL, and was experimenting on a project.

I have external zlib 1.2.5

The external libraries are generally statically linked.

When trying the same thing with gdal, I got a link error:
error LNK2005: _deflate_copyright already defined in gdal.lib(deflate.obj)

I tried to find where gdal is using zlib, to try to add the external
reference, in similar fashion to other 3rd party software.
There is no place to include zlib though, in frmts\makefile.vc there is
something that I don't understand:
EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_zlib

And in port\makefile.vc there is an inclusion of the local zlib:
EXTRAFLAGS =  -I..\frmts\zlib -DHAVE_LIBZ


I tried to emulate other libs, by adding in nmake.opt:
# External ZLIB
ZLIB_INCLUDE = $(SDK)/zlib-1.2.5/build/include

And replacing in port\makefile.vc the line above with
!IFDEF ZLIB_INCLUDE
EXTRAFLAGS =  $(ZLIB_INCLUDE) -DHAVE_LIBZ
!ELSE
EXTRAFLAGS =  -I..\frmts\zlib -DHAVE_LIBZ
!ENDIF

But it didn't build.

How can I build with external zlib, to avoid version conflicts ?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130515/e950c84d/attachment.html>


More information about the gdal-dev mailing list