Skip to content

preparations for musllinux#6236

Merged
reaperhulk merged 2 commits intopyca:mainfrom
liath:musllinux
Sep 19, 2021
Merged

preparations for musllinux#6236
reaperhulk merged 2 commits intopyca:mainfrom
liath:musllinux

Conversation

@liath
Copy link
Copy Markdown
Contributor

@liath liath commented Aug 29, 2021

Just added musllinux to the wheel builder and tweaked the execstack call to readelf which happens to be present in both pypa manylinux and musllinux images.

This should just work once the following are resolved:

If you'd like to test that whole chain out, there's instructions in the last PR pyca/infra#367

@reaperhulk
Copy link
Copy Markdown
Member

First of all, thank you very much for contributing! I’ll review the infra PR shortly, but just one question here: what version of pip adds support for the musllinux tag?

@liath
Copy link
Copy Markdown
Contributor Author

liath commented Aug 29, 2021

No clue tbh. In a very confirmation-bias-y way I want to believe this comment is saying that pip won't actually need to do anything to support them: pypa/pip#10088 (comment)

@liath
Copy link
Copy Markdown
Contributor Author

liath commented Aug 29, 2021

Oh, or maybe it's v21.2.4, because that's where packaging got upgraded to a version that handles them:
pypa/pip@76cd70a

@reaperhulk
Copy link
Copy Markdown
Member

Great. The one other thing we'll want to do when landing this is updating the installation documentation to note that Alpine can use wheels as well (but requires pip >= 21.2.4). (Once this lands I will immediately run the wheel builder and upload the new musl wheels. We can put the doc work in a separate PR but I'd like to get that updated ASAP since it will be very helpful to users when v35.0 comes out and has a hard requirement on rustc)

@liath
Copy link
Copy Markdown
Contributor Author

liath commented Aug 30, 2021

How about something like

--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -78,9 +78,8 @@ OpenSSL. If you see this error it is likely because your copy of ``pip`` is too
 old to find our wheel files. Upgrade your ``pip`` with ``pip install -U pip``
 and then try to install ``cryptography`` again.

-Users on PyPy, unusual CPU architectures, or distributions of Linux using
-``musl`` (like Alpine) will need to compile ``cryptography`` themselves. Please
-view our :doc:`/installation` documentation.
+Users on PyPy and unusual CPU architectures will need to compile ``cryptography``
+themselves. Please view our :doc:`/installation` documentation.

 ``cryptography`` raised an ``InternalError`` and I'm not sure what to do?
 -------------------------------------------------------------------------
diff --git a/docs/installation.rst b/docs/installation.rst
index a9f40bf9..27fa6fec 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -85,17 +85,16 @@ Building cryptography on Linux

 ``cryptography`` ships ``manylinux`` wheels (as of 2.0) so all dependencies
 are included. For users on **pip 19.0** or above running on a ``manylinux2010``
-(or greater) compatible distribution (almost everything **except Alpine**) all
+(or greater) compatible distribution (or **pip 21.2.4** for ``musllinux``) all
 you should need to do is:

 .. code-block:: console

     $ pip install cryptography

