Use clang instead of gcc, which seems easier to install.

This commit is contained in:
2023-04-16 15:32:34 -07:00
parent d455ee87b5
commit c2c2cbd02a

View File

@@ -52,11 +52,10 @@ impl Backend<ObjectModule> {
}
}
#[cfg(target_family = "unix")]
fn link(object_file: &Path, executable_path: &Path) -> Result<(), EvalError> {
use std::{os::unix::prelude::PermissionsExt, path::PathBuf};
use std::path::PathBuf;
let output = std::process::Command::new("gcc")
let output = std::process::Command::new("clang")
.arg(
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("runtime")
@@ -67,16 +66,13 @@ impl Backend<ObjectModule> {
.arg(executable_path)
.output()?;
if output.stderr.is_empty() {
let mut perms = std::fs::metadata(executable_path)?.permissions();
perms.set_mode(perms.mode() | 0o100); // user execute bit
std::fs::set_permissions(executable_path, perms)?;
Ok(())
} else {
Err(EvalError::IO(
if !output.stderr.is_empty() {
return Err(EvalError::IO(
std::string::String::from_utf8_lossy(&output.stderr).to_string(),
))
));
}
Ok(())
}
}