GLib doesn't compile on Windows 10 with VS 2019
I tried to build GLib on a Windows 10 VM (using a free download from Microsoft) and didn't succeed.
Actually the same error happened when compiling GLib as a subproject of GTK which made me aware of this in the first place.
Reproduce
- Install pkgconf through MSYS2 and add it to Path
- Install git
- Install python and meson
- Then run:
git clone https://gitlab.gnome.org/GNOME/glib.git
cd glib
meson _build
meson compile -C _build
System
- Windows 10 Build 19043
- Visual Studio 2019 16.11.5
Output
PS C:\Users\User\glib> meson compile -C _build
Activating VS 16.11.5
ninja: Entering directory `_build'
[8/1022] Linking target subprojects/proxy-libintl/intl-8.dll
Creating library subprojects\proxy-libintl\intl.lib and object subprojects\proxy-libintl\intl.exp
[17/1022] Compiling C object glib/tests/strfuncs.exe.p/strfuncs.c.obj
../glib/tests/strfuncs.c(1687): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[22/1022] Compiling C object glib/tests/testing.exe.p/testing.c.obj
../glib/tests/testing.c(398): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
../glib/tests/testing.c(411): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
../glib/tests/testing.c(417): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
../glib/tests/testing.c(460): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
../glib/tests/testing.c(1615): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
../glib/tests/testing.c(1616): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
[27/1022] Compiling C object glib/tests/utf8-pointer.exe.p/utf8-pointer.c.obj
../glib/tests/utf8-pointer.c(54): warning C4090: 'function': different 'const' qualifiers
[64/1022] Compiling C object glib/glib-2.0-0.dll.p/gatomic.c.obj
../glib/gatomic.c(642): warning C4090: 'initializing': different 'volatile' qualifiers
[71/1022] Compiling C object glib/gnulib/libgnulib.a.p/vasnprintf.c.obj
../glib/gnulib/vasnprintf.c(2452): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gnulib/vasnprintf.c(2971): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gnulib/vasnprintf.c(3476): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gnulib/vasnprintf.c(4658): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[81/1022] Compiling C object gobject/gobject-2.0-0.dll.p/gobject.c.obj
../gobject/gobject.c(1496): warning C4090: 'function': different 'const' qualifiers
../gobject/gobject.c(4641): warning C4312: 'type cast': conversion from 'unsigned int' to 'void *' of greater size
[91/1022] Compiling C object gobject/gobject-2.0-0.dll.p/gtype.c.obj
../gobject/gtype.c(2194): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(2205): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(2205): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(4667): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(4772): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(4894): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(4927): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../gobject/gtype.c(4940): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[116/1022] Compiling C object gio/gio-2.0-0.dll.p/gbufferedinputstream.c.obj
../gio/gbufferedinputstream.c(900): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[157/1022] Compiling C object gio/gio-2.0-0.dll.p/gicon.c.obj
../gio/gicon.c(608): warning C4090: 'function': different 'const' qualifiers
[200/1022] Compiling C object gio/gio-2.0-0.dll.p/gresource.c.obj
../gio/gresource.c(337): warning C4090: 'function': different 'const' qualifiers
[237/1022] Compiling C object gio/gio-2.0-0.dll.p/gvfs.c.obj
../gio/gvfs.c(301): warning C4090: 'function': different 'const' qualifiers
[275/1022] Compiling C object gio/gio-2.0-0.dll.p/gsettingsschema.c.obj
../gio/gsettingsschema.c(1467): warning C4090: 'function': different 'const' qualifiers
[276/1022] Compiling C object gio/gio-2.0-0.dll.p/gdelayedsettingsbackend.c.obj
../gio/gdelayedsettingsbackend.c(421): warning C4090: 'function': different 'const' qualifiers
[278/1022] Compiling C object gio/gio-2.0-0.dll.p/gsettingsbackend.c.obj
../gio/gsettingsbackend.c(683): warning C4090: 'function': different 'const' qualifiers
[300/1022] Compiling C object gio/gio-2.0-0.dll.p/gdbusobjectmanagerclient.c.obj
../gio/gdbusobjectmanagerclient.c(1098): warning C4090: 'function': different 'const' qualifiers
[339/1022] Compiling C object gio/gio.exe.p/gio-tool-mount.c.obj
../gio/gio-tool-mount.c(64): warning C4090: 'initializing': different 'const' qualifiers
[341/1022] Compiling C object glib/glib-2.0-0.dll.p/gcharset.c.obj
../glib/gcharset.c(84): warning C4090: 'function': different 'const' qualifiers
[346/1022] Compiling C object glib/glib-2.0-0.dll.p/gerror.c.obj
../glib/gerror.c(560): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[382/1022] Compiling C object glib/glib-2.0-0.dll.p/goption.c.obj
../glib/goption.c(925): warning C4090: 'function': different 'const' qualifiers
[391/1022] Compiling C object glib/glib-2.0-0.dll.p/gstrfuncs.c.obj
../glib/gstrfuncs.c(1222): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[393/1022] Compiling C object glib/glib-2.0-0.dll.p/gthreadpool.c.obj
../glib/gthreadpool.c(389): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gthreadpool.c(934): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gthreadpool.c(939): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[403/1022] Compiling C object glib/glib-2.0-0.dll.p/gvariant.c.obj
../glib/gvariant.c(842): warning C4090: 'function': different 'const' qualifiers
[406/1022] Compiling C object glib/glib-2.0-0.dll.p/gvarianttypeinfo.c.obj
../glib/gvarianttypeinfo.c(541): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[408/1022] Compiling C object glib/glib-2.0-0.dll.p/gvariant-serialiser.c.obj
../glib/gvariant-serialiser.c(690): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gvariant-serialiser.c(725): warning C4146: unary minus operator applied to unsigned type, result still unsigned
../glib/gvariant-serialiser.c(991): warning C4146: unary minus operator applied to unsigned type, result still unsigned
[423/1022] Compiling C object glib/glib-2.0-0.dll.p/gthread-win32.c.obj
../glib/gthread-win32.c(357): warning C4312: 'type cast': conversion from 'DWORD' to 'gpointer' of greater size
[426/1022] Compiling C object glib/tests/atomic.exe.p/atomic.c.obj
../glib/tests/atomic.c(93): warning C4090: 'function': different 'const' qualifiers
[431/1022] Linking target glib/glib-2.0-0.dll
FAILED: glib/glib-2.0-0.dll glib/glib-2.0-0.pdb
"link" @glib/glib-2.0-0.dll.rsp
Creating library glib\glib-2.0.lib and object glib\glib-2.0.exp
libpcre.a(libpcre_la-pcre_compile.o) : error LNK2019: unresolved external symbol ___chkstk_ms referenced in function pcre_compile2
libpcre.a(libpcre_la-pcre_dfa_exec.o) : error LNK2001: unresolved external symbol ___chkstk_ms
glib\glib-2.0-0.dll : fatal error LNK1120: 1 unresolved externals
[436/1022] Compiling C object glib/tests/date.exe.p/date.c.obj
ninja: build stopped: subcommand failed.