Skip to content

Commit

Permalink
Fix cross compilation issue with linux-mips64 architecture
Browse files Browse the repository at this point in the history
When compiling under Yocto project for linux-mips64 target architecture
.so files were generated incorrectly as:

  rpds.cpython-312-mips64-linux-gnu.so

Where as platform and EXT_SUFFIX are defined as:

  >>> sysconfig.get_platform()
  'linux-mips64'
  >>> sysconfig.get_config_vars()['EXT_SUFFIX']
  '.cpython-312-mips64-linux-gnuabi64.so'

Which should have caused the .so files as:

  rpds.cpython-312-mips64-linux-gnuabi64.so

Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
  • Loading branch information
vesajaaskelainen committed Sep 1, 2024
1 parent 9b0f4e8 commit aa812fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/python_interpreter/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,25 @@ mod test {
.unwrap();
assert_eq!(sysconfig.ext_suffix, ".cpython-310-powerpc-linux-gnu.so");

let sysconfig = InterpreterConfig::lookup_one(
&Target::from_target_triple(Some("mips64-unknown-linux-gnu".to_string())).unwrap(),
InterpreterKind::CPython,
(3, 10),
)
.unwrap();
assert_eq!(
sysconfig.ext_suffix,
".cpython-310-mips64-linux-gnuabi64.so"
);

let sysconfig = InterpreterConfig::lookup_one(
&Target::from_target_triple(Some("mips-unknown-linux-gnu".to_string())).unwrap(),
InterpreterKind::CPython,
(3, 10),
)
.unwrap();
assert_eq!(sysconfig.ext_suffix, ".cpython-310-mips-linux-gnu.so");

let sysconfig = InterpreterConfig::lookup_one(
&Target::from_target_triple(Some("s390x-unknown-linux-gnu".to_string())).unwrap(),
InterpreterKind::CPython,
Expand Down
4 changes: 3 additions & 1 deletion src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ impl Target {
match python_impl {
CPython => {
// For musl handling see https://github.com/pypa/auditwheel/issues/349
if python_version >= (3, 11) {
if matches!(self.target_arch(), Arch::Mips64 | Arch::Mips64el) && self.is_linux() {
"gnuabi64".to_string()
} else if python_version >= (3, 11) {
self.target_env().to_string()
} else {
self.target_env().to_string().replace("musl", "gnu")
Expand Down

0 comments on commit aa812fd

Please sign in to comment.