-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Bazel 7.0 - can't compile with /DUNICODE
/D_UNICODE
#19977
Comments
/DUNICODE
/D_UNICODE
/DUNICODE
/D_UNICODE
/Zc:wchar_t
/DUNICODE
/D_UNICODE
/Zc:wchar_t
/DUNICODE
/D_UNICODE
@bazel-io fork 7.0.0 |
@carpenterjc Thanks for reporting the bug! Did you try to use |
I ran bazelisk bisect. I had a bit more of a look at the dependency graph and it seems it a dependency on |
/cc @rickeylev |
Hmm, I'm actually not able to reproduce the issue:
|
Sorry, I have checked in my .bazelrc in the reproduction I have these set:
I bet its because I have also set this via the |
@rickeylev Looks like since 1895585, With 1895585
With 8290f94
|
It wasn't entirely clear to me how this particular launcher/launcher_maker thing is supposed to work. From what I could ascertain, the "launcher maker" takes "launcher" as an input, and then copies it and appends a bit of data to it. In Bazel 6, this was implemented in Java as a special action: https://github.com/bazelbuild/bazel/blob/release-6.4.0/src/main/java/com/google/devtools/build/lib/analysis/actions/LauncherFileWriteAction.java In Bazel 7, for Starlarkification, I copied what I saw the java rules doing. That code is here: https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/python/py_executable_bazel.bzl#L336 The only solution I see is for Bazel to prebuild launcher_maker, or to move the launcher-maker logic back into Java. Unless there is a way to force launcher_maker to ignore --copt? |
Even with |
I see. I can see two options:
|
I also wonder if it's possible to implement LauncherFileWriteAction purely in Starlark with the |
Almost, but not quite. write() writes the file in its entirety with data that comes from the analysis phase. We can't read the file during analysis, so we can't push its data into the write() call. There aren't any mechanisms to expand a File reference to its content (there is expand_template(), but that is unlikely to work well on a binary file, plus we'd need to embed some sort of marker in the pre-built file to do such expansion). It might be possible to replace it with I can imagine adding a more advanced write() function to PyBuiltins, but if we touch PyBuiltins.java, we could just as easily have it expose LauncherFileWriteAction. My point being, either option requires some Java code.
Because this is part of building a py_binary, trying to use a py_binary as part of the process introduces bootstrapping issues. |
notes meteorcloudy sent me:
So using a prebuilt binary should be a simple matter of adding an extra line to the create_embedded_tool.py script, then added a select for launcher_maker in the BUILD.tools file. This is what the plain launcher.exe prebuilt binary does. |
Using a prebuilt binary solves a few issues: * Avoids having to build the launcher maker entirely. It is special purpose binary, isn't going to change much, and would otherwise incur needing a C++ toolchain. * It doesn't work with `--host_copt=/DUNICODE`, as described in bazelbuild#19977 * Preserves behavior of Starlarkified rules that use the launcher maker. The non-Starlark implementation used a special Java-implemented action to replicate what launcher_maker does, thus avoiding the C++ toolchain dependency. Fixes bazelbuild#19977 PiperOrigin-RevId: 580200034 Change-Id: Ic5a65a5021ea8b0b325b68c1817180e429b6d56b
Using a prebuilt binary solves a few issues: * Avoids having to build the launcher maker entirely. It is special purpose binary, isn't going to change much, and would otherwise incur needing a C++ toolchain. * It doesn't work with `--host_copt=/DUNICODE`, as described in #19977 * Preserves behavior of Starlarkified rules that use the launcher maker. The non-Starlark implementation used a special Java-implemented action to replicate what launcher_maker does, thus avoiding the C++ toolchain dependency. Fixes #19977 Commit f898da5 PiperOrigin-RevId: 580200034 Change-Id: Ic5a65a5021ea8b0b325b68c1817180e429b6d56b Co-authored-by: Richard Levasseur <rlevasseur@google.com>
A fix for this issue has been included in Bazel 7.0.0 RC5. Please test out the release candidate and report any issues as soon as possible. Thanks! |
Description of the bug:
We have defaults set to build using the Unicode version of the Microsoft APIs, using
/DUNICODE
/D_UNICODE
to use the unicode version of the APIs by default. This has broken buildingexternal/bazel_tools/src/main/cpp/util/path_windows.cc
Which should be using the APIs post fixed with "A" where the char type is always narrow.Which category does this issue belong to?
C++/Objective-C Rules
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create an empty python binary and build that target
With an empty windows project run this command.
bazel build --copt=/D_UNICODE --copt=/DUNICODE //:foo
Which operating system are you running Bazel on?
windows
What is the output of
bazel info release
?release 7.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
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
Yes, moving to bazel 7.0.0rc1
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
The text was updated successfully, but these errors were encountered: