in glib in glib source

Hi. I am trying to build GLib standalone as a static library. There is a description for doing this with glib 2.45.3 - I download the source. However, I cannot find any in glib/build/win32 for either the version in question or some later versions.

A description of this file -
it’s like ./configure. For example, it copies config.h.win32 to config.h with replacing some substrings to real value (for example - @MAJOR_VERSION@ to concrete number) - without it visual studio can’t find config.h.

What I am trying to do -

GLib 2.45.3 (which is a development snapshot released 5 years ago, in 2015, and should never be used) used Autotools to build. Modern GLib uses Meson.

If you want to build GLib as a static library, you will need to use the -Ddefault_library=static configuration option when setting up the build.

My impression was that glib static build on Windows was broken.

The docs only mention a build on UNIX

Windows requires a cross build.

Hence I was trying to hack together a build on Visual Studio. The dev snapshot had a - and I was trying to locate that file.

Based on the instruction here, I have Visual Studio 2019, and I downloaded glib 2.65.

  1. Open a Visual Studio prompt (in my case, VS 2015 x64)
  2. meson _build --backend=vs
  3. cd _build
  4. msbuild /m glib.sln

I get the following error -
error C1083: Cannot open include file: ‘ffi.h’:

I have installed ffi and gettext via vcpkg - however the installation via vcpkg is x64-windows-static

Could this be an error due to incompatible library type ?

I’m sorry, but we don’t support vcpkg, as they change the build system and apply downstream patches.

You should ask the vcpkg maintainers.

I just took the generated glib.sln and tried to compile it in Visual Studio gui. Nothing from vcpkg is included. The build still failed.

LINK : fatal error LNK1181: cannot open input file ‘…\gobject\gobject-2.0.lib’

Based on the description here, I should be able to open it in Visual Studio and build

The problem was related to the vcpkg install and a strawberry perl install. I removed both vcpkg and perl (ld and objcopy was being picked up from the perl install) and it built fine - though with 352 warnings. As a tip to others, let glib download all the dependencies. Dont keep libintl, pcre or other required libs on your system.