Skip to content

boost: do not add the context-impl option for version below 1.65.0#30719

Merged
tldahlgren merged 3 commits intospack:developfrom
mzeyen1985:boost/fix_context_impl_option
Jul 1, 2022
Merged

boost: do not add the context-impl option for version below 1.65.0#30719
tldahlgren merged 3 commits intospack:developfrom
mzeyen1985:boost/fix_context_impl_option

Conversation

@mzeyen1985
Copy link
Copy Markdown
Contributor

#30654 doesn't prevent the addition of the b2 option context-impl when the variant is disabled.
This PR adds a version check to the corresponding if condition.

@spackbot-app spackbot-app bot requested a review from hainest May 18, 2022 12:18
@hainest
Copy link
Copy Markdown
Contributor

hainest commented May 18, 2022

Good catch! I really wish I had better CI for this package. This will be fixed in #30627, but we should merge this as a stop-gap.

@mzeyen1985 mzeyen1985 force-pushed the boost/fix_context_impl_option branch from c5beddb to f466cbb Compare May 18, 2022 14:07

# If we are building context, tell b2 which backend to use
if '+context' in spec:
if '+context' in spec and spec.version >= Version('1.65.0'):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on how versions are checked pretty much everywhere else in the package, I recommend using spec.satisfies() syntax for these changes for consistency. See line 151 for example.

Copy link
Copy Markdown
Contributor

@tldahlgren tldahlgren May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, would this be better or simpler implemented as a conflict?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, the problem is not +context but context-impl which are tied together.
Making the addition of context a conflict would also break the coroutine variant. See line 221 and 222.

Would the use of spec.satisfies() then look like the following?

if '+context' in spec and spec.satisfies('@1.65.0:'):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply.
The latest change makes the fix agnostic of the boost version by simply checking if the spec.variants dict contains context-impl.

In summary:

  • The context-impl variant is disabled if for boost versions < 1.65.0
  • The content of the context-impl variant is only read if it is contained within spec.variants

@tldahlgren tldahlgren self-assigned this May 18, 2022
@hainest
Copy link
Copy Markdown
Contributor

hainest commented May 18, 2022

This PR does fix the problem, but we're silently hiding the issue. I agree with @tldahlgren, this should be made an explicit conflict.

$ spack install boost
...
==> boost: Successfully installed boost-1.79.0-adpxgb4djyo5jofn22zkbfjdgbyan2ro

$spack install boost+context
...
==> boost: Successfully installed boost-1.79.0-d623p6lo4fqo4cc6ntsnqq3wpkipq6n7

$ spack install boost~context
[+] ROOT/opt/spack/linux-ubuntu20.04-skylake/gcc-11.1.0/boost-1.79.0-adpxgb4djyo5jofn22zkbfjdgbyan2ro


$ spack install [email protected]~context
...
==> boost: Successfully installed boost-1.64.0-wahwvdbc2zoybjrlfl52hs3vrc7f35kw

$ spack install [email protected]+context   <--- THIS SHOULD NOT WORK
...
==> boost: Successfully installed boost-1.64.0-ideggoxhrecvdpz3njijbmqhpiisfhn4

$ spack install [email protected]
[+] ROOT/opt/spack/linux-ubuntu20.04-skylake/gcc-11.1.0/boost-1.64.0-wahwvdbc2zoybjrlfl52hs3vrc7f35kw

@tldahlgren
Copy link
Copy Markdown
Contributor

This PR does fix the problem, but we're silently hiding the issue. I agree with @tldahlgren, this should be made an explicit conflict.

@mzeyen1985 Did you want to add an explicit conflict to this PR?

@mzeyen1985 mzeyen1985 force-pushed the boost/fix_context_impl_option branch from f466cbb to 96f8f9a Compare June 27, 2022 13:21
…onflict

Executing spack solve [email protected] +context context-impl=fcontext
triggers the following error message:
==> Error: No version for 'boost' satisfies '@1.63.0' and '@1.79.0'

With this change, the error message becomes the following:
==> Error: Cannot set variant 'context-impl' for package 'boost' because the variant condition cannot be satisfied for the given spec
@mzeyen1985
Copy link
Copy Markdown
Contributor Author

This PR does fix the problem, but we're silently hiding the issue. I agree with @tldahlgren, this should be made an explicit conflict.

@mzeyen1985 Did you want to add an explicit conflict to this PR?

cba17ad adds an explicit conflict for the context-impl variant improving the error message issued by spack.

Adding a conflict for boost@:1.65.0 +context as suggested above would be inconsistent with the following:

@tldahlgren
Copy link
Copy Markdown
Contributor

@hainest @mzeyen1985 Is this PR ready to merge?

@hainest
Copy link
Copy Markdown
Contributor

hainest commented Jul 1, 2022

@tldahlgren @mzeyen1985 This mostly solves the issue. I think the uncaught cases will be fixed by #30627. For example, it catches

$ spack install [email protected] context-impl=fcontext
  ==> Error: Cannot set variant 'context-impl' for package 'boost' because the variant condition cannot be satisfied for the given spec

but not

$ spack install [email protected]+context   <-- This is broken, but not the subject of this PR
    ==> boost: Successfully installed boost-1.64.0-wgstburpeafwrqwptu5hztcqdqxcjaw7
    [+] ROOT/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-11.1.0/boost-1.64.0-wgstburpeafwrqwptu5hztcqdqxcjaw7

$ spack install [email protected] context-impl=fcontext
    [+] ROOT/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-11.1.0/boost-1.64.0-wgstburpeafwrqwptu5hztcqdqxcjaw7

$ spack/bin/spack install [email protected] context-impl=ucontext
    [+] ROOT/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-11.1.0/boost-1.64.0-wgstburpeafwrqwptu5hztcqdqxcjaw7

I think the reason here is that the concretizer is skipping the context-impl variant because the condition is :1.65.0 +context which isn't satisfied by the last two specs, even though +context was used to build the installed version. I will definitely add a test for this in my PR.

@hainest hainest mentioned this pull request Jul 1, 2022
4 tasks
@tldahlgren tldahlgren merged commit 4365407 into spack:develop Jul 1, 2022
bhatiaharsh pushed a commit to bhatiaharsh/spack that referenced this pull request Aug 8, 2022
…pack#30719)

* boost: do not access the context-impl variant for versions below 1.65.0

* boost: check if spec.variants contains context-impl

* boost: improve error message when the context-impl variant causes a conflict

Executing spack solve [email protected] +context context-impl=fcontext
triggers the following error message:
==> Error: No version for 'boost' satisfies '@1.63.0' and '@1.79.0'

With this change, the error message becomes the following:
==> Error: Cannot set variant 'context-impl' for package 'boost' because the variant condition cannot be satisfied for the given spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants