Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check for binaries having correct architecture in cross build environments #30

Open
raymanP opened this issue Nov 9, 2023 · 0 comments
Labels
enhancement New feature or request therefor new check Adding a new check

Comments

@raymanP
Copy link

raymanP commented Nov 9, 2023

Hi,
when building multiple architectures in cross build environment wrong architecture can happen to build, e.g. x86_64 instead of aarch64. This could be checked using file to the binaries.

For example building package-1.6.9-cp37-cp37m-linux_aarch64.whl
containing:

package/
module.cpython-37m-aarch64-linux-gnu.so

check that file architecture:
e.g. file module.cpython-37m-aarch64-linux-gnu.so returns
module.cpython-37m-aarch64-linux-gnu.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, stripped

A wrong architecture would return for example:

  • armv7l: ....so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped
  • x86_64: ....so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=cfeef54b3b6f07621a242d8b4ea336c926be74c0, stripped
  • i686: ....so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=7d289cf9b0f011f82c8af9171a642bc1bec31ac4, stripped
  • macOS intel 64: ....so: Mach-O 64-bit x86_64 bundle, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL>
  • macOS arm 64: ....so: Mach-O 64-bit arm64 bundle, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL>
  • win x32: ....pyd: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows, 5 sections
  • win x64: ....pyd: PE32+ executable (DLL) (GUI) x86-64, for MS Windows, 6 sections

Under Linux/macOS the binaries are .so files and under Windows these are .pyd files.

Possible argument could be: --check-arch "ARM aarch64"
Maybe is also possible some auto check from wheel tag, like: Tag: cp37-cp37m-linux_aarch64 or from the wheel file name

Regards, Reimund

@jwodder jwodder added enhancement New feature or request therefor new check Adding a new check labels Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request therefor new check Adding a new check
Projects
None yet
Development

No branches or pull requests

2 participants