-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Building Carbon on Windows without WSL #298
Comments
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the |
Can you say a bit more about the program you wrote? Was this a batch file? An executable that used |
Note, #1754 is already working on this and I think it's using a better approach. |
Agree that #1754 looks like a good path forward for resolving this issue. The "Shell" in |
This PR fixes issue #298. I am attempting to build Carbon using Bazel on Windows, without the need to go through WSL. This is still a work in progress, below is a list of issues I have discovered and my fixes for them. - Windows does not support Homebrew; however, I was able to properly install all of the required packages through [Chocolatey](https://chocolatey.org/). This was my first time using the Chocolatey package manager, yet it was fairly easy to use. I believe there are other options as well for Windows. - As is mentioned in issue #298, your Windows installation must be running in [Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development). This will allow unprivileged users to create symlinks during the build process. - As it currently stands in trunk, clang_configuration.bzl will fail when attempting to run the method `_compute_clang_cpp_include_search_paths` on Windows. I have discovered that this is because Clang++.exe fails to execute if you provide it with an input file that does not exist. Thus, I have the build script generate an empty temp file in the Bazel repo for Clang to use when running the above method. - A cc toolchain specifically for Windows was created in clang_toolchain.BUILD. I simply mimicked what was done for other platforms, I apologize if this is incorrect since I am fairly new to Bazel. As I understand it, the next step is to configure clang_cc_toolchain_config.bzl to support the new Windows toolchain. I intend to continue working on this, however as I stated I am quite new so help is seriously appreciated! Co-authored-by: Jon Ross-Perkins <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
My case is “no such package '@llvm-project//llvm'”
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
Unfortunately, China's network access is limited, and bazel stays in a loop loading dependencies, so I'm willing to try compiling carbon if it works out of the box like cmake. |
@ddkwork This issue is about building Carbon for development (on Carbon, not using Carbon) on Windows. Cmake support for releases is separate (could probably done with add_custom_command already, but Carbon's not stable enough to make it a priority). |
Note, WSL hasn't been mentioned here, but it's my understanding that it generally works. It might still be worth keeping this for native use of bazel to build Carbon on Windows. |
The only way I've tried to use bazel is with clion, and as I mentioned before, either compiling carbon explorer or using explorer to compile carbon code is a terrible operation as long as it requires that you have to use bazel, for China only, as China has no access to the various packages and deps of bazel, and unless there's an official public proxy or mirror, the nuisance caused by bazel is a pain in the ass. |
Sorry its frustrating. =/ We get a lot of benefit from Bazel and being able to scale out our dependencies though. There does seem to be instructions for separating when Bazel accesses the internet: https://bazel.build/run/build#running-bazel-airgapped I've not tried the repository cache approach, but if you or anyone else tries it out and has useful instructions for how to set it up and what to expect, I think that would be a great contribution to our docs to help folks out where internet access isn't easy. Beyond that, we are now publishing nightly builds here: These should work on WSL, and don't require Bazel or anything else -- you can just extract and try things out. It only has the toolchain, not the explorer, as that's where most of our focus is these days. In general, I would expect these nightly builds to get better and better and be a much easier way to try something out quickly than building everything from source. The latter is really for folks who want to contribute to Carbon. |
i can not open this link
https://bazel.build/run/build#running-bazel-airgapped
And the released bin seems not supposed Windows?
…---Original---
From: "Chandler ***@***.***>
Date: Mon, Jul 1, 2024 13:44 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [carbon-language/carbon-lang] Building Carbon on Windows withoutWSL (#298)
Note, WSL hasn't been mentioned here, but it's my understanding that it generally works. It might still be worth keeping this for native use of bazel to build Carbon on Windows.
The only way I've tried to use bazel is with clion, and as I mentioned before, either compiling carbon explorer or using explorer to compile carbon code is a terrible operation as long as it requires that you have to use bazel, for China only, as China has no access to the various packages and deps of bazel, and unless there's an official public proxy or mirror, the nuisance caused by bazel is a pain in the ass.
Sorry its frustrating. =/
We get a lot of benefit from Bazel and being able to scale out our dependencies though. There does seem to be instructions for separating when Bazel accesses the internet: https://bazel.build/run/build#running-bazel-airgapped
I've not tried the repository cache approach, but if you or anyone else tries it out and has useful instructions for how to set it up and what to expect, I think that would be a great contribution to our docs to help folks out where internet access isn't easy.
Beyond that, we are now publishing nightly builds here:
https://github.com/carbon-language/carbon-lang/releases
These should work on WSL, and don't require Bazel or anything else -- you can just extract and try things out. It only has the toolchain, not the explorer, as that's where most of our focus is these days. In general, I would expect these nightly builds to get better and better and be a much easier way to try something out quickly than building everything from source. The latter is really for folks who want to contribute to Carbon.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
https://github.com/carbon-language/carbon-lang/releases/tag/v0.0.0-0.nightly.2024.07.01 Will it run on Windows? |
It should run on WSL. We don't have native Windows builds yet (that's the subject of this bug). |
My starting point was also to build explorer on win11, halfway through the conversation because bazel couldn't proceed
…---Original---
From: "Chandler ***@***.***>
Date: Mon, Jul 1, 2024 14:39 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [carbon-language/carbon-lang] Building Carbon on Windows withoutWSL (#298)
v0.0.0-0.nightly.2024.07.01 (release)
Will it run on Windows?
It should run on WSL. We don't have native Windows builds yet (that's the subject of this bug).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
If both bazel and cmake are supported, I'm sure explorer will support Windows before too long, and even if I fail, there are more people who can try it. cmake has almost no hellish limitations out of the box. bazel I have a feeling that unless you're in the US, it will keep loading dependencies until monkey business.
…---Original---
From: "Chandler ***@***.***>
Date: Mon, Jul 1, 2024 14:39 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [carbon-language/carbon-lang] Building Carbon on Windows withoutWSL (#298)
v0.0.0-0.nightly.2024.07.01 (release)
Will it run on Windows?
It should run on WSL. We don't have native Windows builds yet (that's the subject of this bug).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I can confirm that the nightly builds work on WSL with almost no other dependencies. I made a fresh Ubuntu and other than clang-16 needed nothing else to use the nightly builds. No bazel, nothing else. |
No, the syntax of carbon is not very new to me, as I am very familiar with the go language. My intention is to make carbon work under Windows and not Linux!
…---Original---
From: "Kate ***@***.***>
Date: Mon, Jul 1, 2024 19:23 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [carbon-language/carbon-lang] Building Carbon on Windows withoutWSL (#298)
Beyond that, we are now publishing nightly builds here: https://github.com/carbon-language/carbon-lang/releases
These should work on WSL, and don't require Bazel or anything else -- you can just extract and try things out. It only has the toolchain, not the explorer, as that's where most of our focus is these days. In general, I would expect these nightly builds to get better and better and be a much easier way to try something out quickly than building everything from source. The latter is really for folks who want to contribute to Carbon.
I can confirm that the nightly builds work on WSL with almost no other dependencies. I made a fresh Ubuntu and other than clang-16 needed nothing else to use the nightly builds. No bazel, nothing else.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
After removing -fPIC from clang_cc_toolchain_config.bzl (which is unsupported by clang on Windows), bazel got stuck on building flex due to libgen.h 😕
If I disable building //explorer I get
Removing
|
Building on Windows is low priority but it may be helpful to have a common place where we keep track of known problems.
The first problem I hit was https://github.com/google/llvm-bazel fails if it can't create symlinks, which Windows doesn't allow by default for unprivileged users. This can be changed by enabling Developer Mode.
Current blocker is our toolchain configuration expects to find Clang at
bin/clang
but it'sbin/clang.exe
. Once that's fixed I assume there will be wrinkles around turningclang.exe
intoclang++.exe
.The text was updated successfully, but these errors were encountered: