After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668071 - mingw-gcc build fails on gio/gsocket.[c|h]
mingw-gcc build fails on gio/gsocket.[c|h]
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: win32
2.31.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-17 03:59 UTC by Avuton Olrich
Modified: 2018-05-24 13:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
win32: fix build breakage part 1 (5.72 KB, patch)
2012-01-17 12:52 UTC, Dieter Verfaillie
none Details | Review
gsocket: implement if_nametoindex() on Windows XP (2.37 KB, patch)
2012-01-18 00:53 UTC, Dan Winship
reviewed Details | Review
gsocket.c: Emulate if_nametoindex if necessary (5.85 KB, patch)
2012-02-09 07:26 UTC, Fan, Chun-wei
none Details | Review

Description Avuton Olrich 2012-01-17 03:59:11 UTC
mingw32 cross compile breaks with 2.31.10, it worked with 2.31.8. I attempted to bisect it but there were so many different compilation issues between revisions that I couldn't get a clean bisect. If there's any other way I can help, please let me know.

avuton@rocket:~/src/mpd-release-utils/src/glib$ i586-mingw32msvc-gcc -v
Using built-in specs.
Target: i586-mingw32msvc
Configured with: /build/buildd/gcc-mingw32-4.4.4/build-tree/gcc-4.4.4/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/gcc-mingw32' --disable-multilib --enable-threads --enable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-shared --target=i586-mingw32msvc --enable-languages=c,c++,fortran : (reconfigured) /build/buildd/gcc-mingw32-4.4.4/build-tree/gcc-4.4.4/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/gcc-mingw32' --disable-multilib --enable-threads --enable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-shared --target=i586-mingw32msvc --enable-languages=c,c++,fortran
Thread model: win32
gcc version 4.4.4 (GCC) 



  CC     libgio_2_0_la-gwin32mount.lo
/bin/bash ../libtool --silent --tag=CC   --mode=compile i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I..   -DG_LOG_DOMAIN=\"GLib-GIO\" -I.. -I../glib -I../glib -I.. -I../gmodule -DG_ENABLE_DEBUG -DGIO_COMPILATION -DGIO_MODULE_DIR=\"/home/avuton/src/mpd-release-utils/build-dir/lib/gio/modules\"   -I/home/avuton/src/mpd-release-utils/build-dir/include   -O0 -ggdb3 -gstabs -pipe -march=i686 -mms-bitfields -Wall -c -o libgio_2_0_la-gwin32mount.lo `test -f 'gwin32mount.c' || echo './'`gwin32mount.c
  CC     libgio_2_0_la-gwin32volumemonitor.lo
/bin/bash ../libtool --silent --tag=CC   --mode=compile i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I..   -DG_LOG_DOMAIN=\"GLib-GIO\" -I.. -I../glib -I../glib -I.. -I../gmodule -DG_ENABLE_DEBUG -DGIO_COMPILATION -DGIO_MODULE_DIR=\"/home/avuton/src/mpd-release-utils/build-dir/lib/gio/modules\"   -I/home/avuton/src/mpd-release-utils/build-dir/include   -O0 -ggdb3 -gstabs -pipe -march=i686 -mms-bitfields -Wall -c -o libgio_2_0_la-gwin32volumemonitor.lo `test -f 'gwin32volumemonitor.c' || echo './'`gwin32volumemonitor.c
  CC     libgio_2_0_la-gwin32inputstream.lo
/bin/bash ../libtool --silent --tag=CC   --mode=compile i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I..   -DG_LOG_DOMAIN=\"GLib-GIO\" -I.. -I../glib -I../glib -I.. -I../gmodule -DG_ENABLE_DEBUG -DGIO_COMPILATION -DGIO_MODULE_DIR=\"/home/avuton/src/mpd-release-utils/build-dir/lib/gio/modules\"   -I/home/avuton/src/mpd-release-utils/build-dir/include   -O0 -ggdb3 -gstabs -pipe -march=i686 -mms-bitfields -Wall -c -o libgio_2_0_la-gwin32inputstream.lo `test -f 'gwin32inputstream.c' || echo './'`gwin32inputstream.c
gwin32volumemonitor.c: In function ‘get_connected_drives’:
gwin32volumemonitor.c:172: warning: unused variable ‘wc_name’
gwin32volumemonitor.c:171: warning: unused variable ‘found’
gwin32volumemonitor.c:170: warning: unused variable ‘find_handle’
  CC     libgio_2_0_la-gwin32outputstream.lo
/bin/bash ../libtool --silent --tag=CC   --mode=compile i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I..   -DG_LOG_DOMAIN=\"GLib-GIO\" -I.. -I../glib -I../glib -I.. -I../gmodule -DG_ENABLE_DEBUG -DGIO_COMPILATION -DGIO_MODULE_DIR=\"/home/avuton/src/mpd-release-utils/build-dir/lib/gio/modules\"   -I/home/avuton/src/mpd-release-utils/build-dir/include   -O0 -ggdb3 -gstabs -pipe -march=i686 -mms-bitfields -Wall -c -o libgio_2_0_la-gwin32outputstream.lo `test -f 'gwin32outputstream.c' || echo './'`gwin32outputstream.c
In file included from ../gio/gsocketconnection.h:34,
                 from ../gio/gio.h:118,
                 from gwin32inputstream.h:27,
                 from gwin32inputstream.c:33:
