I try to build gtk+ 3.24.14 under msys2 system on Windows with following command:
meson --prefix=/home/User/gtk_libs/compile/outputs/x86_64-pc-mingw32 --buildtype=release ---Dpkg_config_path=/home/User/gtk_libs/compile/outputs/x86_64-pc-mingw32/lib/pkgconfig -Ddefault_library=shared -Dwin32_backend=true -Dbuiltin_immodules=yes /home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+ /home/User/gtk_libs/libs/gtk+
As you can see I use separate build directory
Next I call:
ninja -C /home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+ install
which fails with error:
ninja: fatal: CreateProcess: The parameter is incorrect.
(is the command line too long?)
If I build gtk+ directly in source directory all works fine.
As I can see in generated build.ninja file there is a command with 39000+ symbols length:
COMMAND = "C:/msys64/mingw64/bin/meson" "--internal" "exe" "--capture" "gtk/gtktypebuiltins.c" "--" "C:/msys64/mingw64/bin/glib-mkenums.EXE" "--template" "C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtktypebuiltins.c.template" "C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtk.h" ...
Most part of this huge command is paths to header files:
"C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtkborder.h"
"C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtkbox.h"
"C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtkbuilder.h"
"C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtkbuildable.h"
"C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtkbutton.h"
"C:/msys64/home/User/gtk_libs/compile/intermediates/x86_64-pc-mingw32/gtk+/../../../../libs/gtk+/gtk/gtkcalendar.h"
...
If I run this command directly in console it gives Argument list too long error
This command is generated from rule in gtk/meson.build:
gtktypebuiltins = gnome.mkenums('gtktypebuiltins',
sources: gtk_public_headers + gtk_deprecated_headers + a11y_headers,
c_template: 'gtktypebuiltins.c.template',
h_template: 'gtktypebuiltins.h.template',
install_dir: join_paths(gtk_includedir, 'gtk-3.0/gtk'),
install_header: true)
The source of this problem is
https://github.com/mesonbuild/meson/commit/d5f7ba862bb37ad75b68e007b8b55f40b6f6fd19 which converts all relative paths to absolute in gnome.mkenums and can cause generation of too long command to execute. After I removed in build.CustomTarget(output, state.subdir, custom_kwargs,
absolute_paths=True) parameter absolute_paths=True - all builds fine.
I opened https://github.com/mesonbuild/meson/pull/4966 to fix this a year ago, but I forgot about it. I'm not sure why we use absolute paths; would have to check git blame.
I'm not sure why we use absolute paths; would have to check
git blame.
Absolute paths are added because of https://github.com/mesonbuild/meson/issues/973 as I can see.