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

KeyError: 'install_dir' #9472

Closed
SamLukeYes opened this issue Oct 27, 2021 · 5 comments · Fixed by #9473
Closed

KeyError: 'install_dir' #9472

SamLukeYes opened this issue Oct 27, 2021 · 5 comments · Fixed by #9473

Comments

@SamLukeYes
Copy link

Describe the bug
AUR package msitools fails to build with meson 0.60.0. The meson output looks like this:

+ exec meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features enabled --wrap-mode nodownload -D b_lto=true -D b_pie=true . build
The Meson build system
Version: 0.60.0
Source dir: /home/yes/git-repos/AUR/msitools/src/msitools-0.101
Build dir: /home/yes/git-repos/AUR/msitools/src/msitools-0.101/build
Build type: native build
Project name: msitools
Project version: 0.101
C compiler for the host machine: cc (gcc 11.1.0 "cc (GCC) 11.1.0")
C linker for the host machine: cc ld.bfd 2.36.1
Vala compiler for the host machine: valac (valac 0.54.2)
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program build-aux/meson-dist found: YES (/home/yes/git-repos/AUR/msitools/src/msitools-0.101/build-aux/meson-dist)
Program perl found: YES (/usr/bin/perl)
Program bison found: YES (/usr/bin/bison)
Program subprojects/bats-core/bin/bats found: YES (/home/yes/git-repos/AUR/msitools/src/msitools-0.101/subprojects/bats-core/bin/bats)
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Run-time dependency glib-2.0 found: YES 2.70.0
Run-time dependency gobject-2.0 found: YES 2.70.0
Run-time dependency gio-2.0 found: YES 2.70.0
Run-time dependency libgsf-1 found: YES 1.14.47
Run-time dependency libgcab-1.0 found: YES 1.4
Run-time dependency libxml-2.0 found: YES 2.9.12
Configuring config.h using configuration
Program glib-mkenums found: YES (/usr/bin/glib-mkenums)
Program glib-mkenums found: YES (/usr/bin/glib-mkenums)
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 138, in run
    return options.run_func(options)
  File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 294, in run
    app.generate()
  File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 185, in generate
    self._generate(env)
  File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 229, in _generate
    intr.run()
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 2484, in run
    super().run()
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock
    raise e
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 181, in evaluate_statement
    return self.function_call(cur)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 456, in function_call
    res = func(node, func_args, kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 276, in wrapper
    return f(*nargs, **wrapped_kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 1969, in func_subdir
    self.evaluate_codeblock(codeblock)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock
    raise e
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_statement
    self.assignment(cur)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 568, in assignment
    value = self.evaluate_statement(node.value)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 185, in evaluate_statement
    return self.method_call(cur)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 484, in method_call
    res = obj.method_call(method_name, args, kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 754, in method_call
    ret = method(state, args, kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/usr/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 1459, in mkenums
    c_target = self._make_mkenum_custom_target(state, c_sources,
  File "/usr/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 1596, in _make_mkenum_custom_target
    return build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs,
  File "/usr/lib/python3.9/site-packages/mesonbuild/build.py", line 2330, in __init__
    self.process_kwargs(kwargs, backend)
  File "/usr/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs
    if isinstance(kwargs['install_dir'], list):
KeyError: 'install_dir'

According to #9365 (comment), it appears to be a meson bug that is not fully fixed.

To Reproduce

$ git clone https://aur.archlinux.org/msitools.git
$ cd msitools/
$ makepkg

Expected behavior
The package builds without issue.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    • native build
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    • Arch Linux
  • what Python version are you using e.g. 3.8.0
    • 3.9.7
  • what meson --version
    • 0.60.0
  • what ninja --version if it's a Ninja build
    • 1.10.2
@xclaesse
Copy link
Member

@dcbaker this seems to be the same kind of issue as you fixed in #9369.

@dcbaker
Copy link
Member

dcbaker commented Oct 27, 2021

Sigh, yup. I'll get CustomTarget completely converted for 0.61...

I might need to send out the gnome module cleanups piecemeal as they're rather draining to work on.

@dcbaker dcbaker added this to the 0.60.1 milestone Oct 27, 2021
dcbaker added a commit to dcbaker/meson that referenced this issue Oct 27, 2021
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.

Fixes mesonbuild#9472
@dcbaker
Copy link
Member

dcbaker commented Oct 27, 2021

Wow, that's annoying. This can only be hit if you create only a c file, and don't pass an install_dirargument, otherwise side-effects from the header generation ensure that install_dir is set for the c generation.

dcbaker added a commit to dcbaker/meson that referenced this issue Oct 27, 2021
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.

Fixes mesonbuild#9472
dcbaker added a commit to dcbaker/meson that referenced this issue Oct 27, 2021
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.

Fixes mesonbuild#9472
dcbaker added a commit to dcbaker/meson that referenced this issue Oct 27, 2021
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.

Fixes mesonbuild#9472
xclaesse pushed a commit that referenced this issue Oct 28, 2021
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.

Fixes #9472
nirbheek pushed a commit that referenced this issue Oct 28, 2021
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.

Fixes #9472
libvirtmirror pushed a commit to libvirt/libvirt-glib that referenced this issue Oct 29, 2021
The gnome.mkenums() function in Meson 0.60.0 doesn't work
correctly if only the C file is generated and the install_dir
argument is not provided.

Work around the issue by always providing the argument, even
when we know it's going to be ignored.

mesonbuild/meson#9472

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
@justinkb
Copy link

some changes with this have broken gjs 1.70.0 build

meson.build:563:0: ERROR: "install_dir" must be specified when installing a target

this is a gnome.generate_gir invocation

@nirbheek
Copy link
Member

nirbheek commented Dec 22, 2021

some changes with this have broken gjs 1.70.0 build

Fixed by #9667, which is in 0.60.3

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

Successfully merging a pull request may close this issue.

5 participants