File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -243,16 +243,19 @@ def cc_toolchain_config(
243243 cxx_standard = compiler_configuration ["cxx_standard" ]
244244 conly_flags = compiler_configuration ["conly_flags" ]
245245 sysroot_path = compiler_configuration ["sysroot_path" ]
246- if stdlib == "builtin-libc++" and exec_os != target_os :
246+
247+ is_xcompile = not (exec_os == target_os and exec_arch == target_arch )
248+
249+ # Darwin has a universal sysroot so the builtin can compile cross-arch.
250+ if stdlib == "builtin-libc++" and is_xcompile and not is_darwin_exec_and_target :
247251 stdlib = "stdc++"
248252 if stdlib == "builtin-libc++" :
249253 cxx_flags = [
250254 "-std=" + cxx_standard ,
251255 "-stdlib=libc++" ,
252256 ]
253257
254- # exec_os == target_os at this point.
255- if exec_os == "darwin" :
258+ if is_darwin_exec_and_target :
256259 # Several system libraries on macOS dynamically link libc++ and
257260 # libc++abi, so static linking them becomes a problem. We need to
258261 # ensure that they are dynamic linked from the system sysroot and
You can’t perform that action at this time.
0 commit comments