Skip to content

Commit e25b20f

Browse files
committed
Do not default to native target when $OPENBLAS_TARGET is invalid #78
1 parent cee2fd0 commit e25b20f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

openblas-src/build.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,15 @@ fn build() {
104104
} else {
105105
cfg.no_static = true;
106106
}
107-
cfg.target = match env::var("OPENBLAS_TARGET") {
108-
Ok(target) => target.parse().ok(),
109-
_ => None,
110-
};
107+
if let Ok(target) = env::var("OPENBLAS_TARGET") {
108+
cfg.target = Some(
109+
target
110+
.parse()
111+
.expect("Unsupported target is specified by $OPENBLAS_TARGET"),
112+
)
113+
// Do not default to the native target (represented by `cfg.target == None`)
114+
// because most user set `$OPENBLAS_TARGET` explicitly will hope not to use the native target.
115+
}
111116

112117
let output = if feature_enabled("cache") {
113118
use std::{collections::hash_map::DefaultHasher, hash::*};

0 commit comments

Comments
 (0)