-2

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.

Community
  • 1
  • 1
sjsam
  • 21,411
  • 5
  • 55
  • 102

1 Answers1

0

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).

sjsam
  • 21,411
  • 5
  • 55
  • 102