Skip to content
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: statically link msvcrt into Bazel #8328

Closed
laszlocsomor opened this issue May 15, 2019 · 4 comments
Closed

Windows: statically link msvcrt into Bazel #8328

laszlocsomor opened this issue May 15, 2019 · 4 comments
Labels
area-Windows Windows-specific issues and feature requests P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request

Comments

@laszlocsomor
Copy link
Contributor

Description of the problem / feature request:

Link msvcrt statically into Bazel.

Feature requests: what underlying problem are you trying to solve with this feature?

To not require the user installing the VC redistributable DLLs before running Bazel (e.g. msvcrt140.dll).

These DLLs are likely installed for most users because virtually every MSVC-built binary requires them (except the statically linked ones). However these DLLs are not part of the default Windows installation, so both Desktop and Server versions lack them.

It would improve first-time Bazel usage if the user didn't have to install these DLLs before running Bazel.

Prerequisites:

  • @bazel_tools//tools/cpp/runfiles should have this feature enabled
  • sign-off from @meisterT that the size increase (see below) is acceptable

What operating system are you running Bazel on?

Windows 10

What's the output of bazel info release?

0.26.0 rc8

Any other information, logs, or outputs that you want to share?

As an experimented, I took a033de4 and updated all packages with cc_library and cc_binary deps of Bazel with:

package(features = ["static_link_msvcrt"])

to link msvcrt statically.

The good news is, it's possible and Bazel works on a clean Windows Server image without the DLLs.

The even better news is, it only adds about 1.5MB to the Bazel binary (46,105,380 bytes vs. 47,611,573 bytes).

@laszlocsomor laszlocsomor added type: feature request P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) area-Windows Windows-specific issues and feature requests bazel 1.0 labels May 15, 2019
@laszlocsomor
Copy link
Contributor Author

FYI @meteorcloudy @hlopko

@meteorcloudy
Copy link
Member

Sounds like a good deal to me ;)

@meisterT
Copy link
Member

1.5MB is big, almost ~3.5% of the binary. We were removing many smaller things to reach this size.

Do you have a clue how many users install bazel via chocolatey? Is that the majority? Is it possible to specify a dependency on the DLLs there?

@laszlocsomor
Copy link
Contributor Author

Thanks for the perspective.

https://chocolatey.org/packages/bazel/0.25.1 says Bazel was installed a total of 62k times, but that's all-time download and may or may not include ephemeral installations (e.g. CI systems).
Secondly, with #7437 we will have a dependency on the msvcrt DLLs. Therefore Chocolatey installs are no concern.

This feature would help those who just download a naked Bazel binary from github or releases.bazel.build. But I have no data on those download numbers.

I agree it's a low-priority feature request, hence P4.

@dslomov dslomov removed the bazel 1.0 label Jul 24, 2019
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants