undefined reference to g_memdup2 when building 2.68.0 with MinGW-w64
When building glib versions 2.67.0 and higher (up to current 2.68.0) on Windows using MinGW-w64 gcc under MSYS2 shell build fails with the following error:
undefined reference to 'g_memdup2'
I use the following meson parameters: --backend ninja --buildtype release --strip --default-library both -D iconv=external -D selinux=disabled -D xattr=false -D systemtap=false -D fam=false -D man=false -D gtk_doc=false
Ninja output looks like this:
[421/445] Linking target gio/libgio-2.0-0.dll
FAILED: gio/libgio-2.0-0.dll
"gcc" @gio/libgio-2.0-0.dll.rsp
d:/prog/winlibs64-9.2.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gio/libgio-2.0-0.dll.p/gfile.c.obj:gfile.c:(.text+0x39f): undefined reference to `g_memdup2'
d:/prog/winlibs64-9.2.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gio/libgio-2.0-0.dll.p/gfile.c.obj:gfile.c:(.text+0x78f): undefined reference to `g_memdup2'
d:/prog/winlibs64-9.2.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gio/libgio-2.0-0.dll.p/gfile.c.obj:gfile.c:(.text+0x39bb): undefined reference to `g_memdup2'
d:/prog/winlibs64-9.2.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gio/libgio-2.0-0.dll.p/gwin32appinfo.c.obj:gwin32appinfo.c:(.text+0x3e31): undefined reference to `g_memdup2'
d:/prog/winlibs64-9.2.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gio/libgio-2.0-0.dll.p/gwin32appinfo.c.obj:gwin32appinfo.c:(.text+0x4014): undefined reference to `g_memdup2'
d:/prog/winlibs64-9.2.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: gio/libgio-2.0-0.dll.p/gwin32appinfo.c.obj:gwin32appinfo.c:(.text+0x426c): more undefined references to `g_memdup2' follow
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I also noticed g_memdup2
is not present in the generated file glib/libglib-2.0-0.dll.p/libglib-2.0-0.dll.symbols
while g_memdup
is.
Edited by Brecht Sanders