GNOME Bugzilla – Bug 794687
inconsistent POLL* constant testing between autotools and meson
Last modified: 2018-04-25 12:59:18 UTC
meson has special code for testing POLL* constants on Windows, configure.ac does not (the generic case falls through due to poll() test failing before that), and just defines G_IO_* to some pre-defined values. This blows up spectacularly when you combine meson-built glib with modules that were built against autotools-built glib, since the values for G_IO_* do not match anymore (specifically, in autotools build G_IO_IN defaults to 0x1, while in meson build G_IO_IN is set to 0x300, as it is defined in winsock2.h). I'm not sure what the "right thing"(TM) here is (i mean, autotools builds worked for years, so it seems that G_IO_* values are not fed to winsock calls directly). Most likely, configure.ac should be improved to also do correct POLL* constant tests on W32, when $ac_cv_func_poll = no.
Created attachment 370385 [details] [review] Disable W32-specific POLL* constant test, use a generic one The winsock2-using test do works perfectly, however this is a new thing that didn't exist in autotools-based builds of glib in the past. Autotools builds used the generic case where values were just defined to some agreed-upon numbers, and this is what all autotools-glib binaries and binaries built against autotools-glib (since these values go into public glibconfig.h header) use. At least one value, G_POLLIN, is different, thus breaking ABI if some binaries are built with autotools and the others are built with meson. Disable this code for now (until an ABI break is authorized) and implement a test that gives the same result as the old autotools test did.
bug 794898 broke this patch.
Comment on attachment 370385 [details] [review] Disable W32-specific POLL* constant test, use a generic one (In reply to LRN from comment #2) > bug 794898 broke this patch. ⇒ marking as needs-work
Created attachment 371171 [details] [review] Force W32-specific POLL* constant values in meson The winsock2-using test does work perfectly, however this is a new thing that didn't exist in autotools-based builds of glib in the past. Autotools builds used the generic case where values were just defined to some agreed-upon numbers, and this is what all autotools-glib binaries and binaries built against autotools-glib (since these values go into public glibconfig.h header) use. At least one value, G_POLLIN, is different, thus breaking ABI if some binaries are built with autotools and the others are built with meson. Force meson buildscript to use the same G_POLL* constant values for Windows builds that autotools builds use. v2: * Update the patch to apply against master. Since master changed the way the test is being done, we don't disable the test anymore. We let it pass, and then just override the results. Put the pre-defined constants in the same array as the test macros and subst variable names, it's more convenient that way.
(In reply to LRN from comment #0) > autotools builds > worked for years, so it seems that G_IO_* values are not fed to winsock > calls directly Yeah, see network_events_for_condition() in gsocket.c.
Review of attachment 371171 [details] [review]: This seems reasonable to me, but I’d like feedback from Nirbheek or Emmanuele before it gets pushed.
Review of attachment 371171 [details] [review]: I guess we have no choice but to do this. Good thing this is undocumented stuff, so people shouldn't be assuming any meaning from the values. ::: meson.build @@ +1395,3 @@ + endforeach +endif + Why not move this up and make the foreach d : poll_defines above conditional? It's confusing to run a compiler check and then throw away the result. Something like: if has_syspoll and has_systypes foreach d : poll_defines ... endforeach elif has_winsock2 # Due to a bug in configure.ac ... foreach d : poll_defines ... endforeach endif
Created attachment 371370 [details] [review] Force W32-specific POLL* constant values in meson v2 v2: * Moved the code as suggested
Review of attachment 371370 [details] [review]: OK, thanks.
Attachment 371370 [details] pushed as 85a32c7 - Force W32-specific POLL* constant values in meson