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

C++ param files are not compatible with MSVC #16704

Open
konste opened this issue Nov 8, 2022 · 0 comments
Open

C++ param files are not compatible with MSVC #16704

konste opened this issue Nov 8, 2022 · 0 comments
Labels
area-Windows Windows-specific issues and feature requests help wanted Someone outside the Bazel team could own this P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: bug

Comments

@konste
Copy link
Contributor

konste commented Nov 8, 2022

Description of the bug:

  1. When --features=compiler_param_file feature is enabled compilation rules produce param file for the compiler to read. When "dangerous" symbols (like spoaces, quotes and such) are present individual arguments in param file are escaped. Unfortunately escaping schema is hardcoded as GCC_QUOTED which is not compatible with how MSVC expects the file to be escaped.

  2. With linking the situation is even worse. --features=linker_param_file is always enabled and cannot be disabled. And the same problem with escaping is present.

As the result of this issue any source files with the spaces or special symbols in the names cannot be compiled with Bazel on Windows. The same applies to defines, copts and other attributes.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I have created a minimal standalone repro here.
Obviously to get a repro you need to run it on Windows.

If you build with bazel build bin then the linking fails, because the source file name (and therefore object file name) contains a space in it.

If you build with bazel build bin --features=compiler_param_file then it fails on compilation because the param file generated is not escaped properly for MSVC.

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

6.0.0rc1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@ShreeM01 ShreeM01 added type: bug area-Windows Windows-specific issues and feature requests team-Rules-CPP Issues for C++ rules untriaged labels Nov 8, 2022
@oquenchil oquenchil added P3 We're not considering working on this, but happy to review a PR. (No assignee) help wanted Someone outside the Bazel team could own this and removed untriaged labels Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests help wanted Someone outside the Bazel team could own this P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests

3 participants