Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnome.mkenums generates huge command which causes command line too long error #6710

Open
AlexanderplUs opened this issue Feb 29, 2020 · 5 comments

Comments

@AlexanderplUs
Copy link

AlexanderplUs commented Feb 29, 2020

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

@nirbheek
Copy link
Member

nirbheek commented Mar 1, 2020

I opened #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.

@AlexanderplUs
Copy link
Author

I'm not sure why we use absolute paths; would have to check git blame.

Absolute paths are added because of #973 as I can see.

@dg0yt
Copy link

dg0yt commented Mar 29, 2022

I came here from research on microsoft/vcpkg#22201 (comment) (gtk3, but there seems to be a similiar issue with gtk4).

IIUC there is a the generated command line length is too long for Windows since meson switched to absolute paths.

With many tools, such problems are avoided with response files. AFAIU gnome.mkenums is a wrapper for glib-mkenums.
https://mesonbuild.com/Gnome-module.html#gnomemkenums
And glib-mkenums does support a response file when "passed as the sole argument":
https://developer-old.gnome.org/gobject/stable/glib-mkenums.html

Is this something which could be implemented?

Disclaimer: Nearly no knowledge of meson, gnome, gtk.

@eli-schwartz
Copy link
Member

Yes, absolutely. There's a PR which predates this ticket, and tried to implement it here: #4966

Unfortunately the codebase changed and it "needs to be rewritten from scratch" so it got closed.

It definitely needs to be done, we just need someone to do the work.

@talregev
Copy link

Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants