-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
windows launcher: Make the launcher compile under mingw #24752
Conversation
# TODO(#8303): Mac crosstool should also declare every feature. | ||
if is_linux: | ||
# Linux artifact name patterns are the default. | ||
artifact_name_patterns = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is forked from rules_cc with only diff being adding .exe extension for binaries.
@fmeum @meteorcloudy sorry for not properly testing my last PR #24725. I only check https://godbolt.org/z/f35j3M4x9 compile but |
int wmain(int argc, wchar_t* argv[]) { | ||
#else | ||
int main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mingw requires linkopt -municode
to use wmain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this comment in the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do it later. I am on a train currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments added. PTAL.
@@ -250,7 +250,7 @@ wstring JavaBinaryLauncher::CreateClasspathJar(const wstring& classpath) { | |||
binary_base_path + rand_id + L".jar_manifest"; | |||
blaze_util::AddUncPrefixMaybe(&jar_manifest_file_path); | |||
#if (__cplusplus >= 201703L) | |||
wofstream jar_manifest_file(std::filesystem::path(jar_manifest_file_path)); | |||
wofstream jar_manifest_file{std::filesystem::path(jar_manifest_file_path)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use curly brackets here to declare a variable.
e4d7f2f
to
f0401ef
Compare
I'm fine with tweaking the launcher code to allow it build with mingw, but it's not ideal to check in more toolchain config files in Bazel code base. Can you put it your own repo and reference it as needed? |
bf26bcc
to
d660e51
Compare
Removed the changes to add a mingw cc toolchain |
@bazel-io fork 8.0.1 |
@bazel-io fork 7.5.0 |
@bazel-io fork 8.1.0 |
TEST: bazel build --platforms=//:windows_x86_64 --extra_toolchains=@llvm_mingw_linux_x86_64//:cc-toolchain-linux_x86_64-windows_x86_64 //src/tools/launcher:launcher Closes bazelbuild#24752. PiperOrigin-RevId: 711358608 Change-Id: Iedacad9b959427ed5d4598e0ea594cb25b8845c8
TEST: bazel build --platforms=//:windows_x86_64 --extra_toolchains=@llvm_mingw_linux_x86_64//:cc-toolchain-linux_x86_64-windows_x86_64 //src/tools/launcher:launcher Closes #24752. PiperOrigin-RevId: 711358608 Change-Id: Iedacad9b959427ed5d4598e0ea594cb25b8845c8 Commit a4bb254 Co-authored-by: Boleyn Su <boleyn.su@gmail.com>
TEST: bazel build --platforms=//:windows_x86_64 --extra_toolchains=@llvm_mingw_linux_x86_64//:cc-toolchain-linux_x86_64-windows_x86_64 //src/tools/launcher:launcher