Infer the default host target from the host toolchain if possible
This fixes ongoing issues where x.py will detect the wrong host triple between MSVC and GNU. - Add line to changelog
This commit is contained in:
parent
07e968b640
commit
3863dee159
3 changed files with 20 additions and 3 deletions
|
@ -187,8 +187,23 @@ def format_build_time(duration):
|
|||
return str(datetime.timedelta(seconds=int(duration)))
|
||||
|
||||
|
||||
def default_build_triple():
|
||||
def default_build_triple(verbose):
|
||||
"""Build triple as in LLVM"""
|
||||
# If the user already has a host build triple with an existing `rustc`
|
||||
# install, use their preference. This fixes most issues with Windows builds
|
||||
# being detected as GNU instead of MSVC.
|
||||
try:
|
||||
version = subprocess.check_output(["rustc", "--version", "--verbose"])
|
||||
host = next(x for x in version.split('\n') if x.startswith("host: "))
|
||||
triple = host.split("host: ")[1]
|
||||
if verbose:
|
||||
print("detected default triple {}".format(triple))
|
||||
return triple
|
||||
except Exception as e:
|
||||
if verbose:
|
||||
print("rustup not detected: {}".format(e))
|
||||
print("falling back to auto-detect")
|
||||
|
||||
default_encoding = sys.getdefaultencoding()
|
||||
required = sys.platform != 'win32'
|
||||
ostype = require(["uname", "-s"], exit=required)
|
||||
|
@ -831,7 +846,7 @@ class RustBuild(object):
|
|||
config = self.get_toml('build')
|
||||
if config:
|
||||
return config
|
||||
return default_build_triple()
|
||||
return default_build_triple(self.verbose)
|
||||
|
||||
def check_submodule(self, module, slow_submodules):
|
||||
if not slow_submodules:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue