Fix hard and soft float libc detection for managed Python distributions on ARM (#8498)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::cpuinfo::detect_hardware_floating_point_support;
|
||||
use crate::libc::{detect_linux_libc, LibcDetectionError, LibcVersion};
|
||||
use std::fmt::Display;
|
||||
use std::ops::Deref;
|
||||
@@ -30,7 +31,17 @@ impl Libc {
|
||||
pub(crate) fn from_env() -> Result<Self, LibcDetectionError> {
|
||||
match std::env::consts::OS {
|
||||
"linux" => Ok(Self::Some(match detect_linux_libc()? {
|
||||
LibcVersion::Manylinux { .. } => target_lexicon::Environment::Gnu,
|
||||
LibcVersion::Manylinux { .. } => match std::env::consts::ARCH {
|
||||
// Checks if the CPU supports hardware floating-point operations.
|
||||
// Depending on the result, it selects either the `gnueabihf` (hard-float) or `gnueabi` (soft-float) environment.
|
||||
// download-metadata.json only includes armv7.
|
||||
"arm" | "armv7" => match detect_hardware_floating_point_support() {
|
||||
Ok(true) => target_lexicon::Environment::Gnueabihf,
|
||||
Ok(false) => target_lexicon::Environment::Gnueabi,
|
||||
Err(_) => target_lexicon::Environment::Gnu,
|
||||
},
|
||||
_ => target_lexicon::Environment::Gnu,
|
||||
},
|
||||
LibcVersion::Musllinux { .. } => target_lexicon::Environment::Musl,
|
||||
})),
|
||||
"windows" | "macos" => Ok(Self::None),
|
||||
|
||||
Reference in New Issue
Block a user