GOBJECT : unresolved externals symbol ___chkstk_ms

2019-10-03 16:15发布

On compiling GOBJECT in Visual Studio, I came across below two errors:

Error   5   error LNK1120: 1 unresolved externals   C:\gtk_compilation\glib\glib-2.46.0\build\win32\vs12\Debug\Win32\bin\gobject-2-vs12.dll gobject
Error   4   error LNK2019: unresolved external symbol ___chkstk_ms referenced in function _ffi_call C:\gtk_compilation\glib\glib-2.46.0\build\win32\vs12\libffi.lib(ffi.o)  gobject

I recompiled the libffi using the procedure described here but with extra flags given to ./configure like below.

cflags="-fno-stack-check -fno-stack-protector -mno-stack-arg-probe"

which i hope will get rid of the ___chkstk_ms invocations.

After make and make install of libffi, I renamed the libffi.a to libffi.lib and libffi.dll.a to libffi.dll and copied them to appropriate directories.

Then I re-build the gobject project in visual studio and I got the same error which I mentioned in the beginning. :(

Edit:

From this post, I guess the problem's root is that I am using two compilers. But i don't see a way to get around it. I tried to compile the libffi using Visual Studio Projects available, but hours of efforts were in vain.

1条回答
放我归山
2楼-- · 2019-10-03 16:46

I resolved this using the MSVC build of Libffi found in the Github project.

However, you need to change the line#606 from

sizet z = (*p_arg)->size;

to

unsigned long long  z = (*p_arg)->size;

because the typedef is not (for some reason effective here).

查看更多
登录 后发表回答