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

glib fails to configure with KeyError: Tried to access nonexistant project parent option b_vscrt. #14255

Open
tp-m opened this issue Feb 15, 2025 · 4 comments · May be fixed by #14272
Open

glib fails to configure with KeyError: Tried to access nonexistant project parent option b_vscrt. #14255

tp-m opened this issue Feb 15, 2025 · 4 comments · May be fixed by #14272
Labels
exception Major bug that raises a python-level exception options Meson configuration options

Comments

@tp-m
Copy link
Member

tp-m commented Feb 15, 2025

Option refactor regression I presume.

$ git clone https://gitlab.gnome.org/GNOME/glib.git

$ cd glib

$ ~/Devel/meson/meson.py setup b
The Meson build system
Version: 1.7.99
Source dir: /tmp/glib
Build dir: /tmp/glib/b
Build type: native build
Project name: glib
Project version: 2.83.3
C compiler for the host machine: ccache cc (gcc 14.2.0 "cc (Debian 14.2.0-14) 14.2.0")
C linker for the host machine: cc ld.bfd 2.43.90.20250122
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -std=c89: YES 
Compiler for C supports arguments -std=c99: YES 
Compiler for C supports arguments -std=c11: YES 
Compiler for C supports arguments -std=c17: YES 
C++ compiler for the host machine: ccache c++ (gcc 14.2.0 "c++ (Debian 14.2.0-14) 14.2.0")
C++ linker for the host machine: c++ ld.bfd 2.43.90.20250122
Compiler for C++ supports arguments -std=c++98: YES 
Compiler for C++ supports arguments -std=c++03: YES 
Compiler for C++ supports arguments -std=c++11: YES 
Compiler for C++ supports arguments -std=c++14: YES 
Compiler for C++ supports arguments -std=c++17: YES 
Compiler for C++ supports arguments -std=c++20: YES 
Compiler for C++ supports arguments -std=c++2b: YES 
Compiler for C++ supports arguments -std=c++latest: NO 
Checking if "building for musl libc" compiles: NO 
Program ./.gitlab-ci/thorough-test-wrapper.sh found: YES (/bin/bash /tmp/glib/./.gitlab-ci/thorough-test-wrapper.sh)
Program valgrind found: YES (/usr/bin/valgrind)
Compiler for C supports arguments -fno-strict-aliasing: YES 
Traceback (most recent call last):
  File "/home/tpm/Devel/meson/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
           ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/msetup.py", line 407, in run
    app.generate()
    ~~~~~~~~~~~~^^
  File "/home/tpm/Devel/meson/mesonbuild/msetup.py", line 189, in generate
    return self._generate(env, capture, vslite_ctx)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/msetup.py", line 266, in _generate
    intr.run()
    ~~~~~~~~^^
  File "/home/tpm/Devel/meson/mesonbuild/interpreter/interpreter.py", line 3061, in run
    super().run()
    ~~~~~~~~~~~^^
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 169, in run
    self.evaluate_codeblock(self.ast, start=1)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 194, in evaluate_codeblock
    raise e
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 186, in evaluate_codeblock
    self.evaluate_statement(cur)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 204, in evaluate_statement
    self.assignment(cur)
    ~~~~~~~~~~~~~~~^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 641, in assignment
    value = self.evaluate_statement(node.value)
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 200, in evaluate_statement
    return self.function_call(cur)
           ~~~~~~~~~~~~~~~~~~^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/interpreterbase.py", line 527, in function_call
    res = func(node, func_args, kwargs)
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/decorators.py", line 237, in wrapper
    return f(*nargs, **wrapped_kwargs)
  File "/home/tpm/Devel/meson/mesonbuild/interpreterbase/decorators.py", line 62, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/home/tpm/Devel/meson/mesonbuild/interpreter/interpreter.py", line 1083, in func_get_option
    value_object, value = self.coredata.optstore.get_option_from_meson_file(options.OptionKey(optname, self.subproject))
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/options.py", line 1101, in get_option_from_meson_file
    (value_object, value) = self.get_value_object_and_value_for(key)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/home/tpm/Devel/meson/mesonbuild/options.py", line 832, in get_value_object_and_value_for
    vobject = self.get_value_object_for(key)
  File "/home/tpm/Devel/meson/mesonbuild/options.py", line 826, in get_value_object_for
    raise KeyError(f'Tried to access nonexistant project parent option {parent_key}.')
KeyError: 'Tried to access nonexistant project parent option b_vscrt.'

meson.build:365:13: ERROR: Unhandled python exception

    This is a Meson bug and should be reported!
@tp-m tp-m added the options Meson configuration options label Feb 15, 2025
@tp-m tp-m added this to the optionrefactor milestone Feb 15, 2025
@bonzini bonzini added the exception Major bug that raises a python-level exception label Feb 15, 2025
@jpakkane
Copy link
Member

That is caused by this line in the main meson.build

vs_crt_opt = get_option('b_vscrt')

It is unconditionally asking for that option, even though it is only defined on Windows platforms. I checked version 1.7.0 and meson configure does not list b_vscrt at all. To be fair I have no idea how this could possibly have worked before.

@tp-m
Copy link
Member Author

tp-m commented Feb 17, 2025

That is caused by this line in the main meson.build

vs_crt_opt = get_option('b_vscrt')

It is unconditionally asking for that option, even though it is only defined on Windows platforms. I checked version 1.7.0 and meson configure does not list b_vscrt at all. To be fair I have no idea how this could possibly have worked before.

In 1.6.1 it returns from_buildtype which is documented as the default value.

The documentation says

The following options are available. Note that they may not be available on all platforms or with all compilers:

but does not say for each option on which platforms and with which compilers they might be available.

I am not sure if it's really reasonable to expect Meson users to just "know" what's what in this case, especially if a reasonable default value is available that was returned on Linux/with gcc before.

If it's not too much hassle we should probably add a column to the documentation with more info for each option and make this work with a warning for another release or three?

@dcbaker
Copy link
Member

dcbaker commented Feb 18, 2025

Checking for this would be so tedious, it’s not just a question of “what is my platform”, but what are both my host and build compilers, since either of them could be msvc and enable this.

@dcbaker
Copy link
Member

dcbaker commented Feb 18, 2025

If we really want to not populate these in meson 2.0 we could move to a fallback parameter, and of the fallback isn’t provided then it errors, but that’s still a breaking change and would have to go through a proper deprecation cycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exception Major bug that raises a python-level exception options Meson configuration options
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants