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

Loses flags when defining both CPPFLAGS and CFLAGS #8361

Closed
jpakkane opened this issue Feb 16, 2021 · 2 comments · Fixed by #8366
Closed

Loses flags when defining both CPPFLAGS and CFLAGS #8361

jpakkane opened this issue Feb 16, 2021 · 2 comments · Fixed by #8366
Assignees

Comments

@jpakkane
Copy link
Member

This is Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982865

The issue is that if you specify both CFLAGS and CPPFLAGS, then CPPFLAGS is ignored, probably because some variable is overwritten.

Bisection points to commit 4b0b44a.

@mbiebl
Copy link

mbiebl commented Feb 16, 2021

duplicate of #8345 ?

jpakkane added a commit that referenced this issue Feb 16, 2021
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 16, 2021
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: mesonbuild#8361
Fixes: mesonbuild#8345
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 16, 2021
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: mesonbuild#8361
Fixes: mesonbuild#8345
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 16, 2021
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: mesonbuild#8361
Fixes: mesonbuild#8345
@evverx
Copy link

evverx commented Feb 17, 2021

duplicate of #8345 ?

@mbiebl thanks! Looks like it is a duplicate of that issue. I didn't notice that all the flags got lost there. I'll close that issue in favor of this one shortly.

@jpakkane Looking at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982865#34, given that it appears just building large projects like systemd (which seems to have caught all the C regressions with its CI in about five minutes) in real-life scenarios would help to catch issues like this, I think that instead of relying on people manually testing broken prereleases or trying to gate the meson package somewhere downstream it would be better to test meson much more thoroughly upstream. It's kind of being discussed in #8347

jpakkane pushed a commit that referenced this issue Feb 17, 2021
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: #8361
Fixes: #8345
nirbheek pushed a commit that referenced this issue Feb 20, 2021
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: #8361
Fixes: #8345
tristan957 pushed a commit to tristan957/meson that referenced this issue Mar 2, 2021
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: mesonbuild#8361
Fixes: mesonbuild#8345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants