mesonbuild / mesonbuild/meson

Wrap handling during `ninja reconfigure` ignores project subproject_dir setting

Open
#8,945 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

**Describe the bug**

During project regeneration, when Meson fires dependency fallback handling and finds wrap redirect .wrap's, it fails when a project is using subproject_dir due to this process ignoring that project option.

**To Reproduce**
`meson.build:`
```meson
project('proj', 'cpp', subproject_dir: 'deps')
subproj = dependency('subproj', fallback: ['subproj', 'subproj_dep'])
executable('proj', 'test.cxx', dependencies: [subproj], native: true)
```

`test.cxx`:
```c++
int main(int, char **) { return 0; }
```

`deps/subproj/meson.build`:
```meson
project('subproj', 'cpp')
substrate = dependency('substrate', fallback: ['substrate', 'substrate_dep'])
lib = library('subproj', 'test.cxx', dependencies: [substrate])
subproj_dep = declare_dependency(link_with: lib)
```

`touch deps/subproj/test.cxx`

`deps/subproj/subprojects/substrate.wrap`:
```wrap
[wrap-git]
url = https://github.com/bad-alloc-heavy-industries/substrate.git
revision = head
clone-recursive = false
```

Then run `meson build --force-fallback-for substrate` (this will be fine and work), `cd build`, and `ninja reconfigure`. The result will be the error

`../meson.build:1:0: ERROR: wrap-redirect filename must be in the form foo/subprojects/bar.wrap`

**Expected behavior**

Project cleanly reconfigures without error

**system parameters**
* Native build
* Any OS (test case is written for Linux)
* Python 3.9.5
* Meson 0.58.1
* Ninja 1.10.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the shown meson.build files, deps/subproj/meson.build, and deps/subproj/subprojects/substrate.wrap by running meson build --force-fallback-for substrate followed by ninja reconfigure. Start at the wrap redirect handling during regeneration and trace how subproject_dir is resolved. Done means the project reconfigures cleanly with subproject_dir: 'deps'.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.