-If you are on Alpine or just want to compile it yourself then
-``cryptography`` requires a C compiler, a Rust compiler, headers for Python (if
-you're not using ``pypy``), and headers for the OpenSSL and ``libffi`` libraries
-available on your system.
+If you want to compile ``cryptography`` yourself you'll need a C compiler, a
+Rust compiler, headers for Python (if you're not using ``pypy``), and headers
+for the OpenSSL and ``libffi`` libraries available on your system.

 On all Linux distributions you will need to have :ref:`Rust installed and
 available<installation:Rust>`.
@@ -196,10 +195,10 @@ Static Wheels
 ~~~~~~~~~~~~~

 Cryptography ships statically-linked wheels for macOS, Windows, and Linux (via
-``manylinux``). This allows compatible environments to use the most recent
-OpenSSL, regardless of what is shipped by default on those platforms. Some
-Linux distributions (most notably Alpine) are not ``manylinux`` compatible so
-we cannot distribute wheels for them.
+``manylinux`` and ``musllinux``). This allows compatible environments to use
+the most recent OpenSSL, regardless of what is shipped by default on those
+platforms. Some Linux distributions are not ``manylinux`` or ``musllinux``
+compatible so we cannot distribute wheels for them.

 However, you can build your own statically-linked wheels that will work on your
 own systems. This will allow you to continue to use relatively old Linux

@reaperhulk
Copy link
Copy Markdown
Member

That looks like a good draft we can work with. It looks like we're out of date in some other ways with that documentation (notably: we ship PyPy wheels on x86_64 for Windows, macOS, and manylinux), but we can fix that separately.

@liath
Copy link
Copy Markdown
Contributor Author

liath commented Aug 30, 2021

Regarding this bit

Some Linux distributions are not ``manylinux`` or ``musllinux`` compatible so we cannot distribute wheels for them.

Are there any other common distros that don't use one or the other? This might be clearer pushed into the following paragraph to get something like:

@@ -196,15 +195,15 @@ Static Wheels
 ~~~~~~~~~~~~~

 Cryptography ships statically-linked wheels for macOS, Windows, and Linux (via
-``manylinux``). This allows compatible environments to use the most recent
-OpenSSL, regardless of what is shipped by default on those platforms. Some
-Linux distributions (most notably Alpine) are not ``manylinux`` compatible so
-we cannot distribute wheels for them.
-
-However, you can build your own statically-linked wheels that will work on your
-own systems. This will allow you to continue to use relatively old Linux
-distributions (such as LTS releases), while making sure you have the most
-recent OpenSSL available to your Python programs.
+``manylinux`` and ``musllinux``). This allows compatible environments to use
+the most recent OpenSSL, regardless of what is shipped by default on those
+platforms.
+
+In the off chance you use a platform outside of that list, you can build your
+own statically-linked wheels that will work on your own systems. This will
+allow you to continue to use relatively old Linux distributions (such as LTS
+releases), while making sure you have the most recent OpenSSL available to
+your Python programs.

 To do so, you should find yourself a machine that is as similar as possible to
 your target environment (e.g. your production environment): for example, spin

@reaperhulk
Copy link
Copy Markdown
Member

I'm not aware of any significant distributions that remain uncovered with manylinux + musllinux so that language is definitely better. The primary point of failure for wheels at that point will be users on distributions older than the wheel compatibility (e.g. CentOS 6), architectures we don't produce wheels for (e.g. i686, s390x, ppc64le, etc), or alternate Python runtimes (e.g. Pyston).

I'd probably change In the off chance you use a platform outside of that list to If you are using a platform not covered by our wheels, you can build your own..., but it would be easier to provide feedback on language if we just put it into a PR 😄

@messense
Copy link
Copy Markdown

FYI, looks like PyPI does not allow uploading musllinux wheels yet.

https://github.com/pypa/warehouse/blob/3943226cf1168f5cead40913d42603e9d1f25010/warehouse/forklift/legacy.py#L92-L173

@liath
Copy link
Copy Markdown
Contributor Author

liath commented Aug 31, 2021

@messense Thanks for the heads up! I opened a PR for it here pypi/warehouse#9982

@reaperhulk
Copy link
Copy Markdown
Member

For future reference #6280 covers the arm64 side of this as well (along with pyca/infra#369).

@reaperhulk reaperhulk merged commit 1a0ba3e into pyca:main Sep 19, 2021
@liath liath deleted the musllinux branch September 19, 2021 01:15
reaperhulk pushed a commit that referenced this pull request Sep 19, 2021
@liath
Copy link
Copy Markdown
Contributor Author

liath commented Sep 20, 2021

With this in, would it make sense to add a comment to this discussion? This and #6280 should, afaict, resolve the need to have Rust installed for most people.

@reaperhulk
Copy link
Copy Markdown
Member

Good idea. I just put an update under alpine in the final post.

0xaead pushed a commit to 0xaead/cryptography that referenced this pull request Sep 29, 2021
* preparations for musllinux

* wheel-builder | skip PyPy on musllinux builds
0xaead pushed a commit to 0xaead/cryptography that referenced this pull request Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants