1 | use std::env; |
2 | use std::fs; |
3 | use std::io::{Error, Write}; |
4 | use std::path; |
5 | |
6 | // Workaround from https://github.com/rust-lang/rust/pull/85806#issuecomment-1096266946 |
7 | pub fn setup() -> Result<(), Error> { |
8 | let out_dir: String = env::var("OUT_DIR" ).expect(msg:"OUT_DIR not set" ); |
9 | let mut dist: PathBuf = path::PathBuf::from(&out_dir); |
10 | dist.push(path:"libgcc.a" ); |
11 | let mut libgcc: File = fs::File::create(&dist)?; |
12 | let _ = libgcc.write(buf:b"INPUT(-lunwind)" )?; |
13 | drop(libgcc); |
14 | println!("cargo:rustc-link-search= {}" , &out_dir); |
15 | Ok(()) |
16 | } |
17 | |