-
-
Notifications
You must be signed in to change notification settings - Fork 251
WIP: VERY EARLY DRAFT! WIP WIP WIP!!!! - Add clang-cl windows cross compilation #154
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
WIP: VERY EARLY DRAFT! WIP WIP WIP!!!! - Add clang-cl windows cross compilation #154
Conversation
Thanks! We would definitely welcome any Windows support in here, if we can introduce it while keeping things relatively clean. I can give you write permissions if you want. Unfortunately, I don't pay attention to this project anymore, so won't directly review your code. |
toolchain/cc_toolchain_config.bzl
Outdated
msvc_lib_path = tools_path_prefix + "llvm-lib" | ||
|
||
cxx_builtin_include_directories = [ | ||
"/home/greg/.cache/bazel/_bazel_greg/ea13bb2946567f0877199a8bd9383c6f/" + toolchain_path_prefix + "include/c++/v1", |
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 hack is obviously wrong, it used the hermetic toolchain as downloaded, but I need to figure out how to educate bazel via skylark about how to point to the downloads without a massive hack.
sysroot_path + "/crt/lib/x86_64", | ||
sysroot_path + "/sdk/lib/um/x86_64", | ||
sysroot_path + "/sdk/lib/ucrt/x86_64", | ||
# TODO: How to get this in a sysroot |
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.
What I mean by this TODO is that this comes from the clang bundle, but only from the windows clang bundle.
This is a bit weird as the linux clang bundle contains everything else, but omits this file, its easy to script this part in the preparation of a windows sysroot (or maybe we ask LLVM upstream to include it as part of the linux tarball).
|
||
host_tool_features = struct( | ||
SUPPORTS_ARG_FILE = "supports_arg_file", | ||
) | ||
|
||
toolchain_tools = [ | ||
"clang-cpp", | ||
"clang-cl", |
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.
These are present in the linux (maybe OSX?) bundles, but I can naturally look to make them optional / stub files.
@@ -19,7 +19,8 @@ | |||
import sys | |||
|
|||
|
|||
_known_distros = ["freebsd", "suse", "ubuntu", "arch", "manjaro", "debian", "fedora", "centos", "amzn", "raspbian", "pop"] | |||
_known_distros = ["freebsd", "suse", "ubuntu", "arch", "manjaro", "debian", | |||
"fedora", "centos", "amzn", "raspbian", "pop", "nixos"] |
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.
Minor: This is unrelated to windows toolchains, my personal Linux is NixOS, but I am pretending it is equivalent to Ubuntu.
Will remove for a real release
@@ -122,6 +122,9 @@ def _linux(llvm_version, distname, version, arch): | |||
elif distname == "raspbian": | |||
arch = "armv7a" | |||
os_name = "linux-gnueabihf" | |||
elif distname == "nixos": |
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.
Minor: This is unrelated to windows toolchains, my personal Linux is NixOS, but I am pretending it is equivalent to Ubuntu.
Will remove for a real release
Might be good, I will wait for others to chime in on thoughts of how to do these things. |
Hi, this is going to be a little insane and a little strange but I would like to get a read on the following as I refine it towards a potential addition to these rules. The following code allows for cross compiling windows (with MSVC ABI rather than GNU, and I hope to adapt it to cope with clang on windows too. If this is something wanted I can polish these rules further rather than fork and adapt. This is very much an initial read, so there are some hacks, a hardcoded path I could use help with and probably constructions that I am sure we want to change.
0d43fdc
to
cb1d170
Compare
@GregBowyer, are you still interested in pursuing this? |
Closing now because of inactivity. We can reopen if needed. |
…
Hi, this will be a little insane and a little strange, but I would
like to get a read on the following as I refine it towards a potential
addition to these rules.
The following code allows for cross compiling windows (with MSVC ABI
rather than GNU, and I hope to adapt it to cope with clang on windows
too.
If this is something wanted I can polish these rules further rather than
fork and adapt.
This is very much an initial read, so there are some hacks, a hard-coded
path I could use help with and probably constructions that I am sure we
want to change.
As an example of this running (the binary is bytewise equivalent to the windows produced version) is as follows.
https://youtu.be/v54e1pSMUbw