Skip to content

Issue with default options for dependencies with 1.8.0 #14532

@thfroitzheim

Description

@thfroitzheim

Describe the bug
With the new 1.8.0 version of meson a type error occurs with the default options for dependencies (prior versions still work). The issue is reproducible for several projects via the github CI independent of the operating system or compilers:
grimme-lab/mctc-lib
tblite/tblite

Here is one sample error message:

  meson setup _build --buildtype=debug --prefix=$PWD/_dist --libdir=lib --warnlevel=0 -Db_coverage=false 
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    BUILD_DIR: _build
    PIP_PACKAGES: meson cmake ninja gcovr
    LINUX_INTEL_COMPONENTS: intel-oneapi-compiler-fortran-2021.2.0 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2021.2.0 intel-oneapi-mkl-2021.2.0 intel-oneapi-mkl-devel-2021.2.0
    FC: gfortran
    CC: gcc
    GCC_V: 10
    PYTHON_V: 3.9
    OMP_NUM_THREADS: 1,2,1
    pythonLocation: /opt/hostedtoolcache/Python/3.9.22/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.22/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.22/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.22/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.22/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.22/x64/lib
    COVERAGE: false
    MESON_ARGS: 
  
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/msetup.py", line 391, in run
    app.generate()
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/msetup.py", line 189, in generate
    return self._generate(env, capture, vslite_ctx)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/msetup.py", line 250, in _generate
    intr.run()
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 3044, in run
    super().run()
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 178, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 203, in evaluate_codeblock
    raise e
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 209, in evaluate_statement
    return self.function_call(cur)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 536, in function_call
    res = func(node, func_args, kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 237, in wrapper
    return f(*nargs, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 556, in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 2458, in func_subdir
    if not self._evaluate_subdir(self.environment.get_source_dir(), subdir):
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 742, in _evaluate_subdir
    self.evaluate_codeblock(codeblock)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 203, in evaluate_codeblock
    raise e
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 213, in evaluate_statement
    self.assignment(cur)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 650, in assignment
    value = self.evaluate_statement(node.value)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 209, in evaluate_statement
    return self.function_call(cur)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 536, in function_call
    res = func(node, func_args, kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 806, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 806, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 806, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  [Previous line repeated 4 more times]
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 85, in wrapped
    ret = f(*wrapped_args, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 103, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 237, in wrapper
    return f(*nargs, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 556, in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 1795, in func_dependency
    d = df.lookup(kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreter/dependencyfallbacks.py", line 365, in lookup
    dep = func(kwargs, func_args, func_kwargs)
  File "/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/mesonbuild/interpreter/dependencyfallbacks.py", line 132, in _do_subproject
    default_options['default_library'] = default_library
TypeError: list indices must be integers or slices, not str
The Meson build system
Version: 1.8.0
Source dir: /home/runner/work/mctc-lib/mctc-lib
Build dir: /home/runner/work/mctc-lib/mctc-lib/_build
Build type: native build
Project name: mctc-lib
Project version: 0.4.1
Fortran compiler for the host machine: gfortran (gcc 10.5.0 "GNU Fortran (Ubuntu 10.5.0-4ubuntu2) 10.5.0")
Fortran linker for the host machine: gfortran ld.bfd 2.42
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: YES (/usr/bin/pkg-config) 1.8.1
Found CMake: /opt/hostedtoolcache/Python/3.9.22/x64/bin/cmake (4.0.0)
Run-time dependency json-fortran found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency json-fortran
Building fallback subproject with default_library=static
config/meson.build:55:18: ERROR: Unhandled python exception
    This is a Meson bug and should be reported!

As far as I can tell, the issue arises from dependency declarations such as this:

jsonfortran_dep = dependency(
  'json-fortran',
  required: get_option('json'),
  fallback: ['json-fortran-8.2.5','jsonfortran_dep'],
  default_options: [
    'default_library=static',
  ],
  static: get_option('default_library') != 'dynamic',
)
lib_deps += jsonfortran_dep

To Reproduce
For example with grimme-lab/mctc-lib

git clone [email protected]:grimme-lab/mctc-lib.git
meson setup _build

Expected behavior
Meson should still find the dependencies.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? No
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Ubuntu 24.04.2 or macOS 14.7.5
  • what Python version are you using e.g. 3.9
  • what meson --version 1.8.0
  • what ninja --version if it's a Ninja build 1.11.1.4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions