[gdal-dev] mingw64 build error gdal-2.2.2

Even Rouault even.rouault at spatialys.com
Tue Oct 31 12:20:34 PDT 2017


> 
> building 'osgeo._gdal_array' extension
> C:\msys64\mingw64\bin/x86_64-w64-mingw32-gcc.exe -fno-strict-aliasing
> -march=x86-64 -mtune=generic -O2 -pipe -fwrapv -D__USE_MINGW_ANSI_STDIO=1
> -DNDEBUG -DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/
> -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps
> -IC:/msys64/mingw64/include/python2.7
> -IC:/msys64/mingw64/lib/python2.7/site-packages/numpy/core/include
> -Iinclude -c extensions/gdal_array_wrap.cpp -o
> build/temp.mingw-2.7/extensions/gdal_array_wrap.o In file included from
> ../../gcore/gdal.h:42:0,
>                  from extensions/gdal_array_wrap.cpp:3143:
> ../../port/cpl_port.h:1119:5: error: conflicting declaration of 'int
> sprintf(char*, const char*, ...)' with 'C' linkage int sprintf(char *str,
> const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(2, 3) CPL_WARN_DEPRECATED("Use
> snprintf() or CPLsnprintf() instead"); ^~~~~~~

What doesn't make sense is that the sprintf() definition at line 1119 of cpl_port.h should 
only be enabled if GDAL_COMPILATION is defined, and I don't see it in the above build line, 
and it shouldn't be present in a .h file normally. So there's something to investigate.

> In file included from C:/msys64/mingw64/include/python2.7/Python.h:33:0,
>                  from extensions/gdal_array_wrap.cpp:172:
> C:/msys64/mingw64/x86_64-w64-mingw32/include/stdio.h:316:5: note: previous
> declaration with 'C++' linkage int sprintf (char *__stream, const char
> *__format, ...)
>      ^~~~~~~

This one is weird. It would seem that the original sprintf() definition would be understood as 
a C++ symbol, and not a C one. I'd hope stdio.h from mingw to have the usual extern "C" {    } 
protection for that. 

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171031/272881c6/attachment.html>


More information about the gdal-dev mailing list