diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 27255b6910093..caf2402f40c4b 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -315,7 +315,7 @@ def build_triple(self): try: ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding) cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding) - except (subprocess.CalledProcessError, WindowsError): + except (subprocess.CalledProcessError, OSError): if sys.platform == 'win32': return 'x86_64-pc-windows-msvc' err = "uname not found" @@ -345,6 +345,21 @@ def build_triple(self): ostype = 'unknown-openbsd' elif ostype == 'NetBSD': ostype = 'unknown-netbsd' + elif ostype == 'SunOS': + ostype = 'sun-solaris' + # On Solaris, uname -m will return a machine classification instead + # of a cpu type, so uname -p is recommended instead. However, the + # output from that option is too generic for our purposes (it will + # always emit 'i386' on x86/amd64 systems). As such, isainfo -k + # must be used instead. + try: + cputype = subprocess.check_output(['isainfo', + '-k']).strip().decode(default_encoding) + except (subprocess.CalledProcessError, OSError): + err = "isainfo not found" + if self.verbose: + raise Exception(err) + sys.exit(err) elif ostype == 'Darwin': ostype = 'apple-darwin' elif ostype.startswith('MINGW'): diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index f18b694d3d0c7..ea0d76978339d 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -27,6 +27,8 @@ fn main() { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("openbsd") { println!("cargo:rustc-link-lib=gcc"); + } else if target.contains("solaris") { + println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("bitrig") { println!("cargo:rustc-link-lib=c++abi"); } else if target.contains("dragonfly") {