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 missing snap build dependencies #132

Merged
merged 3 commits into from
Jun 14, 2024
Merged

Add missing snap build dependencies #132

merged 3 commits into from
Jun 14, 2024

Conversation

samuelallan72
Copy link
Contributor

@samuelallan72 samuelallan72 commented Jun 13, 2024

On some architectures, binary wheels for some pypi packages aren't available, so pip must build them from source. Some of these require more build dependencies that must be installed:

  • lxml requires libxml2-dev and libxslt1-dev
  • cffi requires libffi-dev
  • cryptography requires rustc, cargo, libssl-dev, pkg-config

lxml is a python dependency of a dependency.

On arm64 and amd64, pip can install the binary wheel,
but these binary wheels aren't available for other architectures.
For them, currently the build fails with:

```
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      <string>:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Building lxml version 5.2.2.
      Building without Cython.
      Error: Please make sure the libxml2 and libxslt development packages are installed.
      [end of output]
```

So the required build dependencies must be added to the snap definition.
Binary wheels for the cffi python package aren't available on some
architectures, so we need to add dependencies so pip can build it
from source.

Fixes the following error during snap build:

```
src/c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
   15 | #include <ffi.h>
      |          ^~~~~~~
compilation terminated.
error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cffi
```
@samuelallan72 samuelallan72 changed the title Add dependencies for building lxml for the snap Add missing snap build dependencies Jun 14, 2024
@samuelallan72 samuelallan72 marked this pull request as draft June 14, 2024 00:41
@samuelallan72
Copy link
Contributor Author

Note: I'm testing builds on other architectures with snapcraft remote-build, so working on fixing all the build issues in this PR.

Binary wheels for the cryptography python package aren't available on
some architectures, so we need to add dependencies so pip can build it
from source.
@samuelallan72
Copy link
Contributor Author

samuelallan72 commented Jun 14, 2024

Can confirm successful build on all supported architectures with this patch:

$ snapcraft remote-build --build-on=s390x,ppc64el,armhf,amd64,arm64
...
Build status as of 2024-06-14 12:51:29.716895:
        arch=armhf      state=Successfully built
        arch=arm64      state=Successfully built
        arch=ppc64el    state=Successfully built
        arch=s390x      state=Successfully built
        arch=amd64      state=Successfully built

@samuelallan72 samuelallan72 marked this pull request as ready for review June 14, 2024 03:44
@samuelallan72 samuelallan72 merged commit 1482b07 into main Jun 14, 2024
@samuelallan72 samuelallan72 deleted the snap-deps branch June 14, 2024 04:17
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.

3 participants