Trouble compiling gtk: "glib-mkenums: error: unrecognized arguments"

Hi! I’m trying to compile gtk in Windows using MSVC. (Yeah, I know…)

I went through `meson setup ..` pretty much effortlessly. But now I’m compiling the project and getting this random error. I don’t have enough experience with the project to know why it happens.

PS C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\build> meson compile -j8
Activating VS 17.14.21 (November 2025)
INFO: automatically activated MSVC compiler environment
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: "C:\Program Files\Meson\ninja.EXE" -j 8
[14/13097] Generating GObject enum file subprojects/gstrea...d by meson to capture output, because command is too long)
FAILED: subprojects/gstreamer/subprojects/gstreamer/gst/gstenumtypes.h
"C:\Program Files\Meson\meson.exe" "--internal" "exe" "--capture" "subprojects\gstreamer\subprojects\gstreamer\gst\gstenumtypes.h" "--" "C:\Program Files\Meson\meson.exe" "runpython" "C:/Users/PC-AITOR/Documents/inkscape/deps/out/bin/../bin\glib-mkenums" "@C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\build\meson-private\meson_rsp_e51a3edeba6bbd73c86f3456aa4e20db4cafbd62.rsp"
--- stderr ---
usage: glib-mkenums [-h] [--identifier-prefix IDPREFIX]
                    [--symbol-prefix SYMPREFIX] [--fhead FHEAD]
                    [--ftail FTAIL] [--fprod FPROD] [--eprod EPROD]
                    [--vhead VHEAD] [--vprod VPROD] [--vtail VTAIL]
                    [--comments COMMENT_TMPL] [--template TEMPLATE]
                    [--output OUTPUT] [--version]
                    [args ...]
glib-mkenums: error: unrecognized arguments: /* enumerations from \"@basename@\" */ " GST_API GType @enum_name@_get_type (void); #define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())" G_END_DECLS"

...

Can you share the file C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\build\meson-private\meson_rsp_e51a3edeba6bbd73c86f3456aa4e20db4cafbd62.rsp? What Meson version are you using?

BTW, if you’re compiling Inkscape you don’t need GStreamer. You can pass -Dmedia-gstreamer=disabled when compiling GTK4

Not on my main computer right now, but I think disabling gstreamer will indeed fix the issue!

I’ll send my log anyway, in case someone else comes across this issue AND needs gstreamer.

Disabled gstreamer-media option. Now getting the following error:

CreateProcess failed: The system cannot find the file specified.

Full log: PS C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\build> ninja -j8[1/3480] - Pastebin.com

Strange, looks like ninja cannot find cl.exe in PATH. What’s the output of where.exe cl.exe?

Also, did you invoke meson setup with the --vsenv option? If so, you might have to use meson compile -j 8 instead of ninja -j 8 directly. Meson compile is a wrapper that reactivates the VS environment before launching ninja.

Now building from the “Developer Powershell for VS”, using “meson compile”. And it seems the cl.exe error is fixed. (Maybe this should be added to the documentation).

But the error is the same (as previously before disabling gstreamer). The error references a binary “glib-mkmenus”

Ah, I remember that issue! gnome.genmarshal() incorrectly splits the Python path if it contains spaces · Issue #13804 · mesonbuild/meson · GitHub

It should have been fixed in latest GLib, however: Windows: fix Python path can contain spaces (!4391) · Merge requests · GNOME / GLib · GitLab. Can you check that you have Meson 1.9.1 and GLib >= 2.86?

Ah, indeed GTK still points to GLib 2.84: subprojects/glib.wrap · main · GNOME / gtk · GitLab. Then you can try that:

  1. Delete the entire folder C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\subprojects\glib
  2. Change gtk\subprojects\glib.wrap as follows:
    diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap
    index b1de406953..8947ea9ac2 100644
    --- a/subprojects/glib.wrap
    +++ b/subprojects/glib.wrap
    @@ -2,7 +2,7 @@
     directory = glib
     url = https://gitlab.gnome.org/GNOME/glib.git
     push-url = ssh://git@ssh.gitlab.gnome.org:GNOME/glib.git
    -revision = 2.84.0
    +revision = 2.86.2
     depth = 1
    

The folder “gobject” doesn’t exist. Only these exist:

  • gtk/build/subprojects/glib/subprojects
  • gtk/build/subprojects/glib/tools
  • gtk/build/subprojects/glib/glib

Your clone is invalid. The subprojects/glib directory should be a GLib repository.

No, subprojects/glib IS a glib repository. What I’m talking about here is BUILD/subprojects (output artifacts)

PS: Excuse me, my bad

Deleting subprojects/glib caused this error:

meson setup .. (more options)

..\meson.build:1:0: ERROR: wrap-redirect C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\subprojects\glib\subprojects\gvdb.wrap filename does not exist

Ah, didn’t know about wrap redirects…

Then the simple fix is to start over with a clean checkout of GTK (but still applying the patch above to glib.wrap)

1 Like

This doesn’t seem like ideal behaviour though… I’ll do a PR to meson

The error comes from this line of gdk/meson.build:167:

gdk_enums = gnome.mkenums_simple('gdkenumtypes',
  sources: ...
  ...
)

It seems that this command, even though it’s being called, is not being formatted correctly. Maybe it’s because of Powershell which interprets commands differently. Specifically, double quotes.

enumerations from “@basenamebasename@”

Can you share the error message output by Ninja? It should mention a meson_rsp_*.rsp file, could you upload that file as well?

For example, with GStreamer the error message was:

FAILED: subprojects/gstreamer/subprojects/gstreamer/gst/gstenumtypes.h
"C:\Program Files\Meson\meson.exe" "--internal" [...] "@C:\Users\[...]\gtk\build\meson-private\meson_rsp_e51a3edeba6bbd73c86f3456aa4e20db4cafbd62.rsp"
"C:\Program Files\Meson\meson.exe" "--internal" "exe" "--capture" "gdk\gdkenumtypes.h" "--" "C:\Program Files\Meson\meson.exe" "runpython" "C:/Users/PC-AITOR/Documents/inkscape/deps/out/bin/../bin\glib-mkenums" "@C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\build\meson-private\meson_rsp_16780f7778fe47ea05daf98879d793681abd2cf9.rsp"

Full output:

Thanks. Can you also upload the response file C:\Users\PC-AITOR\Documents\inkscape\deps\src\gtk\build\meson-private\meson_rsp_16780f7778fe47ea05daf98879d793681abd2cf9.rsp?

I’m getting the same issue FWIW, could help with investigating.

2 Likes

The RSP file: --fhead "#pragma once#include <glib-object.h>#include \"version/gdkversion - Pastebin.com

It seems like a strange string is getting through the source file list, due to the double quotes.

P.S: Thanks for your free, voluntary support, lb90 :heart: