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

github/workflows/cibuildwheel.yml: Add ubuntu aarch64 #196

Merged
merged 24 commits into from
Jun 25, 2024

Conversation

rbange
Copy link
Contributor

@rbange rbange commented Mar 18, 2024

Build a wheel for linux on arm to enable e.g. dockerized usage on Apple Silicon an SBCs.

closes #158

@CLAassistant
Copy link

CLAassistant commented Mar 18, 2024

CLA assistant check
All committers have signed the CLA.

@rbange rbange changed the title github/workflows/cibuildwheel.yml: Add ubuntu arm64 github/workflows/cibuildwheel.yml: Add ubuntu aarch64 Mar 18, 2024
@tkralphs
Copy link
Member

Looks like something went wrong with the runner, but it's not clear to me what the issue is.

@rbange
Copy link
Contributor Author

rbange commented Mar 26, 2024

Also the runner seems to be caught in an infinite loop due to the error. Can you cancel the run manually? Ill have a look later

@tkralphs
Copy link
Member

Poking at this a bit, I'm not sure where the issue is. The error is from running an image that is not compatible with the platform, but it is not clear if this is a Github issue or a cibuildwheel issue. It could be the latter. Maybe try what's recommended here?

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 27, 2024

Yes, the docker/setup-qemu-action is needed if one wants to build without setting things up properly for cross

@rbange
Copy link
Contributor Author

rbange commented Mar 27, 2024

Unfortunately, Linux ARM runners are still in private beta so that will be the way to go. I am a bit confused that macos can build for arm on amd64, but linux cannot. I will implement the recommended qemu setup.

@tkralphs
Copy link
Member

I am a bit confused that macos can build for arm on amd64, but linux cannot

Actually, MacOS can't do this either. macos-14 runners are using Apple Silicon. Before those were introduced, we couldn't build wheels for those platforms either.

@tkralphs
Copy link
Member

Looks like two issues:

  • Looks like pkg-config is not available on the docker image in the qemu setup.
  • For some reason, it is trying to upload artifacts with the same name, I didn't check it very carefully.

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 27, 2024

  • For some reason, it is trying to upload artifacts with the same name, I didn't check it very carefully.

The attempted upgrade of the upload-artifact action here causes this. Changes like this are best not mixed in with the proposed changes for the purpose of this PR.

upload-artifact v4 is not compatible with our use of the action.

@rbange
Copy link
Contributor Author

rbange commented Apr 2, 2024

Hi everyone,

yes the upload/download artifact version bumping is on me. However this needs to be addressed as well as the current used version is deprecated. Can / Should be addressed in another PR that is true.

However the regarding the actual error for ubuntu aarch64 I think the error lies in the before_all step of cibuildwheels. It seems like the custom script located

[tool.cibuildwheel]
cannot install cbc and fails silently:

  UNAME_MACHINE = aarch64
  UNAME_RELEASE = 6.5.0-1016-azure
  UNAME_SYSTEM  = Linux
  UNAME_VERSION = #16~22.04.1-Ubuntu SMP Fri Feb 16 15:42:02 UTC 2024
  configure: error: cannot guess build type; you must specify one
  checking build system type... ignoring errors

In contrast to the builds for other os/archs it does not even start compiling. However, I am not that deep into that setup.

@tkralphs
Copy link
Member

tkralphs commented Apr 2, 2024

Coincidentally, we just ran into this very same thing in a Cbc conda build on the same architecture. It seems our config.guess and config.sub are out of date (this is known). The fix in the conda build was to update the config.guess and config.sub with a version that was sitting on the build machine, but an easier fix is probably just to specify --build=<...>, but I don't know what the correct string should be.

@tkralphs
Copy link
Member

I would try this.

@rbange
Copy link
Contributor Author

rbange commented Apr 30, 2024

I reverted my changes regarding the action version bump to get rid of the failing pipelines for the other architectures. However, it seems like you fix did not resolve the missing library in the last run: https://github.com/coin-or/CyLP/actions/runs/8880693060/job/24381324439

@tkralphs
Copy link
Member

tkralphs commented May 2, 2024

I should have done this before now, but I finally just tried building on a Raspberry Pi and it works fine. So I guess maybe this is just back to where we started, something is going wrong because we are not actually on an ARM runner. I have to admit that I don't really have a good understanding of what's going on here. I just set up one final try, using the build platform specification that my Raspberry Pi reports when I configure there. We'll see.

@tkralphs
Copy link
Member

tkralphs commented May 2, 2024

Well, OK, that seems to have worked!

@tkralphs
Copy link
Member

tkralphs commented May 2, 2024

Something's weird. All the builds seem to be working, but I hard-coded the build specification to be aarch64-unknown-linux-gnu, just to test whether this works, so the builds on other platforms should have failed I thought...

@rbange
Copy link
Contributor Author

rbange commented May 2, 2024

For whatever reason it also took a very long time to build all of the wheels. Maybe due to the virtualisation layer.

@tkralphs
Copy link
Member

tkralphs commented May 2, 2024

It seems that the environment variable CIBW_ARCHS is not set inside the before-all block and so config_args is also not being set and thus, the build platform is not being passed to configure. I don't really know how the environment variables that are set in Github Actions get passed through to the cibuildwheel environment inside before-all. I tried explicitly setting the variables in pyproject.toml, but it seems the environment variables don't get inherited into pyproject.toml either.

I'm a bit out of my depth here. I got the building of wheels working. If we can just get the environment variables set up properly inside before-all, everything should work. It seems like this was already broken before, but we didn't notice. @mkoeppe, I think you set up the before-all block and modified it for macos. Any idea what's going on here?

@mkoeppe mkoeppe force-pushed the patch-1 branch 2 times, most recently from 6681203 to 9bd324b Compare June 24, 2024 02:21
@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 24, 2024

@tkralphs Here's something that seems to work.

@tkralphs tkralphs merged commit 29b7aa2 into coin-or:master Jun 25, 2024
9 of 10 checks passed
@tkralphs
Copy link
Member

The failure in integration testing with CVXPY was already present in master and is being resolved in #200 so I will go ahead and merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build wheels for Apple Silicon and for other Linux archs
4 participants