From 0d9a0f84e43fdb3eef34ff9726f7cb915a2b619a Mon Sep 17 00:00:00 2001 From: Andy Polyakov <9038069+dot-asm@users.noreply.github.com> Date: Sun, 5 Feb 2023 23:58:01 +0100 Subject: [PATCH] Append `freebsd-version` to all --target=*-freebsd if executed on FreeBSD. (#788) --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a998f4951..d26ba67bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1720,10 +1720,13 @@ impl Build { } else if target.contains("aarch64") { cmd.args.push("--target=aarch64-unknown-windows-gnu".into()) } - } else if target.ends_with("-freebsd") && self.get_host()?.eq(target) { + } else if target.ends_with("-freebsd") && self.get_host()?.ends_with("-freebsd") + { // clang <= 13 on FreeBSD doesn't support a target triple without at least // the major os version number appended; e.g. use x86_64-unknown-freebsd13 // or x86_64-unknown-freebsd13.0 instead of x86_64-unknown-freebsd. + // The current version is appended. If it doesn't align with your goals, pass + // .flag("--target=...") in the build script or adjust CXXFLAGS accordingly. let stdout = std::process::Command::new("freebsd-version") .output() .map_err(|e| {