Skip to content

Cannot use dynamic runtime (/MD) in Windows #2120

@javidcf

Description

@javidcf

Looking at msvc_tools.py.tpl, it does not seem to be possible to compile on Windows using the dynamic runtime (that is, using /MD / /MDd and LIBCMT). Even if one adds /MD to the copts of some rule (because passing --copt="/MD" does not even get correctly processed, but that's a different issue), the Python wrapper will add /MT or /MTd, overriding the option. I am trying to compile TensorFlow + some additional code as static libraries to integrate in a bigger project that uses /MD, and with the current behavior it's not possible.

The obvious fix would be to add an additional check to the script before self.AddOpt('/MT'), but I don't really know if there are any other reasons behind this. It seems to me that, if anything, /MD should be favored as the default option (which is what Visual Studio does nowadays).

I am using Bazel 0.4.0 (installed through Chocolatey) in x64 machine with Win10. My build command line looks like:

$ bazel build -c opt --cpu=x64_windows_msvc --host_cpu=x64_windows_msvc --verbose_failures --experimental_ui <target...>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions