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

Support Clang on Windows in prelude #804

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ashwinbanwari
Copy link

@ashwinbanwari ashwinbanwari commented Nov 10, 2024

Currently with system_cxx_toolchain on Windows, it hardcodes usage of MSVC. The changes in this PR enabled me to set the relevant options in system_cxx_toolchain / cxx_toolchain to successfully build my project with Clang on Windows. The changes mostly involved updating code that made the assumption Windows being the host system implied msvc was the only option, leading to faulty flags being set.

I attempted to run tests locally with cargo test, but experienced various errors including my computer crashing, errors about pagefile too small, and running out of disk space, so eventually gave up on that.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 10, 2024
@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@@ -1379,8 +1379,7 @@ def _strip_objects(ctx: AnalysisContext, objects: list[Artifact]) -> list[Artifa
cxx_toolchain_info = get_cxx_toolchain_info(ctx)

# Stripping is not supported on Windows
linker_type = cxx_toolchain_info.linker_info.type
if linker_type == LinkerType("windows"):
if host_info().os.is_windows:
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, using host_info() is an anti-pattern, because it breaks cross-platform builds. I don't think we want to introduce any usages of host_info in these files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants