-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Windows Arm64 - building from source #12326
Comments
We'll ship Windows ARM64 wheels as soon as Github offers ARM64 Windows runners (#11199). Have you tried using |
|
@reaperhulk and @alex - thanks for your suggestions - I have not used vcpkg, but have installed OpenSSL and set the path as you describe but still getting errors in the Rust compiling process. I will explore vcpkg and other config options. Will close the loop when I get it resolved. Welcome and appreciate any other ideas. :) |
This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days. |
I had success with: winget install ShiningLight.OpenSSL.Dev
$env:OPENSSL_DIR="C:\Program Files\OpenSSL-Win64-ARM"
$env:OPENSSL_LIB_DIR="C:\Program Files\OpenSSL-Win64-ARM\lib\VC\arm64\MT"
$env:OPENSSL_STATIC="1" |
@dlech - thanks for this suggestion - I am going to try your approach this morning |
@dlech - thanks, your suggestion is spot-on for getting OpenSSL installed on Win64-ARM. Perhaps I am missing something obvious (so apologies in advance) - but how are you building/compiling cryptography from source after these instructions. I have tried several paths, and getting errors in all of them. If you could complete the recipe with the next couple of lines to get cryptography built (e.g., rust pyd), I would really appreciate it! :) |
I just did For a different dependency (not sure if it is related to |
Thanks to @dlech - I have a build of OPEN SSL for Windows ARM64 - and this allows the pip install of cryptography to progress without error - but after installing, the library does not seem to function, and throws errors upon trying to use in a project: from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions My question remains the same: once configuring for the OPEN SSL lib, what is the process to build the Rust code from source for Windows ARM64 ? (e.g., cmake, cargo build, built in pip install, etc) |
You could try to figure out how to statically link OpenSSL instead of dynamically linking it, or you can copy the .dll to the directory where the |
To statically link, you simply set teh OPENSSL_STATIC=1 env var when
building.
…On Mon, Feb 3, 2025 at 10:38 AM David Lechner ***@***.***> wrote:
You could try to figure out how to statically link OpenSSL instead of
dynamically linking it, or you can copy the .dll to the directory where the
python3.exe is so that Windows can find it.
—
Reply to this email directly, view it on GitHub
<#12326 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAGBDQPLM4LA5RCOOG5HL2N6ZTPAVCNFSM6AAAAABVVLJKY2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZRG43TIMJSGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
Thanks, I edited my previous comment to include that. And changed |
@alex and @dlech - appreciate all of your suggestions - some progress but still not working. I can successfully pip install cryptography with the following steps on Windows Arm64 with Python 3.12 (standard Lenovo Snapdragon laptop):
Produces successful pip install, and in .venv/lib/site-packages/cryptography, there is _rust.pyd file installed with overall cryptography folder structure and files that appear to match the working version on amd_x86. However, upon attempting to import cryptography into a project, e.g., from cryptography.fernet import Fernet, the _rust.pyd file can not be loaded, e.g.,
I have tried pip install explicitly with the source distribution as well (e.g., pip3 install cryptography-44.0.0.tar.gz), and the pip build is successful, but still throws the import error when trying to load the _rust extension file. (Without the $env variable settings above, the pip install process fails, as expected, with error of: Rust can not find the openssl library ...) A couple of ideas:
I am sharing below the --verbose pip install log readout if it is helpful- and it does seem to complete the pip install successfully - but throws the _rust import error when attempting to use at run-time:
|
This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days. |
@alex and @dlech - I have a workable resolution to the issue of getting cryptography running on Windows ARM64, and wanted to share the recipe and the issues b/c a more robust set of directions may be useful for others (and building off the steps and insights you had both shared)- Net-net: the Rust compilation process, triggered inside the build of pyproject.toml, was not linking to two required OpenSSL libs (libcrypto-3-arm64.dll and libssl-3-arm64.dll). This could be a global Rust compiler setting, or perhaps other config in the build environment (I didn't get to root cause, as I had a workaround that suited my purpose). Without linking to these two libs, the build process completes (without error), and pip install is then also possible without error - however, of course, without the libs, there is an import error on trying to use the library in a project and load the compiled _rust.pyd file. My work-around is below:
There is probably an easy 1-liner (perhaps already in the setup files or documentation) to configure the Rust compiler so it finds those /bin folder automatically and turns off the blocking "no legacy" error -> and would be great to add in explicit setup directions. Thanks for your help and support - happy to answer any questions/clarifications - or run any tests if that would be helpful! |
Hi Cryptography team!
I am trying to use the library on a Windows ARM64 machine, and looks like the only alternative is to build from source. I have set up the environment with the OpenSSL binaries for ARM64, but am having a lot of difficulties compiling the Rust source code, and the recipes provided in the documentation do not seem to be up-to-date or provide enough detail to get it working.
After a lot of tinkering, the Rust "cargo build" will find the OpenSSL binary, but then later in the process throws an error around not being able to find the path to "build_openssl.py" (from src\rust\cryptography-cffi\build.rs @ line 36). I have tried multiple obvious ways to ensure it finds the path, and not finding success with any. (Please note: I am not a Rust programmer - and am trying to use the cryptography library in a Python/C/C++ project.)
Welcome any feedback or advice. Generally, it would be great if you could support Windows ARM64, or alternatively, provide a more detailed recipe for how to build from source for this use case.
Thanks!
The text was updated successfully, but these errors were encountered: