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

extract_objects on an internal dependency crashes #12308

Open
QuLogic opened this issue Sep 29, 2023 · 0 comments
Open

extract_objects on an internal dependency crashes #12308

QuLogic opened this issue Sep 29, 2023 · 0 comments
Labels

Comments

@QuLogic
Copy link
Member

QuLogic commented Sep 29, 2023

Describe the bug
If you call declare_dependency(link_with:...).extract_objects(...), then Meson crashes.

To Reproduce
Add this line to the test case:

diff --git a/test cases/common/80 declare dep/meson.build b/test cases/common/80 declare dep/meson.build
index e427defaf..761a92478 100644
--- a/test cases/common/80 declare dep/meson.build
+++ b/test cases/common/80 declare dep/meson.build
@@ -6,6 +6,7 @@ exe = executable('dep_user', 'main.c',
   dependencies : entity_dep)
 test('dep', exe)

+entity_dep.extract_objects('entity1.c')
 # just to make sure [] works as a no-op dep here
 executable('dummy', 'main.c',
   dependencies : [entity_dep, []])

then run meson.py setup 'test cases/common/80 declare dep' build, which produces this exception:

Traceback (most recent call last):
  File "/home/elliott/code/meson/mesonbuild/mesonmain.py", line 194, in run
    return options.run_func(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elliott/code/meson/mesonbuild/msetup.py", line 356, in run
    app.generate()
  File "/home/elliott/code/meson/mesonbuild/msetup.py", line 179, in generate
    return self._generate(env, capture, vslite_ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/elliott/code/meson/mesonbuild/msetup.py", line 224, in _generate
    intr.run()
  File "/home/elliott/code/meson/mesonbuild/interpreter/interpreter.py", line 3011, in run
    super().run()
  File "/home/elliott/code/meson/mesonbuild/interpreterbase/interpreterbase.py", line 162, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "/home/elliott/code/meson/mesonbuild/interpreterbase/interpreterbase.py", line 188, in evaluate_codeblock
    raise e
  File "/home/elliott/code/meson/mesonbuild/interpreterbase/interpreterbase.py", line 180, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/home/elliott/code/meson/mesonbuild/interpreterbase/interpreterbase.py", line 200, in evaluate_statement
    return self.method_call(cur)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/elliott/code/meson/mesonbuild/interpreterbase/interpreterbase.py", line 545, in method_call
    self.validate_extraction(obj.held_object)
  File "/home/elliott/code/meson/mesonbuild/interpreter/interpreter.py", line 3381, in validate_extraction
    if self.subproject != buildtarget.subproject:
                          ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'InternalDependency' object has no attribute 'subproject'

meson.build:9:27: ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

Expected behavior
A clear error that this is not supported.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? native
  • what operating system Fedora 38
  • what Python version are you using 3.11.4
  • what meson --version 1.2.99 (32be9bd)
  • what ninja --version if it's a Ninja build n/a
@dcbaker dcbaker added the bug label Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants