From 304a7b79851e4859da8b55e584027870d11d0de5 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 Dec 2017 23:32:42 +0100 Subject: [PATCH 1/2] Link against -lunwind on CloudABI. CloudABI makes use of LLVM's libunwind to do stack unwinding. It is installed under the name libunwind.a. --- src/libunwind/build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index d8457dab51b..afd1e5e1c5e 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -43,5 +43,7 @@ fn main() { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("redox") { println!("cargo:rustc-link-lib=gcc"); + } else if target.contains("cloudabi") { + println!("cargo:rustc-link-lib=unwind"); } } From 146fe0ad75ea9e7f2ba69aa40d496c862aae7814 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Fri, 29 Dec 2017 09:33:26 +0100 Subject: [PATCH 2/2] Add proper library dependencies for libstd on CloudABI. Don't attempt to build libunwind on CloudABI, as libunwind is already provided by the system by default. --- src/libstd/build.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 8a28105ff81..a41c155f3fb 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -20,9 +20,10 @@ fn main() { let target = env::var("TARGET").expect("TARGET was not set"); let host = env::var("HOST").expect("HOST was not set"); if cfg!(feature = "backtrace") && - !target.contains("msvc") && + !target.contains("cloudabi") && !target.contains("emscripten") && !target.contains("fuchsia") && + !target.contains("msvc") && !target.contains("wasm32") { let _ = build_libbacktrace(&host, &target); @@ -74,6 +75,12 @@ fn main() { println!("cargo:rustc-link-lib=zircon"); println!("cargo:rustc-link-lib=fdio"); println!("cargo:rustc-link-lib=launchpad"); // for std::process + } else if target.contains("cloudabi") { + if cfg!(feature = "backtrace") { + println!("cargo:rustc-link-lib=unwind"); + } + println!("cargo:rustc-link-lib=c"); + println!("cargo:rustc-link-lib=compiler_rt"); } }