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

Enforce Werror when building samples on Linux #3816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mingweishih
Copy link
Collaborator

This PR fixes #3773, which enforces Werror flag when building samples on Linux.

Signed-off-by: Ming-Wei Shih mishih@microsoft.com

@mingweishih mingweishih added this to Under review in v0.16 Feb 3, 2021
@mingweishih mingweishih added this to the v0.15 milestone Feb 11, 2021
@mingweishih
Copy link
Collaborator Author

bors try

bors bot pushed a commit that referenced this pull request Feb 12, 2021
@bors
Copy link

bors bot commented Feb 12, 2021

try

Build failed:

Copy link
Contributor

@anakrish anakrish left a comment

Choose a reason for hiding this comment

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

LGTM

-fno-builtin>)
-fno-builtin>
# Treat warnings as errors by default. Application based on OE SDK
# will inhere this flag, which is consistent to the behavior of the
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# will inhere this flag, which is consistent to the behavior of the
# will inherit this flag, which is consistent to the behavior of the

@@ -275,7 +275,11 @@ if (OE_SGX)
# user. There are valid reasons for an end user to use built-ins.
$<BUILD_INTERFACE:-fno-builtin-malloc
-fno-builtin-calloc
-fno-builtin>)
-fno-builtin>
# Treat warnings as errors by default. Application based on OE SDK
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this desirable? This means that every application that uses liboecore via CMake import or pkgconfig will get -Werror by default, not just the samples. It's not generally my experience that SDKs set this on behalf of a dev (folks should feel to correct this if I am mistaken.)

This is also potentially a public build breaking change and should at least be documented in the CHANGELOG.md.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. I'm unapproving till we are sure that we don't force these flags on the users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR is based on the conclusion from #3773. I'm fine to remove the enforcement o Windows side. Can we have a consensus? Cc @radhikaj @dthaler

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a distinction:

  • We want the samples to be built using -Werror
  • However, we don't want to force -Werror on the user.

My understanding is that, today, we don't force the flags on the user on both Linux and Windows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No. -Werror is added in the clangw by default, so samples on Windows are always compiled with the flag, which is what the #3773 about.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification. We were forcing the flag on Windows, whereas we weren't on Linux.
I'm removing my blocker.

It is a matter of consistency then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Exactly. Given that @CodeMonkeyLeet pointed out that we shouldn't enforce -Werror on behalf of users, I'm wondering how should we address the consistency? This PR currently follows the conclusion from triaging #3733. We could also remove the enforcement on the Windows side. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

There are convincing arguments for both choices. Thinking about it bit more, my preference would be to enforce -Werror since it is generally considered a good programming practice to compile code with high warning levels.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to Anand's summary before about what is desired state:

  • We want the samples to be built using -Werror
  • However, we don't want to force -Werror on the user.

Above should be true for both Linux and Windows.

Copy link
Contributor

@anakrish anakrish left a comment

Choose a reason for hiding this comment

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

We need to make sure that we are not forcing these flags on the users.

Copy link
Contributor

@anakrish anakrish left a comment

Choose a reason for hiding this comment

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

Reapproving.

@dthaler dthaler added devex Issues that affect developer experience for both contributors and users samples Tag indicating association with the Open Enclave SDK samples. labels Mar 1, 2021
@mingweishih mingweishih mentioned this pull request Mar 17, 2021
@dthaler dthaler added the linux Issue has to do with supporting Open Enclave on Linux label Mar 31, 2021
@radhikaj radhikaj removed this from Under review in v0.16 May 3, 2021
@radhikaj radhikaj modified the milestones: v0.15, 0.16 May 3, 2021
Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>
@dthaler dthaler force-pushed the enforce_werror_to_linux_sampes branch from e5424c4 to 704c93c Compare June 6, 2022 18:29
@dthaler dthaler modified the milestones: v0.16, v0.19 Jun 6, 2022
@radhikaj
Copy link
Contributor

@dthaler, please review

@radhikaj
Copy link
Contributor

bors try

bors bot pushed a commit that referenced this pull request Jun 27, 2022
@bors
Copy link

bors bot commented Jun 27, 2022

try

Build failed:

Copy link
Contributor

@radhikaj radhikaj left a comment

Choose a reason for hiding this comment

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

Samples are failing. We should not change the flags that samples are built with since that could cause breaks in current code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devex Issues that affect developer experience for both contributors and users linux Issue has to do with supporting Open Enclave on Linux samples Tag indicating association with the Open Enclave SDK samples.
Projects
No open projects
v0.17
Awaiting triage
Development

Successfully merging this pull request may close these issues.

Inconsistent use of the Werror flag for building samples between Linux and Windows
5 participants