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

Correct windows build flags for clang-cl/msvc-cl under opt/fastbuild/dbg #13133

Merged
merged 10 commits into from
Oct 11, 2020
Merged

Correct windows build flags for clang-cl/msvc-cl under opt/fastbuild/dbg #13133

merged 10 commits into from
Oct 11, 2020

Conversation

wrowe
Copy link
Contributor

@wrowe wrowe commented Sep 16, 2020

Commit Message: Clean up build flags for clang + msvc opt/fastbuild/dbg
Additional Description:

  • Move what were '--config=msvc-cl' settings out of .bazelrc into the
    default cflags for Windows compilation. This enables bazel build ...
    and bazel test ... to simply work out of the box.

  • Cleans up .bazelrc lists of windows vs. clang-cl settings, dividing
    the list into desired toggles vs. bazel or envoy bug workarounds

  • Fix errors in curl library creation in fastbuild on Windows

  • Introduce toggles and defaults for alwayslink argument to library objects.
    Defaults remain the same for now.

  • Introduce, but do not toggle clang-cl flags (this will arrive in a
    later PR when we resolve the opt build errors missing intrinsic base
    class destructors in the mock classes)

Risk Level: low
Testing: local, msvc and clang-cl on windows
Docs Changes: n/a
Release Notes: n/a

@wrowe
Copy link
Contributor Author

wrowe commented Sep 16, 2020

@envoyproxy/windows-dev note the resolution to Nick and Randy's observations about omitting -config msvc-cl, this should now work.

@wrowe wrowe marked this pull request as draft September 17, 2020 16:07
@sunjayBhatia
Copy link
Member

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #13133 (comment) was created by @sunjayBhatia.

see: more, trace.

@repokitteh-read-only
Copy link

CC @envoyproxy/dependency-watchers: FYI only for changes made to (bazel/repository_locations\.bzl)|(api/bazel/repository_locations\.bzl)|(.*/requirements\.txt).

🐱

Caused by: #13133 was synchronize by sunjayBhatia.

see: more, trace.

@wrowe
Copy link
Contributor Author

wrowe commented Sep 20, 2020

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #13133 (comment) was created by @wrowe.

see: more, trace.

@wrowe wrowe changed the title Draft changes to better support -c fastbuild on Windows Correct windows build flags for clang + msvc opt/fastbuild/dbg Sep 22, 2020
@wrowe
Copy link
Contributor Author

wrowe commented Sep 22, 2020

@envoyproxy/windows-dev for your inspection, this looks ready to run better msvc-cl and new clang-cl pipelines, and defaults should be more sensible for invoking bazel from the command line
.

@wrowe wrowe marked this pull request as ready for review September 22, 2020 21:45
@wrowe wrowe requested a review from lizan September 22, 2020 21:46
ci/run_envoy_docker_windows_large_disk.sh Outdated Show resolved Hide resolved
.bazelrc Show resolved Hide resolved
@wrowe
Copy link
Contributor Author

wrowe commented Sep 22, 2020

@htuch Just FYI that this has progressed r.e. #11974

It may be unwise to simply drop msvc-cl from the matrix, because that compiler is giving us additional insight into mistaken assumptions about C++ inherited from gcc/clang, but we'll zero in on one-or-the-other as "official binaries" coming from the project.

@wrowe wrowe changed the title Correct windows build flags for clang + msvc opt/fastbuild/dbg Correct windows build flags for clang-cl/msvc-cl under opt/fastbuild/dbg Sep 22, 2020
@htuch
Copy link
Member

htuch commented Sep 23, 2020

@wrowe great, I think this will pay off with our Chromium interop and other OSS libs, thanks, seems awesome progress.

@wrowe wrowe marked this pull request as draft September 29, 2020 16:50
- Move what were '--config=msvc-cl' settings out of .bazelrc into the
  default cflags for Windows compilation. This enables bazel build ...
  and bazel test ... to simply work out of the box.

- Cleans up .bazelrc lists of windows vs. clang-cl settings, dividing
  the list into desired toggles vs. bazel or envoy bug workarounds

