mesonbuild / mesonbuild/meson

system includes don't prefer build dir over src dir

Open
#11,637 1 comment 0 reactions 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**

`-isystem` is not in `CLikeCompilerArgs.prepend_prefixes`, so the order in which the include directories are passed to the compiler is reversed if the include directory is considered a "system" include directory.

**To Reproduce**
See the attachment.

```ninja
ARGS = -Ix.p -I. -I.. -Iinclude1 -I../include1 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -isystem../include2 -isysteminclude2
```

`-Iinclude1 -I../include1` vs. `-isystem../include2 -isysteminclude2`

**Expected behavior**
The build directory is passed first to the compiler.

**system parameters**
* plain native build
* python 3.10.10
* meson 1.0.1 (but applies to git master as well)
* ninja 1.11.1

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

Start at CLikeCompilerArgs.prepend_prefixes and inspect how system include arguments are ordered. Reproduce the issue using the shown ninja ARGS, then verify that system include directories preserve the expected build-directory-before-source-directory ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.