../gio/gsocket.h:126: error: expected ‘;’, ‘,’ or ‘)’ before ‘struct’
../gio/gsocket.h:131: error: expected ‘;’, ‘,’ or ‘)’ before ‘struct’
make[4]: *** [libgio_2_0_la-gwin32inputstream.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from ../gio/gsocketconnection.h:34,
                 from ../gio/gio.h:118,
                 from gwin32outputstream.h:27,
                 from gwin32outputstream.c:33:
../gio/gsocket.h:126: error: expected ‘;’, ‘,’ or ‘)’ before ‘struct’
../gio/gsocket.h:131: error: expected ‘;’, ‘,’ or ‘)’ before ‘struct’
make[4]: *** [libgio_2_0_la-gwin32outputstream.lo] Error 1
make[4]: Leaving directory `/home/avuton/src/mpd-release-utils/src/glib/gio'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/avuton/src/mpd-release-utils/src/glib/gio'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/avuton/src/mpd-release-utils/src/glib/gio'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/avuton/src/mpd-release-utils/src/glib'
make: *** [all] Error 2
Comment 1 Dieter Verfaillie 2012-01-17 12:45:13 UTC
"interface" is #define interface _COM_interface, at least with
mingw.org's w32api header set, see line 49 of
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/w32api/include/basetyps.h?annotate=1.16&cvsroot=src
Comment 2 Dieter Verfaillie 2012-01-17 12:52:05 UTC
Created attachment 205439 [details] [review]
win32: fix build breakage part 1

Wonderful. With this applied, build continues until:
gio/gsocket.c:1949: undefined reference to `if_nametoindex'

MinGW w32api currently has no trace of if_nametoindex and
according to msdn, if_nametoindex is not available until vista:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb408409(v=vs.85).aspx
Comment 3 Dieter Verfaillie 2012-01-17 13:01:02 UTC
Maybe we need some AC_CHECK_FUNCS(if_nametoindex)/HAVE_IF_NAMETOINDEX
magic because it seems to be missing on some other platforms too:
http://www.gnu.org/software/gnulib/manual/html_node/if_005fnametoindex.html ?
Comment 4 Dieter Verfaillie 2012-01-17 13:21:55 UTC
correction: vista sp 1 according to http://msdn.microsoft.com/en-us/library/windows/desktop/aa366401(v=vs.85).aspx
Comment 5 Dan Winship 2012-01-17 21:08:01 UTC
doh. i noticed the if_nametoindex problem but thought we were going to change the API in a way that would make it irrelevant.

the if_nametoindex docs on MSDN explain how to implement the same functionality in terms of older functions
Comment 6 Dan Winship 2012-01-18 00:53:04 UTC
ok, i've fixed the build breakage, by ifdeffing out the if_nametoindex() code on platforms that don't have it.

I'll attach a proposed implementation of it for XP... but I'm not sure that it behaves the same way as the Vista version would (that is, if it's actually mapping the same set of names)... what are adapter names supposed to be on Windows?

Possibly we should move this to just taking an interface number and let higher-level code deal with name-to-number mappings if needed?
Comment 7 Dan Winship 2012-01-18 00:53:12 UTC
Created attachment 205495 [details] [review]
gsocket: implement if_nametoindex() on Windows XP

if_nametoindex() exists on Vista and later, but not XP. So implement
it ourselves using other WinSock functions.
Comment 8 Sebastian Dröge (slomo) 2012-01-18 07:48:53 UTC
IMHO we should keep the string parameter because it makes it easier for applications to handle this. We should better try something like your attached patch but I can't help much with this, I know almost nothing about Windows.
Comment 9 Dieter Verfaillie 2012-01-18 09:35:03 UTC
Comment on attachment 205439 [details] [review]
win32: fix build breakage part 1

equivalent of this was pushed as part of commit 08036ce30318a666a4f9df22512d74805be0d498
Comment 10 Fan, Chun-wei 2012-02-09 03:11:41 UTC
Review of attachment 205495 [details] [review]:

Hi Dan, thanks for your patch.

I looked at your patch for gsocket.c for Windows XP, but it seems to me that there are certain issues about it:
-The resulting binary is dependent on the Windows (Platform) SDK or MinGW headers/libraries used, so it could be built on an XP/Server 2003 SDK but running on Vista or Win7+ (or vice versa), so that could pose problems on the usage of if_nametoindex
-I was looking at Ryan's gthread-win32.c where he looked up first in Kernel32.dll for the SRWLock functions in the thread rewrite for glib-2.31+ before deciding to let the code to run emulated mode for XP or native mode for Vista/Win7+.  So I think this might be the better approach.  I am trying to get something like that in this code at this time, but I mentioned it here for references.

With blessings-thank you!
Comment 11 Fan, Chun-wei 2012-02-09 07:26:54 UTC
Created attachment 207159 [details] [review]
gsocket.c: Emulate if_nametoindex if necessary

Hi,

I have came up with a patch to emulate if_nametoindex on Windows when MinGW is used to build GLib or as a run-time fallback on Windows XP, which is based straight from Dan's proposed patch.  Since I am not an expert in network programming, I could not give a test rune at this  as there is currently no test program that tests the functionality of this.  This is based on Ryan's approach in his rewrite of gthread-win32.c, which means if_nametoindex() is checked for at runtime if GLib is built with Visual C++.

With blessings, thank you!
Comment 12 GNOME Infrastructure Team 2018-05-24 13:42:51 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/504.