pypa / cibuildwheel

🎡 Build Python wheels for all the platforms with minimal configuration.
https://cibuildwheel.pypa.io
Other
1.87k stars 239 forks source link

Unable to build on armv7l #2046

Closed Marco-Sulla closed 1 month ago

Marco-Sulla commented 1 month ago

Description

I tried to add armv7l to my pipeline, but it failed.

Inspecting cibuildwheel code, I found this:

https://github.com/pypa/cibuildwheel/blob/main/cibuildwheel/oci_container.py#L243-L261

If the first call() raises an exception, the var container_machine gets a value only if the platform is i386, not if it's armv7.

Build log

https://github.com/Marco-Sulla/python-frozendict/actions/runs/11408867572/job/31747946353?pr=110#step:4:6217

CI config

https://github.com/Marco-Sulla/python-frozendict/blob/armv7l/.github/workflows/build_secondary_wheels.yml

mayeut commented 1 month ago

QEMU is only setup for arm64 in the CI Config. You also need to add arm.

Marco-Sulla commented 1 month ago

Ty @mayeut it works :)

Can be the error a bit more verbose? Something like that:

            container_machine = None

            try:
                container_machine = call(
                    *run_cmd, *platform_args, self.image, *ctr_cmd, capture_stdout=True
                ).strip()
            except subprocess.CalledProcessError:
                if self.oci_platform == OCIPlatform.i386:
                    # The image might have been built with amd64 architecture
                    # Let's try that
                    platform_args = self._get_platform_args(oci_platform=OCIPlatform.AMD64)
                    container_machine = call(
                        *run_cmd, *platform_args, self.image, *ctr_cmd, capture_stdout=True
                    ).strip()

            if container_machine is None:
                raise SomeError("some message")

            simulate_32_bit = container_machine not in {"i686", "armv7l", "armv8l"}