Skip to content

Keep -Werror to avoid issue #35235#36961

Closed
William-Mou wants to merge 1 commit intospack:developfrom
William-Mou:develop
Closed

Keep -Werror to avoid issue #35235#36961
William-Mou wants to merge 1 commit intospack:developfrom
William-Mou:develop

Conversation

@William-Mou
Copy link
Copy Markdown
Contributor

@William-Mou William-Mou commented Apr 17, 2023

Added keep_werror for %nvhpc to avoid issue #35235.
Ref: 0182603

@spackbot-app spackbot-app bot requested a review from hppritcha April 17, 2023 12:43
@William-Mou William-Mou force-pushed the develop branch 2 times, most recently from 8cd3ab3 to eb75427 Compare April 17, 2023 12:52
@William-Mou
Copy link
Copy Markdown
Contributor Author

William-Mou commented Apr 17, 2023

Hi @trws,

Apologies for bothering you, I noticed you had added 'keep_werror' to PR #30882, and I wanted to ask you a question.

since adding keep_werror = "all" I have been unable to pass the CI test because it's an unused variable. Please advise me on what I may have overlooked.

Thank you, I appreciate it!

@trws
Copy link
Copy Markdown
Contributor

trws commented Apr 17, 2023

Keep_werror needs to be set at the class level, rather than in a function scope. I'm not sure if that's the whole issue but as it stands it probably isn't doing anything so it's a first step.

@William-Mou
Copy link
Copy Markdown
Contributor Author

William-Mou commented Apr 18, 2023

Hi @trws,
Thank you for your response!
Using class variables solved the problem in my testing.

This error seems to only occur when using nvhpc because it does not support -Wno-error.
Is there any way to make it effective only when using nvhpc?

@trws
Copy link
Copy Markdown
Contributor

trws commented Apr 18, 2023

Hi @trws,

Thank you for your response!

Using class variables solved the problem in my testing.

This error seems to only occur when using nvhpc because it does not support -Wno-error.

Is there any way to make it effective only when using nvhpc?

I am not sure actually now that you mention it. It's implemented as a regular class variable rather than a directive so maybe not. You could try using the with block syntax and when(%nvhpc) but I'm not sure it will help. Spack might need to be changed to enable it. Does it cause breakage for other compilers to leave it on?

@William-Mou
Copy link
Copy Markdown
Contributor Author

Hi @trws,

I have no evidence of errors with other compilers, but Spack's (-Werror to -Wno-error) mechanism serves some purpose (maybe ignore some errors?), and I don't want to compromise it when using other compilers.

@trws
Copy link
Copy Markdown
Contributor

trws commented Apr 18, 2023

I put that in so that packages could build with newer compilers when the new compilers produce new warnings. What's the failure with nvhpc anyway? What issue is the translation causing there?

@tgamblin
Copy link
Copy Markdown
Member

@trws @William-Mou:

I think the right fix here (until nvhpc gets this right) is actually something like this in package_base.py:

class PackageBase(...):
    # ...

    @property
    def keep_error(self):
        # nvhpc and PGI do not have the -Wno-error flag that replace -Werror with,
        # so currently we can't support this feature.
        if self.spec.satisfies("%nvhpc") or self.spec.satisfies("%pgi"):
            return "all"

        # otherwise get the value from config
        return None

We can update that with a version for nvhpc when the fix fits upstream.

@William-Mou
Copy link
Copy Markdown
Contributor Author

Hi @tgamblin,

This makes sense. I agree with you.
If the commit you mentioned has already been merged, should I close this PR?
Thank you!

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.

4 participants