- Fix errors in curl library creation in fastbuild on Windows

- Introduce toggles and defaults for alwayslink argument to library objects.
  Defaults remain the same for now.

- Introduce, but do not toggle clang-cl flags (this will arrive in a
  later PR when we resolve the opt build errors missing intrinsic base
  class destructors in the mock classes)

Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Co-authored-by: Sunjay Bhatia <sunjayb@vmware.com>
Co-authored-by: William A Rowe Jr <wrowe@vmware.com>
@wrowe
Copy link
Contributor Author

wrowe commented Oct 2, 2020

This patch has been greatly simplified, it adds the minimal support for introducing some new features in future patches (such as exposing linkalways flags for potential overrides) and relocates a number of flags without changing the behaviors significantly.

It should continue to permit building fastbuild out-of-the-box by default without invoking ci/windows_build_steps.sh, but it will no longer introduce release 'opt' build debug .pdb's on Windows due to the memory constraints of the GCP RBE environment. We'll address that in a later patch in sync with changes to the GCP worker pool, and wait to introduce clang-cl build pipeline until those opt build bugs are sorted out.

The idea is to facilitate kicking off bazel build --config clang-cl, without addressing every defect until the issues can be sorted out.

…ld-default

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Correct flag '--features' typo

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
- The CMP0091 rule cannot simply be disabled, it breaks any build where
  that rule isn't recognized by the installed cmake.

- Applying a limit of rules applicable to CMake 3.16 breaks corrections made
  to later versions of CMake.

- Using -U0 for the delta of this patch decreases the likelyhood it might not
  apply cleanly to the next iteration of curl.

- This now corrects both windows msvc-cl fastbuild and all clang-cl builds.

- All of this becomes irrelevant once this issue is addressed;
  #11816

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
…ld-default

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
- With the correct CFLAGS handling, the flags are correctly passed from
  bazel while building curl using rules_foreign_cc. This override is no
  longer applicable.

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
@wrowe wrowe marked this pull request as ready for review October 7, 2020 05:40
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
…ld-default

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
@wrowe
Copy link
Contributor Author

wrowe commented Oct 8, 2020

Note, this PR is a https://github.com/envoyproxy/envoy/milestone/16 dependency

@wrowe wrowe added this to the windows-beta milestone Oct 8, 2020
@wrowe
Copy link
Contributor Author

wrowe commented Oct 9, 2020

@lizan could you give this a final pass so we can move on to the clang-cl pipeline PR which depends on these updates?

# Drop the determinism feature (-DDATE etc are a no-op in msvc-cl)
build:msvc-cl --action_env=USE_CLANG_CL=""
build:msvc-cl --define clang_cl=0
build:msvc-cl --features=-determinism
Copy link
Member

Choose a reason for hiding this comment

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

Why this is needed? it wasn't here before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Three things going on.

Config msvc-cl is no longer strictly needed, those flags moved to bazel/envoy_*.bzl

When specifically requesting msvc-cl, we will disable clang-cl even if it the default in the dev's environment

We mark the build non-deterministic because the DATE and other timestamp overrides do absolutely nothing in msvc-cl, and that build cannot be deterministic. We are in a different, better situation with clang-cl, it is very noisy about overriding these intrinsic macros, but the reassignment takes place.

Copy link
Member

Choose a reason for hiding this comment

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

ok sgtm

@lizan lizan merged commit 3c86d8d into envoyproxy:master Oct 11, 2020
@wrowe wrowe deleted the fix-windows-fastbuild-default branch October 16, 2020 14:52
mattklein123 pushed a commit that referenced this pull request Oct 27, 2020
PR #13133 disabled various tests as they failed or flaked when compiled
with clang-cl. Given we have some significant other blockers to adding
clang-cl support and enabling as many tests to run in CI as possible is
important to progress to beta/GA support, we can un-skip these tests.

We could be "clever" and use a select to only tag tests to be skipped
when built with a specific compiler and compilation mode as well as an
alternative.

Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
@wrowe wrowe removed this from the windows-ga milestone Jan 15, 2021
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