Skip to content

Commit 6d457e9

Browse files
committed
Only use Clang on OpenBSD - default to cc (generally GCC) on other platforms
There have been reports that GCC doesn't compile Rust-Crypto on OpenBSD while Clang works fine. However, on Linux platforms (at least Ubuntu 14.04+), GCC works fine and clang may not be installed. So, Only use Clang by default on OpenBSD and continue to use GCC (as "cc") everywhere else.
1 parent 0c7bed2 commit 6d457e9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

build.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@ fn main() {
2525
let mut cfg = gcc::Config::new();
2626
cfg.file("src/util_helpers.c");
2727
cfg.file("src/aesni_helpers.c");
28-
// gcc can't build this library so, unless the user has explicitly
29-
// specified a different C compiler, use clang.
3028
if env::var_os("CC").is_none() {
31-
cfg.compiler(Path::new("clang"));
29+
if host.contains("openbsd") {
30+
// Use clang on openbsd since there have been reports that
31+
// GCC doesn't like some of the assembly that we use on that
32+
// platform.
33+
cfg.compiler(Path::new("clang"));
34+
} else {
35+
cfg.compiler(Path::new("cc"));
36+
}
3237
}
3338
cfg.compile("lib_rust_crypto_helpers.a");
3439
}

0 commit comments

Comments
 (0)