Bazel 6.x nolonger honours static_link_msvcrt_no_debug and static_link_msvcrt_debug
Description of the bug:
We have a custom toolchain defined which is based around the bazel 2 - 5.x toolchains. This add many platforms, security features, and other requirements we need.
When we migrated to bazel 6.0 we started seeing some subtle bugs where we were missing commandline arguments defined in static_link_msvcrt_no_debug and static_link_msvcrt_debug.
I believe that defaulting to static_link_msvcrt is a breaking change and should be recorded in the release notes. Ideally a guard added would be added to error if these two ignored features are defined and a link to migration instructions.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Setup an "old" project based on your machine setup (this will vary depending on VS installation location and version)
.bazelversion: 5.4.0
WORKSPACE: ``
BUILD:
cc_binary(
name = "test",
srcs = ["test.cpp"],
)
test.cpp:
int main(){};
run bazel build ... -c dbg --features=static_link_msvcrt
Now take the default toolchain from 5.4.0 as a subsitute for a customized toolchain.
mkdir toolchain
copy .\bazel-{your_folder_name_here}\external\local_config_cc\* toolchain
.bazelversion: 6.0.0
bazel build ... -c dbg --features=static_link_msvcrt
copy .\bazel-bin\test.exe-2.params correct.params
bazel build ... -c dbg --crosstool_top=//toolchain --host_crosstool_top=//toolchain --features=static_link_msvcrt
copy .\bazel-bin\test.exe-2.params incorrect.params
Diff the two parameters files and you will see /DEFAULTLIB:libcmtd.lib is missing.
It is expected that the two linker command line options match, or an error is raised when evaluating the old toolchain.
Which operating system are you running Bazel on?
windows
What is the output of bazel info release?
release 6.0.0
If bazel info release returns development 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
Have you found anything relevant by searching the web?
I believe the change that causes this issue is: https://github.com/bazelbuild/bazel/pull/14735
https://github.com/bazelbuild/bazel/issues/7691
Any other information, logs, or outputs that you want to share?
No response
Hi @carpenterjc, Can you provide minimal steps to reproduce the above scenario. Thanks !
Thanks @sgowroji I have extended with a set of instructions using a bazelisk and a bazel 5.4.0 autodected toolchain as a substitute for an existing projects toolchain.
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!