@@ -131,7 +131,6 @@ def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
131131 tuple: A tuple of the following items:
132132 - (sequence): A flattened list of C command line flags.
133133 - (sequence): A flattened list of CXX command line flags.
134- - (sequence): A flattened list of AR command line flags.
135134 - (dict): C environment variables to be set for this configuration.
136135 """
137136 compile_variables = cc_common .create_compile_variables (
@@ -148,17 +147,12 @@ def get_cc_compile_args_and_env(cc_toolchain, feature_configuration):
148147 action_name = ACTION_NAMES .cpp_compile ,
149148 variables = compile_variables ,
150149 )
151- cc_ar_args = cc_common .get_memory_inefficient_command_line (
152- feature_configuration = feature_configuration ,
153- action_name = ACTION_NAMES .cpp_link_static_library ,
154- variables = compile_variables ,
155- )
156150 cc_env = cc_common .get_environment_variables (
157151 feature_configuration = feature_configuration ,
158152 action_name = ACTION_NAMES .c_compile ,
159153 variables = compile_variables ,
160154 )
161- return cc_c_args , cc_cxx_args , cc_ar_args , cc_env
155+ return cc_c_args , cc_cxx_args , cc_env
162156
163157def _pwd_flags_sysroot (args ):
164158 """Prefix execroot-relative paths of known arguments with ${pwd}.
@@ -429,12 +423,13 @@ def _cargo_build_script_impl(ctx):
429423 env ["CC" ] = "${{pwd}}/{}" .format (ctx .executable ._fallback_cc .path )
430424 env ["CXX" ] = "${{pwd}}/{}" .format (ctx .executable ._fallback_cxx .path )
431425 env ["AR" ] = "${{pwd}}/{}" .format (ctx .executable ._fallback_ar .path )
426+ env ["ARFLAGS" ] = ""
432427 env ["CFLAGS" ] = ""
433428 env ["CXXFLAGS" ] = ""
434429
435430 if cc_toolchain :
436431 # MSVC requires INCLUDE to be set
437- cc_c_args , cc_cxx_args , cc_ar_args , cc_env = get_cc_compile_args_and_env (cc_toolchain , feature_configuration )
432+ cc_c_args , cc_cxx_args , cc_env = get_cc_compile_args_and_env (cc_toolchain , feature_configuration )
438433 include = cc_env .get ("INCLUDE" )
439434 if include :
440435 env ["INCLUDE" ] = include
@@ -464,7 +459,9 @@ def _cargo_build_script_impl(ctx):
464459 # for example, itself derived from the `macos_minimum_os` Bazel argument).
465460 env ["CFLAGS" ] = " " .join (_pwd_flags (cc_c_args ))
466461 env ["CXXFLAGS" ] = " " .join (_pwd_flags (cc_cxx_args ))
467- env ["ARFLAGS" ] = " " .join (_pwd_flags (cc_ar_args ))
462+ # It may be tempting to forward ARFLAGS, but cc-rs is opinionated enough
463+ # that doing so is more likely to hurt than help. If you need to change
464+ # ARFLAGS, make changes to cc-rs.
468465
469466 # Inform build scripts of rustc flags
470467 # https://github.com/rust-lang/cargo/issues/9600
0 commit comments