C++ param files are not compatible with MSVC #16704
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
Description of the bug:
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.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
returnsdevelopment 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
The text was updated successfully, but these errors were encountered: