#5432 closed defect (fixed)
GDAL fails to build on mingw32 with gcc 4.8.1
Reported by: | rashadkm | Owned by: | warmerdam |
---|---|---|---|
Priority: | high | Milestone: | 1.10.2 |
Component: | default | Version: | 1.10.1 |
Severity: | normal | Keywords: | compile, windows, mingw |
Cc: | gdal-dev |
Description
compilation of GDAL 1.10.0 and 1.10.1 fails on Windows 7 with MinGW 32 bit for GCC 4.8.1
Error log:
gdalclientserver.cpp: In function 'GDALServerSpawnedProcess* GDALServerSpawnAsync()': gdalclientserver.cpp:1531:69: error: 'getaddrinfo' was not declared in this scope nRet = getaddrinfo(osHost, pszColon + 1, &sHints, &psResults); ^ gdalclientserver.cpp:1557:31: error: 'freeaddrinfo' was not declared in this scope freeaddrinfo(psResults); ^ make[1]: *** [gdalclientserver.lo] Error 1 make: *** [core-target] Error 2
Attachments (1)
Change History (16)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
with the attached patch gdal was built sucessfully on windows MinGW GCC4.8.1
comment:3 by , 10 years ago
Cc: | added |
---|
comment:4 by , 10 years ago
Moving #include "cpl_port.h" afterwards will surely break all other targets, and especially MSVC compilation. I suppose the issue with the current code is that the mingw system headers used in the #ifdef WIN32 case have not getaddrinfo in them.
So could you revert your changes and test replacing
#ifndef HAVE_GETADDRINFO
by
#if defined(_MSC_VER) && !defined(HAVE_GETADDRINFO)
comment:5 by , 10 years ago
I reverted the change reproduced the error. applied the new ifdef check as you said and it works..
However i am getting this warning which i think is ok to be ignored.
gdalserver.c: In function 'CreateSocketAndBindAndListen': gdalserver.c:126:5: warning: implicit declaration of function 'getaddrinfo' [-Wi mplicit-function-declaration] nRet = getaddrinfo(NULL, pszService, &sHints, &psResults); ^ gdalserver.c:156:5: warning: implicit declaration of function 'freeaddrinfo' [-W implicit-function-declaration] freeaddrinfo(psResults);
by , 10 years ago
Attachment: | mingw32-getaddrinfo.patch added |
---|
mingw32 compilation patch for getaddrinfo
comment:6 by , 10 years ago
This is weird. How come do you get warnings about getaddrinfo and freeaddrinfo whereas they are protected in a #ifdef HAVE_GETADDRINFO section, that should not be defined any longer ? And do you confirm that you don't you anymore the linking errors : gdalserver.c:127: undefined reference to `getaddrinfo' ?
comment:7 by , 10 years ago
Yes. I dont get any compilation problems or link errors. I will try make clean and run make again to to see if there is the same warning. Because I think these warnings show up somewhere after reverting changes in gcore/gdalclientserver.cpp, apps/gdalserver.c and applying the new patch. So when the first error comes in gcore i applied the #ifdef patch there and later on apps/gdalserver.c. I will cross check this tomorrow first thing in the morning
comment:8 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Yes. you are right. there was no warning and what i posted was from previous build. Gdal compilation seems fine with mingw gcc4.8.1 with msys make files. Marking this as fixed
comment:9 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I had marked this bug as fixed as my compilation was sucessful. However patch is not integrated in source and hence reopening the bug
follow-up: 11 comment:10 by , 10 years ago
Just to be sure : with that patch, do you get any warning about missing getaddrinfo/freeaddrinfo functions ?
What is strange is that patch is not needed with older i586-mingw32-msvc from Ubuntu 10.04, nor with i686-pc-mingw32 from CentOS 6
comment:11 by , 10 years ago
Replying to rouault:
Just to be sure : with that patch, do you get any warning about missing getaddrinfo/freeaddrinfo functions ?
No.
What is strange is that patch is not needed with older i586-mingw32-msvc from Ubuntu 10.04, nor with i686-pc-mingw32 from CentOS 6
I had tested on two windows 7 machine with latest mingw32. From mingw installer[1] I had selected msys, mingw, gcc,g++ 4.8.1. I had the same problem with gdal.1.10.0 also.
comment:12 by , 10 years ago
comment:13 by , 10 years ago
Milestone: | → 1.10.2 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
comment:15 by , 10 years ago
I don't understand your question. 1.10.1 has already been released, so I cannot change. The backport has been done on top of the 1.10 branch, so for a 1.10.2, if someone releases it one day. Anyway, it is also in the 1.11.0 that should be released soon.
moving cpl_port.h after the #ifdef WIN32 ... seems to be the workaround for this issue. cpl_port.h check for win32 defines and includes cpl_config.h which check HAVE_GETADDRINFO. here this macro is undefined.
as a followup I got undefined reference to getaddrinfo in apps/gdalserver.c