Trying to build stable release 3.24.21 of GTK3 from the git sources using MSYS2 on Windows following these instructions. I’ve successfully built this version earlier from the tar.xz sources and MSYS2 configure/make so I know I have all the required dependencies.
After cloning the gtk repo, I checkout the desired version. Then I run meson as described in the instructions.
For some reason, meson fails to find either pkg-config or cmake, both of which exist in the PATH. It also believes it needs to build the latest version of glib2 although a sufficient version exists. When meson tries to build glib2, it bombs out with:
subprojects/glib/meson.build:1680:2: ERROR: Entry _WIN32_WINNT not in configuration data.
_WIN32_WINNT was presumably set in the following glib/meson.build block (it’s the only place in the file where it’s set):
# Windows SDK requirements and checks
if host_system == 'windows'
# Check whether we're building for UWP apps
code = '''
#include <windows.h>
#if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
#error "Not building for UWP"
#endif'''
if cc.compiles(code, name : 'building for UWP')
glib_conf.set('G_WINAPI_ONLY_APP', true)
# We require Windows 10+ on WinRT
glib_conf.set('_WIN32_WINNT', '0x0A00')
else
# We require Windows 7+ on Win32
glib_conf.set('_WIN32_WINNT', '0x0601')
endif
endif
And the last line of this block in glib/meson.build is where it bombs:
if has_syspoll and has_systypes
poll_includes = '''
#include<sys/poll.h>
#include<sys/types.h>'''
elif has_winsock2
poll_includes = '''
#define _WIN32_WINNT @0@
#include <winsock2.h>'''.format(glib_conf.get('_WIN32_WINNT'))
Any ideas about what’s going on? Why aren’t pkg-config/cmake found? Why the need to build glib2? And why the build failure?
I’m using meson 0.54.3, the latest version available from MSYS2.
I see a version 0.55.0 came out three weeks ago, but the stable GTK sources I’m trying to build are a bit older than that. Any ideas on things to try? I’m at a brick wall on this.
CMake is irrelevant: nothing used CMake in the GTK stack. The fact that Meson cannot find pkg-config makes me thing you don’t really have in your PATH from inside the MSYS2 shell that you’re using.
You’ll have to ask the MSYS2 and/or Meson developers for help.
I’ve tried several ways to assign it an absolute Windows path–including defining it in a Windows shell and hoping MSYS2/bash would inherit it–but all have been unsuccessful.
Those paths are built-in. That environment variable is for additional paths. If you don’t have any additional paths, then don’t set that variable, at all. The MinGW versions of pkg-config automatically translate between POSIX and Windows paths.
Here is an example from my system (note that pkg-config finds “/mingw64/lib/pkgconfig/epoxy.pc”):
MSYS2 sets the PKG_CONFIG_PATH env var to that default value. I tried clearing the variable, but meson still doesn’t find pkg-config. It’s a recent, fresh MSYS2 installation with everything updated and using the mingw64 repo’s version of Python, as the meson installation instructions state.
Following the information in the link, I verified that I was running the MSYS64 shell and had installed mingw-w64-x86_64 versions of the prerequisites, except meson…the exact situation that the issue’s poster experienced.
I installed the mingw64 version of meson and will try a new build with renewed hope.
FYI: The meson build runs to completion now! Thanks much!
Unfortunately, ninja bombs out trying to link libgtk-4-0.dll with glib/gobject/libobject-2.0.dll. All the sources compiled cleanly using the meson --buildtype=debug option. The .ninja_log file provides no clues.
But the good news is that the meson hurdle has been cleared. Thanks again!
Thanks for the info. I think you’ve correctly identified the situation.
Unfortunately, MSYS2 doesn’t have the latest builds of the gtk4 dependencies. Scanning the gtk build.ninja file, I didn’t see any build-and-install-dependencies type target. Installing the dependencies manually goes beyond my current capabilities.
Is there a ninja command that would build/install just the gtk subprojects?
When I wrote “you will have to install the dependencies”, I meant: you will need to build GLib, Pango, and every other dependency that is currently a sub-project, separately and install them into the same prefix as you are going to use for GTK. In other words: you cannot use them as sub-projects until somebody familiar with MSYS2 understands why the linker is failing.
Building and installing each sub-project manually was my understanding from your previous message. But doing that (and building and installing their dependencies) is not a task I’ll be able to accomplish. Meanwhile, ninja appeared to successfully build each sub-project, so I was hoping for a target where it would also install them. It seems like my best option at this point is to install Linux on an available computer.