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

strip -Werror: all specific or none #30284

Merged
merged 10 commits into from
May 24, 2022
Merged

Conversation

trws
Copy link
Contributor

@trws trws commented Apr 25, 2022

Add a config option to strip -Werror* or -Werror=* from compile lines everywhere.

config:
    keep_werror: false

By default, we strip all -Werror arguments out of compile lines, to avoid unwanted failures when upgrading compilers. You can re-enable -Werror in your builds if you really want to, with either:

config:
    keep_werror: all

or to keep just specific -Werror=XXX args:

config:
    keep_werror: specific

This should make swapping in newer versions of compilers much smoother when maintainers have decided to enable -Werror by default.

lib/spack/env/cc Outdated
@@ -484,6 +485,25 @@ while [ $# -ne 0 ]; do
if [ -z "$arg" ]; then shift; arg="$1"; fi
append other_args_list "-l$arg"
;;
-Werror=*)
Copy link
Member

Choose a reason for hiding this comment

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

it'd be nice to generalize these with the DTAG stripping we already do to ensure RPATH -- can the arguments to the wrapper not be a general set of args to strip?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to think though how best to make that happen, maybe we can pass a list of patterns, and if any of them match the argument is removed? That should work as long as we don't need a conditional or other handling inside the wrapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having thought this through more, we can do this, in general, but -Werror has a bit of a trick attached to it that makes it more complicated. If we want to be able to differentiate between -Werror=<something> and -Werror, the longer match has to be explicitly kept before matching the shorter match. I'm considering whether to build out a generic enough mechanism to allow us to pass this in, or handle -Werror= specially and merge out everything else.

@spackbot-app spackbot-app bot added the tests General test capability(ies) label Apr 29, 2022
@trws
Copy link
Contributor Author

trws commented Apr 29, 2022

@tgamblin, this should be good for a look when you get a chance. It doesn't actually handle the dtags stuff with the new mechanism, because there are a lot of combinations of those where it's actually pairs of arguments, but it is a generic mechanism we can use to preserve or strip arbitrary flag patterns going forward.

@trws trws added this to In progress in Spack v0.18.0 release via automation May 4, 2022
cosmicexplorer
cosmicexplorer previously approved these changes May 16, 2022
Copy link
Contributor

@cosmicexplorer cosmicexplorer left a comment

Choose a reason for hiding this comment

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

This is a really clever way to do this within the confines of posix sh!

lib/spack/env/cc Show resolved Hide resolved
lib/spack/spack/build_environment.py Outdated Show resolved Hide resolved
lib/spack/env/cc Show resolved Hide resolved
cosmicexplorer
cosmicexplorer previously approved these changes May 17, 2022
Copy link
Contributor

@cosmicexplorer cosmicexplorer left a comment

Choose a reason for hiding this comment

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

Great!

@trws trws enabled auto-merge (squash) May 17, 2022 17:54
@trws trws disabled auto-merge May 17, 2022 21:05
@trws
Copy link
Contributor Author

trws commented May 20, 2022

Rebased and new tests added, hopefully better coverage of the added/changed lines.

@tgamblin
Copy link
Member

@trws: style is breaking

@trws
Copy link
Contributor Author

trws commented May 23, 2022

Looks like all is passing again @tgamblin.

Spack v0.18.0 release automation moved this from Review in progress to Reviewer approved May 24, 2022
@tgamblin tgamblin changed the title strip -Werror, all specific or none strip -Werror: all specific or none May 24, 2022
@tgamblin tgamblin merged commit 330832c into spack:develop May 24, 2022
Spack v0.18.0 release automation moved this from Reviewer approved to Done May 24, 2022
@mdorier
Copy link
Contributor

mdorier commented May 24, 2022

This PR started breaking the leveldb package (see #30799). Is there a way to tell spack "don't touch any of the warning flags!" for a specific package? (could this be done in the package definition, maybe?)

@tmadlener tmadlener mentioned this pull request May 25, 2022
4 tasks
scottwittenburg added a commit that referenced this pull request May 26, 2022
tgamblin added a commit that referenced this pull request May 26, 2022
This reverts commit 330832c.

`-Werror` chagnes were unfortunately causing the `rdma-core` build to fail.
Reverting on `v0.18`; we can fix this in `develop`
tgamblin pushed a commit that referenced this pull request May 26, 2022
iarspider pushed a commit to iarspider/spack that referenced this pull request May 30, 2022
Add a config option to strip `-Werror*` or `-Werror=*` from compile lines everywhere.

```yaml
config:
    keep_werror: false
```

By default, we strip all `-Werror` arguments out of compile lines, to avoid unwanted
failures when upgrading compilers.  You can re-enable `-Werror` in your builds if
you really want to, with either:

```yaml
config:
    keep_werror: all
```

or to keep *just* specific `-Werror=XXX` args:

```yaml
config:
    keep_werror: specific
```

This should make swapping in newer versions of compilers much smoother when
maintainers have decided to enable `-Werror` by default.
iarspider pushed a commit to iarspider/spack that referenced this pull request May 30, 2022
bhatiaharsh pushed a commit to bhatiaharsh/spack that referenced this pull request Aug 8, 2022
Add a config option to strip `-Werror*` or `-Werror=*` from compile lines everywhere.

```yaml
config:
    keep_werror: false
```

By default, we strip all `-Werror` arguments out of compile lines, to avoid unwanted
failures when upgrading compilers.  You can re-enable `-Werror` in your builds if
you really want to, with either:

```yaml
config:
    keep_werror: all
```

or to keep *just* specific `-Werror=XXX` args:

```yaml
config:
    keep_werror: specific
```

This should make swapping in newer versions of compilers much smoother when
maintainers have decided to enable `-Werror` by default.
bhatiaharsh pushed a commit to bhatiaharsh/spack that referenced this pull request Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-environment tests General test capability(ies)
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants