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

has_header doesn't return a bool on 0.52.0 #6010

Closed
emersion opened this issue Oct 8, 2019 · 7 comments · Fixed by #6011
Closed

has_header doesn't return a bool on 0.52.0 #6010

emersion opened this issue Oct 8, 2019 · 7 comments · Fixed by #6011

Comments

@emersion
Copy link
Contributor

emersion commented Oct 8, 2019

With a Meson file containing the following:

if not cc.has_header('libavutil/hwcontext_drm.h', dependencies: libavutil)
	libavutil = disabler()
endif

Meson fails with "ERROR: Argument to "not" is not a boolean" when libavutil is not found (it's optional).

Downstream issue: swaywm/wlroots#1846

CI run with the failure: https://builds.sr.ht/~sircmpwn/job/94938#task-wlroots

CI run without the failure, Meson 0.51.2: https://builds.sr.ht/~sircmpwn/job/94937#task-wlroots

@xclaesse
Copy link
Member

xclaesse commented Oct 8, 2019

This seems to happen only when one of the dependencies is a disabler(). The minimal test case is

if not disabler()
endif

EDIT: As far as I know, it has always been an error, I dont think this is a regression. But this works:

if disabler()
endif

So there is definitely an inconsistency.

@emersion
Copy link
Contributor Author

emersion commented Oct 8, 2019

disabler() returns a dependency object, not a bool. However cc.has_header() returns a bool. So I don't think the if not disabler() case is related to this issue.

xclaesse added a commit to xclaesse/meson that referenced this issue Oct 8, 2019
@xclaesse
Copy link
Member

xclaesse commented Oct 8, 2019

disabler() returns a dependency object, not a bool. However cc.has_header() returns a bool. So I don't think the if not disabler() case is related to this issue.

disabler() is a special beast. Any statement that contains a disabler object return a disabler. So has_header('foo.h', dependencies : disabler()) returns a disaber().

@xclaesse
Copy link
Member

xclaesse commented Oct 8, 2019

@emersion please give a try to #6011

@xclaesse
Copy link
Member

xclaesse commented Oct 8, 2019

@emersion I was currious how you're using disabler.

https://github.com/swaywm/wlroots/blob/master/examples/meson.build

@xclaesse
Copy link
Member

xclaesse commented Oct 8, 2019

@emersion I think I understood why it is a regression you're seeing. The problem is there:
https://github.com/swaywm/wlroots/blob/master/examples/meson.build#L19

set_variable('foo', disabler()) used to skip the set_variable() function call instead of actually setting the variable. That means that your dep variables where still not-found dependencies instead of disabler objects.

@emersion
Copy link
Contributor Author

emersion commented Oct 8, 2019

Thanks for the tips!

set_variable('foo', disabler()) used to skip the set_variable() function call instead of actually setting the variable. That means that your dep variables where still not-found dependencies instead of disabler objects.

Ah, indeed, that makes sense. And the if all_dep_found would handle that case later on.

nirbheek pushed a commit that referenced this issue Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants