From 8b60471abdaa967f80b0f7baf44569e4a1e485b3 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 30 Oct 2024 00:38:20 -0500 Subject: [PATCH] Use DLL_EXTENSION rather than hardcoding `.so` Non-Linux platforms should be able to build the backend, but MacOS can't find the shared library because the extension is incorrect. Use `DLL_EXTENSION` rather than a fixed `.so`. --- bootstrap/src/manifest.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bootstrap/src/manifest.rs b/bootstrap/src/manifest.rs index 7f9eb99..31e9ec8 100644 --- a/bootstrap/src/manifest.rs +++ b/bootstrap/src/manifest.rs @@ -1,5 +1,6 @@ use anstream::eprintln as println; use color_print::cprintln; +use std::env; use std::path::{Path, PathBuf}; use std::process::Command; @@ -45,12 +46,13 @@ impl Manifest { } /// The path to the rustc codegen c library - pub fn codegen_backend(&self) -> &'static Path { - if self.release { - Path::new("crates/target/release/librustc_codegen_c.so") + pub fn codegen_backend(&self) -> PathBuf { + let path = if self.release { + Path::new("crates/target/release/librustc_codegen_c") } else { - Path::new("crates/target/debug/librustc_codegen_c.so") - } + Path::new("crates/target/debug/librustc_codegen_c") + }; + path.with_extension(env::consts::DLL_EXTENSION) } /// The command to run rustc with the codegen backend