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> { 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( .arg(
PathBuf::from(env!("CARGO_MANIFEST_DIR")) PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("runtime") .join("runtime")
@@ -67,16 +66,13 @@ impl Backend<ObjectModule> {
.arg(executable_path) .arg(executable_path)
.output()?; .output()?;
if output.stderr.is_empty() { if !output.stderr.is_empty() {
let mut perms = std::fs::metadata(executable_path)?.permissions(); return Err(EvalError::IO(
perms.set_mode(perms.mode() | 0o100); // user execute bit
std::fs::set_permissions(executable_path, perms)?;
Ok(())
} else {
Err(EvalError::IO(
std::string::String::from_utf8_lossy(&output.stderr).to_string(), std::string::String::from_utf8_lossy(&output.stderr).to_string(),
)) ));
} }
Ok(())
} }
} }