@@ -66,7 +66,7 @@ def instantiate_template_file(template_path: Path, output_path: Path, make_exec:
66
66
output_path .chmod (output_path .stat ().st_mode | stat .S_IEXEC )
67
67
68
68
69
- def host_config (target : str , sysroot_flags : str ) -> str :
69
+ def host_config (target : str , toolchain_flags : str ) -> str :
70
70
cc_wrapper_name = OUT_PATH_WRAPPERS / ('clang-%s' % target )
71
71
cxx_wrapper_name = OUT_PATH_WRAPPERS / ('clang++-%s' % target )
72
72
@@ -76,15 +76,15 @@ def host_config(target: str, sysroot_flags: str) -> str:
76
76
real_cc = CC_PATH ,
77
77
ld_option = LD_OPTIONS ,
78
78
target = target ,
79
- sysroot_flags = sysroot_flags )
79
+ toolchain_flags = toolchain_flags )
80
80
81
81
instantiate_template_exec (
82
82
HOST_CXX_WRAPPER_TEMPLATE ,
83
83
cxx_wrapper_name ,
84
84
real_cxx = CXX_PATH ,
85
85
ld_option = LD_OPTIONS ,
86
86
target = target ,
87
- sysroot_flags = sysroot_flags ,
87
+ toolchain_flags = toolchain_flags ,
88
88
cxxstd = CXXSTD_PATH ,
89
89
cxx_linker_flags = CXX_LINKER_FLAGS )
90
90
@@ -116,18 +116,21 @@ def device_config(target: str) -> str:
116
116
117
117
def configure ():
118
118
"""Generates config.toml for the rustc build."""
119
- sysroot = None
120
- # Apple removed the normal sysroot at / on Mojave+, so we need
121
- # to go hunt for it on OSX
122
- # On pre-Mojave, this command will output the empty string.
119
+ host_toolchain_flags = None
120
+
123
121
if build_platform .system () == 'darwin' :
122
+ # Apple removed the normal sysroot at / on Mojave+, so we need
123
+ # to go hunt for it on OSX
124
+ # On pre-Mojave, this command will output the empty string.
124
125
output = subprocess .check_output (
125
126
['xcrun' , '--sdk' , 'macosx' , '--show-sdk-path' ])
126
- sysroot = output .rstrip ().decode ('utf-8' )
127
- host_sysroot_flags = ("--sysroot " + sysroot ) if sysroot else ""
127
+ host_toolchain_flags = "--sysroot " + output .rstrip ().decode ('utf-8' )
128
+ else :
129
+ # On Linux build hosts we need to set the path to the gcc toolchain.
130
+ host_toolchain_flags = "-B " + GCC_TOOLCHAIN_PATH .as_posix ()
128
131
129
132
host_configs = '\n ' .join (
130
- [host_config (target , host_sysroot_flags ) for target in HOST_TARGETS ])
133
+ [host_config (target , host_toolchain_flags ) for target in HOST_TARGETS ])
131
134
device_configs = '\n ' .join (
132
135
[device_config (target ) for target in DEVICE_TARGETS ])
133
136
0 commit comments