Control Werror by converting to Wno-error#30882
Conversation
|
@trws we should add a package property that overrides this behavior, so that if this does break certain packages we can just add: class PackageWithInsaneBuildSystem(Package):
keep_werror = "all"That would override the config option, and it would allow us to patch troublesome packages on our own time while still handling the vast majority of sane packages. I think this might've actually been the right thing to do with #30284 instead of reverting it. If this is easier than fixing |
|
@spackbot help |
|
You can interact with me in many ways!
I'll also help to label your pull request and assign reviewers! |
|
@spackbot rebuild everything |
|
I had a problem triggering the pipeline. |
|
@spackbot rebuild everything |
|
I had a problem triggering the pipeline. |
|
Maybe the prechecks have to be done first? @spackbot rebuild everything |
|
I've started that pipeline for you! |
|
I'm wondering if this is based on a |
|
Could be that, I'm guessing it was that I tried to start a pipeline when the pre-conditions for pipelines hadn't been fulfilled yet. Either way, running now. |
|
I think your hypothesis is correct |
|
moving this to 0.20 sadly -- but I think it'll actually be good to have it in |
|
Yeah, letting it simmer so we can hopefully catch packages not covered in stacks certainly wont hurt. I'll try to get this updated this morning so we can move it forward. |
|
@spackbot rebuild everything |
75eeb31 to
d259648
Compare
|
@spackbot rebuild everything |
|
I've started that pipeline for you! |
Using `-Werror` is good practice for development and testing, but causes us a great deal of heartburn supporting multiple compiler versions, especially as newer compiler versions add warnings for released packages. This PR adds support for suppressing `-Werror` through spack's compiler wrappers. There are currently three modes for the `flags:keep_werror` setting: * `none`: (default) cancel all `-Werror`, `-Werror=*` and `-Werror-*` flags by converting them to `-Wno-error[=]*` flags * `specific`: preserve explicitly selected warnings as errors, such as `-Werror=format-truncation`, but reverse the blanket `-Werror` * `all`: keeps all `-Werror` flags These can be set globally in config.yaml, through the config command-line flags, or overridden by a particular package (some packages use Werror as a proxy for determining support for other compiler features). We chose to use this approach because: 1. removing `-Werror` flags entirely broke *many* build systems, especially autoconf based ones, because of things like checking `-Werror=feature` and making the assumption that if that did not error other flags related to that feature would also work 2. Attempting to preserve `-Werror` in some phases but not others caused similar issues 3. The per-package setting came about because some packages, even with all these protections, still use `-Werror` unsafely. Currently there are roughly 3 such packages known.
In #30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. Co-authored-by: William Mou <[email protected]>
In #30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. Co-authored-by: William Mou <[email protected]>
In #30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. - [x] update property so that it keeps only the specific `-Werror=...` args for newer nvhpc's, which support `-Wno-error` but not `-Wno-error=...` Co-authored-by: William Mou <[email protected]>
In #30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. - [x] update property so that it keeps only the specific `-Werror=...` args for newer nvhpc's, which support `-Wno-error` but not `-Wno-error=...` Co-authored-by: William Mou <[email protected]>
In #30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. - [x] update property so that it keeps only the specific `-Werror=...` args for newer nvhpc's, which support `-Wno-error` but not `-Wno-error=...` --------- Co-authored-by: William Mou <[email protected]> Co-authored-by: Tom Scogland <[email protected]> Signed-off-by: Todd Gamblin <[email protected]>
In spack#30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. - [x] update property so that it keeps only the specific `-Werror=...` args for newer nvhpc's, which support `-Wno-error` but not `-Wno-error=...` --------- Co-authored-by: William Mou <[email protected]> Co-authored-by: Tom Scogland <[email protected]> Signed-off-by: Todd Gamblin <[email protected]>
In spack#30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. - [x] update property so that it keeps only the specific `-Werror=...` args for newer nvhpc's, which support `-Wno-error` but not `-Wno-error=...` --------- Co-authored-by: William Mou <[email protected]> Co-authored-by: Tom Scogland <[email protected]> Signed-off-by: Todd Gamblin <[email protected]>
Using
-Werroris good practice for development and testing, but causes us a great deal of heartburn supporting multiple compiler versions, especially as newer compiler versions add warnings for released packages. This PR adds support for suppressing-Werrorthrough spack's compiler wrappers. There are currently three modes for theflags:keep_werrorsetting:none: (default) cancel all-Werror,-Werror=*and-Werror-*flags by converting them to-Wno-error[=]*flagsspecific: preserve explicitly selected warnings as errors, such as-Werror=format-truncation, but reverse the blanket-Werrorall: keeps all-WerrorflagsThese can be set globally in config.yaml, through the config command-line flags, or overridden by a particular package (some packages use Werror as a proxy for determining support for other compiler features). We chose to use this approach because:
-Werrorflags entirely broke many build systems, especially autoconf based ones, because of things like checking-Werror=featureand making the assumption that if that did not error other flags related to that feature would also work-Werrorin some phases but not others caused similar issues-Werrorunsafely. Currently there are roughly 3 such packages known.