Compiler param file uses GCC escaping incompatible with MSVC

136 views
Skip to first unread message

Konstantin

unread,
Nov 2, 2022, 4:07:33 PM11/2/22
to bazel-discuss

Looking at the source it seems Bazel always uses GCC_QUOTED encoding for compiler param file, which does not work for MSVC. As soon as the flag contains spaces or quotes or any other unsafe chars they get prepended with backslash which confuses MSVC.

 There is a comment: “// TODO(b/132888308): Support MSVC, which has its own method of escaping strings.” which implies it is a known issue, but  I don’t know what “TODO(b/132888308)” actually means.

 Any ideas how to work around that problem and make compiler param files produced without escaping?

 Thank you!

Konstantin

Alex Humesky

unread,
Nov 2, 2022, 4:43:06 PM11/2/22
to Konstantin, Pedro Liberal Fernandez, bazel-discuss
"b/132888308" is a link to our internal bug tracker. That bug just says "Handle string escaping in parameter files correctly for MSVC", so nothing too surprising there. Please feel free to open an issue on github for this.

Off the top of my head, one workaround is to create a wrapper around msvc that translates the gcc style quoting to msvc style, and use the wrapper in the toolchain.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/298ff37b-2672-4f99-a815-e86ac1d3d313n%40googlegroups.com.

p.ste...@gmail.com

unread,
Jan 25, 2024, 8:40:04 AM1/25/24
to bazel-discuss
I created https://github.com/bazelbuild/bazel/issues/21029 so that this is publicly tracked.
The simplest workaround is to disable compiler param files (feature "compiler_param_file"), but that then risks into running into the command-line length limit on Windows.
Reply all
Reply to author
Forward
0 new messages