[gdal-dev] GDAL with external zlib

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

Thank you Frank,

I'm afraid I don't understand this.
I looked now at the list EXTERNAL_LIBS in nmake.opt, and zlib is not
If in Linux it is possible (common?) to build with the system zlib, why
can't I do that in Windows, with the external zlib ?
And if I can't... then how can I avoid the linker error I am getting ?
Note: if I build against the dll, it works. But "our practice" is to build
against static libraries.
Also the fact that linking against the dll gave me no error - could that
mean that there is no conflict with the different zlib version, or that the
conflict passed unnoticed at link time but it might give me trouble later ?

Sorry, I am asking all these questions, trying to get this build and
working perfectly...

Thank you so much for help.

On Wed, May 15, 2013 at 4:40 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> Mihaela,
> The -DFRMT_ZLIB item in gdal/frmts/makefile.vc is triggering use of the
> local copy of zlib if OGDI is *not* configured as it includes a copy of
> zlib.  It should in theory be practical to generalize that in some way so
> the decision isn't based on OGDI but clearly it isn't common to build GDAL
> on windows without it's own zlib since there is nothing in nmake.opt about
> it.
> I do believe it is fairly common on linux to build with the system zlib.
> Best regards,
> Frank
> On Wed, May 15, 2013 at 4:18 PM, Mihaela Gaspar <
> mihaela.gaspar at urbanrobotics.net> wrote:
>> 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:
>> 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
>> !ELSE
>> EXTRAFLAGS =  -I..\frmts\zlib -DHAVE_LIBZ
>> But it didn't build.
>> How can I build with external zlib, to avoid version conflicts ?
>> Thank you.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Software Developer


*Mihaela Gaspar*

*Urban Robotics Inc.**
*Software Engineer

33 NW First Avenue, Suite 200 | Portland, OR 97209

c: 971-269-9649

mihaela.gaspar at urbanrobotics.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130515/c0e7f8c4/attachment.html>

More information about the gdal-dev mailing list