packaging icon indicating copy to clipboard operation
packaging copied to clipboard

Detect x32 userspace ABI on 64-bit kernel

Open pradyunsg opened this issue 6 years ago • 6 comments

Given pypa/pip#6908, do we want to put try to get this into pypa/packaging instead?

Originally posted by @chrahunt in https://github.com/pypa/pip/pull/5391#issuecomment-524663064

This would be a fix related to pypa/pip#4962.

pradyunsg avatar Oct 04 '19 05:10 pradyunsg

Is this still relevant?

pradyunsg avatar Dec 10 '21 16:12 pradyunsg

I believe so. packaging.tags still assumes i686 when a 32-bit interpreter is run on a 64-bit platform.

https://github.com/pypa/packaging/blob/5984e3b25f4fdee64aad20e98668c402f7ed5041/packaging/tags.py#L419-L423

uranusjr avatar Dec 10 '21 19:12 uranusjr

FWIW I think the right way to do this (back when I was working on a fix) was to look at whatever ELF interpreter Python was called with and use that to pick the arch. This would require parsing the Python ELF...

ehashman avatar Dec 11 '21 20:12 ehashman

We are already parsing ELF for both manylinux and musllinux detection so why not :p

uranusjr avatar Dec 11 '21 20:12 uranusjr

How do we start building this? Parsing the ELF is the easy part, but making sense of the data requires more research. Is there a list of machine and ABI information of common platforms available?

uranusjr avatar Apr 20 '22 04:04 uranusjr

https://wiki.debian.org/X32Port#Detecting_X32 is the official answer, I think.

The unofficial answer I was going for is looking at the path of the ELF interpreter Python was built with. On an x32 system, there should always be x32 (rather than i386) in the path... either it's in /libx32 or symlinks to something with x32 in the filename in /lib. Hacky but probably reliable.

ehashman avatar Apr 26 '22 03:04 ehashman