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

Point to custom binary of OpenSSL #12547

Open
lryindra opened this issue Mar 3, 2025 · 20 comments
Open

Point to custom binary of OpenSSL #12547

lryindra opened this issue Mar 3, 2025 · 20 comments
Labels
waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.

Comments

@lryindra
Copy link

lryindra commented Mar 3, 2025

I need to build a cryptography wheel that includes a OpenSSL binary that I built. I tried several setups but I get stuck when I try to "from cryptography.hazmat.backends.openssl import backend". I need to verify the OpenSSL version so I need to print openssl_version_text() and openssl_version_number(). When I run this import I get the following:

Traceback (most recent call last):
File "\cryptography_pypy\openssl_version.py", line 6, in
from cryptography.hazmat.backends.openssl import backend as c_openssl
File "\cryptography_pypy\myenv\Lib\site-packages\cryptography\hazmat\backends\openssl_init_.py", line 7, in
from cryptography.hazmat.backends.openssl.backend import backend
File "\cryptography_pypy\myenv\Lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 7, in
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
ImportError: The specified module could not be found`

I am running in Windows 11 (v23H2).
I have tried Python 3.12 with venv and virtualenv and just installing all the dependencies into the system install. I have also tried PyPy 3.11 with virtualenv. I have tried upgrading pip before trying to build the wheel. These are the commands I use to build:

  • pip wheel --no-cache-dir --no-binary cryptography cryptography
  • python -m pip install --no-index --find-links=./ cryptography-44.0.2-pp311-pypy311_pp73-win_amd64.whl`

I have Visual Studios Build Tools 2022 with "Development with C++" installed. I run vcvars64.bat before building the wheel.

I have tried installing Rust from the msi and from rustup. I currently have rust installed using rustup and rustc is located in .cargo\bin\rustc.exe, and the version is rustc 1.85.0 (4d91de4e4 2025-02-17).

I have the environmental variable OPENSSL_DIR set to the openssl install directory, and I have the binary folder for openssl on PATH

@alex
Copy link
Member

alex commented Mar 3, 2025

It's a bit difficult to say, as you haven't included precise steps for reproducing.

https://github.com/pyca/cryptography/blob/main/.github/workflows/wheel-builder.yml#L308-L370 documents precisely how we build our wheels, so following that and adjusting to your own environment is your best bet.

@alex alex added the waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply. label Mar 3, 2025
@lryindra
Copy link
Author

lryindra commented Mar 3, 2025

I'm not familiar with YML files so I did the best I can but maturin failed:

  • rustc version rustc 1.85.0 (4d91de4e4 2025-02-17)
  • Microsoft Visual Studio 2022 Build Tools
  • PyPy 3.11 setup with a virtualenv
    here is the python version and pip list

Python 3.11.11 (0253c85bf5f8, Feb 26 2025, 10:43:25)
[PyPy 7.3.19 with MSC v.1941 64 bit (AMD64)] on win32
Package Version


cffi 1.18.0.dev0
flit_core 3.10.1
greenlet 0.4.13
hpy 0.9.1.dev61+g79fb330d
maturin 1.7.5
pip 25.0.1
pycparser 2.22
setuptools 75.8.2
tomli 2.1.0
uv 0.5.4
wheel 0.45.1

I downloaded the .zip from github and extracted it
then i ran
uv build --build-constraint=.github/requirements/build-requirements.txt --require-hashes --sdist

Building source distribution...
Running maturin pep517 write-sdist --sdist-directory <base dir>\crypto_github\cryptography-44.0.2\dist
📦 Including license file "\crypto_github\cryptography-44.0.2\LICENSE"
📦 Including license file "\crypto_github\cryptography-44.0.2\LICENSE.APACHE"
📦 Including license file "\crypto_github\cryptography-44.0.2\LICENSE.BSD"
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.7
📡 Using build options features, locked from pyproject.toml
💥 maturin failed
Caused by: Failed to build source distribution
Caused by: Failed to query file list from git: exit code: 128
--- Project Path: \crypto_github\cryptography-44.0.2
--- Stdout:

--- Stderr:
fatal: Not a git repository (or any of the parent directories): .git

Error: command ['maturin', 'pep517', 'write-sdist', '--sdist-directory', '\crypto_github\cryptography-44.0.2\dist'] > returned non-zero exit status 1
error: Build backend failed to build sdist through build_sdist (exit code: 1)

the .github folder is located at \crypto_github\cryptography-44.0.2.github, so I don't know why this failed.

@alex
Copy link
Member

alex commented Mar 3, 2025

Can you please provide complete instructions to reproduce? You're only showing part of the steps you're running, and it makes it impossible for me to give any advice.

@lryindra
Copy link
Author

lryindra commented Mar 3, 2025 via email

@alex
Copy link
Member

alex commented Mar 3, 2025

I don't know how to respond to that, I shared with you the literal exact steps we use to build our wheels.

@lryindra
Copy link
Author

lryindra commented Mar 3, 2025

Setup environmental variables:

  • set PATH=C:\OpenSSL\OpenSSL\bin;%PATH%
  • set OPENSSL_DIR=C:\OpenSSL\OpenSSL

Install Rust

Install PyPy

Using PyPy 3.11

  • C:\PyPy3.11\pypy3.11-v7.3.19-win64\pypy3.11.exe -m ensurepip
  • C:\PyPy3.11\pypy3.11-v7.3.19-win64\pypy3.11.exe -m pip install --upgrade pip
  • C:\PyPy3.11\pypy3.11-v7.3.19-win64\pypy3.11.exe -m pip install virtualenv

And here is the version and pip list

Python 3.11.11 (0253c85bf5f8, Feb 26 2025, 10:43:25)
[PyPy 7.3.19 with MSC v.1941 64 bit (AMD64)]
Package Version


cffi 1.18.0.dev0
distlib 0.3.9
filelock 3.17.0
greenlet 0.4.13
hpy 0.9.1.dev61+g79fb330d
pip 25.0.1
platformdirs 4.3.6
setuptools 65.5.0
virtualenv 20.29.2

Create Virtual Environment

  • Create the folder \Python_Workspace\crypto_github and change directory
  • C:\PyPy3.11\pypy3.11-v7.3.19-win64\pypy3.11.exe -m virtualenv myenv
  • myenv\Scripts\activate
  • Python -m pip install flit-core==3.10.1 maturin==1.7.5 pycparser==2.22 tomli==2.1.0
  • Python -m pip install uv==0.5.4
  • "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
  • pip wheel --no-cache-dir --no-binary cryptography cryptography
  • python -m pip install --force-reinstall --no-index --find-links=./ cryptography-44.0.2-pp311-pypy311_pp73-win_amd64.whl

then I get
(myenv) \crypto_github>python

Python 3.11.11 (0253c85bf5f8, Feb 26 2025, 10:43:25)
[PyPy 7.3.19 with MSC v.1941 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from cryptography.hazmat.backends.openssl import backend
Traceback (most recent call last):
File "", line 1, in
from cryptography.hazmat.backends.openssl import backend
File "\crypto_github\myenv\Lib\site-packages\cryptography\hazmat\backends\openssl_init_.py", line 7, in
from cryptography.hazmat.backends.openssl.backend import backend
File "\crypto_github\myenv\Lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 7, in
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
ImportError: The specified module could not be found

@alex
Copy link
Member

alex commented Mar 3, 2025

The most obvious difference is that you're not setting OPENSSL_STATIC=1, does it still occur if you set that?

@lryindra
Copy link
Author

lryindra commented Mar 3, 2025

I tried a clean install of Python 3.12
python -m pip cache purge
python --version

Python 3.12.3

rustc --version

rustc 1.85.0 (4d91de4e4 2025-02-17)

echo %OPENSSL_DIR%

C:\OpenSSL\OpenSSL

where openssl

C:\OpenSSL\OpenSSL\bin\openssl.exe

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"


** Visual Studio 2022 Developer Command Prompt v17.13.2
** Copyright (c) 2022 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: 'x64'

python -m pip install --upgrade pip
python -m pip install virtualenv
python -m pip list

Package Version


distlib 0.3.9
filelock 3.17.0
pip 25.0.1
platformdirs 4.3.6
virtualenv 20.29.2

python -m virtualenv myenv
myenv\Scripts\activate
set OPENSSL_STATIC=1
pip wheel --no-cache-dir --no-binary cryptography cryptography
pip install cryptography-44.0.2-cp37-abi3-win_amd64.whl
pip list

Package Version


cffi 1.17.1
cryptography 44.0.2
pip 25.0.1
pycparser 2.22

python

Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from cryptography.hazmat.backends.openssl import backend
Traceback (most recent call last):
File "", line 1, in
File "\crypto_github\myenv\Lib\site-packages\cryptography\hazmat\backends\openssl_init_.py", line 7, in
from cryptography.hazmat.backends.openssl.backend import backend
File "\crypto_github\myenv\Lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 7, in
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
ImportError: DLL load failed while importing _rust: The specified module could not be found.

@lryindra
Copy link
Author

lryindra commented Mar 3, 2025

I even tried to download the .zip from github for 44.0.2 and run nox -e local on the extracted source. (this is a new virtual environment)
pip install cffi==1.17.1 flit-core==3.10.1 maturin==1.7.5 pycparser==2.22 tomli==2.1.0 setuptools==73.0.1 uv==0.5.4
pip install -r ci-constraints-requirements.txt
pip list

Package Version


alabaster 1.0.0
argcomplete 3.5.1
babel 2.16.0
build 1.2.2.post1
certifi 2024.8.30
cffi 1.17.1
charset-normalizer 3.4.0
check-sdist 1.2.0
click 8.1.7
colorama 0.4.6
colorlog 6.9.0
coverage 7.6.8
distlib 0.3.9
docutils 0.21.2
execnet 2.1.1
filelock 3.16.1
flit_core 3.10.1
idna 3.10
imagesize 1.4.1
iniconfig 2.0.0
Jinja2 3.1.4
MarkupSafe 3.0.2
maturin 1.7.5
mypy 1.13.0
mypy-extensions 1.0.0
nh3 0.2.18
nox 2024.10.9
packaging 24.2
pathspec 0.12.1
pip 25.0.1
platformdirs 4.3.6
pluggy 1.5.0
pretend 1.0.9
py-cpuinfo 9.0.0
pycparser 2.22
pyenchant 3.2.2
Pygments 2.18.0
pyproject_hooks 1.2.0
pytest 8.3.3
pytest-benchmark 5.1.0
pytest-cov 6.0.0
pytest-randomly 3.16.0
pytest-xdist 3.6.1
readme_renderer 44.0
requests 2.32.3
ruff 0.8.0
setuptools 73.0.1
snowballstemmer 2.2.0
Sphinx 8.1.3
sphinx-rtd-theme 3.0.2
sphinxcontrib-applehelp 2.0.0
sphinxcontrib-devhelp 2.0.0
sphinxcontrib-htmlhelp 2.1.0
sphinxcontrib-jquery 4.1
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 2.0.0
sphinxcontrib-serializinghtml 2.0.0
sphinxcontrib-spelling 8.0.0
tomli 2.1.0
typing_extensions 4.12.2
urllib3 2.2.3
uv 0.5.29
virtualenv 20.28.0

rustc --version

rustc 1.85.0 (4d91de4e4 2025-02-17)

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"


** Visual Studio 2022 Developer Command Prompt v17.13.2
** Copyright (c) 2022 Microsoft Corporation


[vcvarsall.bat] Environment initialized for: 'x64'

echo %OPENSSL_DIR%

C:\OpenSSL\OpenSSL

echo %OPENSSL_STATIC%

1

nox -e local

nox > Running session local
nox > Creating virtual environment (uv) using python.exe in .nox\local
nox > uv pip install -c ci-constraints-requirements.txt -e ./vectors
Using Python 3.12.3 environment at: .nox\local
Resolved 1 package in 5ms
Built cryptography-vectors @ file:////github/cryptography-44.0.2/vectors
Prepared 1 package in 998ms
Installed 1 package in 12ms

  • cryptography-vectors==44.0.2 (from file:////github/cryptography-44.0.2/vectors)
    nox > uv pip install -c ci-constraints-requirements.txt 'maturin>=1,<2' 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools!=74.0.0,!=74.1.0,!=74.1.1,!=74.1.2' 'ruff >=0.3.6' 'mypy >=1.4' 'check-sdist; python_version >= '"'"'3.8'"'"'' 'click >=8.0.1' cryptography_vectors==44.0.2 'pytest >=7.4.0' 'pytest-benchmark >=4.0' 'pytest-cov >=2.10.1' 'pytest-xdist >=3.5.0' 'pretend >=0.7' 'certifi >=2024' 'bcrypt >=3.1.5' 'nox >=2024.04.15' 'nox[uv] >=2024.03.02; python_version >= '"'"'3.8'"'"''
    Using Python 3.12.3 environment at: .nox\local
    Resolved 36 packages in 829ms
    Prepared 35 packages in 5.73s
    Installed 35 packages in 478ms
  • argcomplete==3.5.1
  • bcrypt==4.3.0
  • build==1.2.2.post1
  • certifi==2024.8.30
  • cffi==1.17.1
  • check-sdist==1.2.0
  • click==8.1.7
  • colorama==0.4.6
  • colorlog==6.9.0
  • coverage==7.6.8
  • distlib==0.3.9
  • execnet==2.1.1
  • filelock==3.16.1
  • iniconfig==2.0.0
  • maturin==1.8.2
  • mypy==1.13.0
  • mypy-extensions==1.0.0
  • nox==2024.10.9
  • packaging==24.2
  • pathspec==0.12.1
  • platformdirs==4.3.6
  • pluggy==1.5.0
  • pretend==1.0.9
  • py-cpuinfo==9.0.0
  • pycparser==2.22
  • pyproject-hooks==1.2.0
  • pytest==8.3.3
  • pytest-benchmark==5.1.0
  • pytest-cov==6.0.0
  • pytest-xdist==3.6.1
  • ruff==0.8.0
  • setuptools==75.8.2
  • typing-extensions==4.12.2
  • uv==0.5.29
  • virtualenv==20.28.0
    nox > ruff format .
    247 files left unchanged
    nox > ruff check .
    All checks passed!
    nox > cargo fmt --all
    nox > cargo check --all --tests
    Compiling proc-macro2 v1.0.92
    Compiling unicode-ident v1.0.14
    Compiling target-lexicon v0.12.16
    Compiling shlex v1.3.0
    Compiling vcpkg v0.2.15
    Compiling pkg-config v0.3.31
    Compiling libc v0.2.166
    Compiling once_cell v1.20.2
    Checking cfg-if v1.0.0
    Compiling openssl v0.10.68
    Checking foreign-types-shared v0.1.1
    Compiling cc v1.2.1
    Compiling autocfg v1.4.0
    Checking foreign-types v0.3.2
    Checking itoa v1.0.14
    Checking bitflags v2.6.0
    Compiling heck v0.5.0
    Compiling indoc v2.0.5
    Checking unindent v0.2.3
    Compiling cryptography-key-parsing v0.1.0 (\github\cryptography-44.0.2\src\rust\cryptography-key-parsing)
    Compiling cryptography-openssl v0.1.0 (\github\cryptography-44.0.2\src\rust\cryptography-openssl)
    Checking base64 v0.22.1
    Compiling cryptography-rust v0.1.0 (\github\cryptography-44.0.2\src\rust)
    Compiling memoffset v0.9.1
    Checking self_cell v1.0.4
    Checking pem v3.0.4
    Compiling pyo3-build-config v0.23.5
    Compiling quote v1.0.37
    Compiling syn v2.0.89
    Compiling openssl-sys v0.9.104
    Compiling cryptography-cffi v0.1.0 (\github\cryptography-44.0.2\src\rust\cryptography-cffi)
    error: failed to run custom build command for cryptography-cffi v0.1.0 (<base dir>\github\cryptography-44.0.2\src\rust\cryptography-cffi)

Caused by:
process didn't exit successfully: \github\cryptography-44.0.2\target\debug\build\cryptography-cffi-dc34229e3e50e927\build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=PYO3_PYTHON
cargo:rerun-if-changed=../../_cffi_src/
cargo:rerun-if-changed=../../cryptography/about.py

--- stderr

thread 'main' panicked at src\rust\cryptography-cffi\build.rs:35:10:
failed to execute build_openssl.py: Error { kind: NotFound, message: "program not found" }
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
nox > Command cargo check --all --tests failed with exit code 101
nox > Session local failed.

@alex
Copy link
Member

alex commented Mar 3, 2025

FYI your messages are effectively impossible to read, please use markdown formatting.

@lryindra
Copy link
Author

lryindra commented Mar 3, 2025

FYI your messages are effectively impossible to read, please use markdown formatting.

I updated the format on all my comments

@alex
Copy link
Member

alex commented Mar 4, 2025

Thank you. In the future, markdown code blocks are preferable for shell transcripts.

Can you show me what the full contents of C:\OpenSSL\OpenSSL (e.g., with tree or similar).

@lryindra
Copy link
Author

lryindra commented Mar 4, 2025

here are the contents of C:\OpenSSL\OpenSSL

c:\OpenSSL\OpenSSL>dir

 Directory of c:\OpenSSL\OpenSSL

02/27/2025  11:47 AM    <DIR>          .
02/27/2025  11:47 AM    <DIR>          ..
02/27/2025  11:47 AM    <DIR>          bin
02/27/2025  11:49 AM    <DIR>          html
02/27/2025  11:47 AM    <DIR>          include
02/27/2025  11:47 AM    <DIR>          lib

this folder was created when I ran these commands for building openssl

perl Configure enable-fips --prefix=C:\OpenSSL\OpenSSL --openssldir=C:\OpenSSL\SSL VC-WIN64A
nmake
nmake install

@alex
Copy link
Member

alex commented Mar 4, 2025

Please show me recursively the contents of bin, include, and lib.

@lryindra
Copy link
Author

lryindra commented Mar 4, 2025

c:\OpenSSL\OpenSSL>tree /F bin

Folder PATH listing for volume Windows
Volume serial number is 0000014C 7EA1:F0DD
C:\OPENSSL\OPENSSL\BIN
    c_rehash.pl
    libcrypto-3-x64.dll
    libcrypto-3-x64.pdb
    libssl-3-x64.dll
    libssl-3-x64.pdb
    openssl.exe
    openssl.pdb

c:\OpenSSL\OpenSSL>tree /F include

Folder PATH listing for volume Windows
Volume serial number is 00000202 7EA1:F0DD
C:\OPENSSL\OPENSSL\INCLUDE
└───openssl
        aes.h
        applink.c
        asn1.h
        asn1err.h
        asn1t.h
        asn1_mac.h
        async.h
        asyncerr.h
        bio.h
        bioerr.h
        blowfish.h
        bn.h
        bnerr.h
        buffer.h
        buffererr.h
        camellia.h
        cast.h
        cmac.h
        cmp.h
        cmperr.h
        cmp_util.h
        cms.h
        cmserr.h
        comp.h
        comperr.h
        conf.h
        conferr.h
        configuration.h
        conftypes.h
        conf_api.h
        core.h
        core_dispatch.h
        core_names.h
        core_object.h
        crmf.h
        crmferr.h
        crypto.h
        cryptoerr.h
        cryptoerr_legacy.h
        ct.h
        cterr.h
        decoder.h
        decodererr.h
        des.h
        dh.h
        dherr.h
        dsa.h
        dsaerr.h
        dtls1.h
        ebcdic.h
        ec.h
        ecdh.h
        ecdsa.h
        ecerr.h
        encoder.h
        encodererr.h
        engine.h
        engineerr.h
        err.h
        ess.h
        esserr.h
        evp.h
        evperr.h
        e_os2.h
        fipskey.h
        fips_names.h
        hmac.h
        http.h
        httperr.h
        idea.h
        kdf.h
        kdferr.h
        lhash.h
        macros.h
        md2.h
        md4.h
        md5.h
        mdc2.h
        modes.h
        objects.h
        objectserr.h
        obj_mac.h
        ocsp.h
        ocsperr.h
        opensslconf.h
        opensslv.h
        ossl_typ.h
        params.h
        param_build.h
        pem.h
        pem2.h
        pemerr.h
        pkcs12.h
        pkcs12err.h
        pkcs7.h
        pkcs7err.h
        proverr.h
        provider.h
        prov_ssl.h
        rand.h
        randerr.h
        rc2.h
        rc4.h
        rc5.h
        ripemd.h
        rsa.h
        rsaerr.h
        safestack.h
        seed.h
        self_test.h
        sha.h
        srp.h
        srtp.h
        ssl.h
        ssl2.h
        ssl3.h
        sslerr.h
        sslerr_legacy.h
        stack.h
        store.h
        storeerr.h
        symhacks.h
        tls1.h
        trace.h
        ts.h
        tserr.h
        txt_db.h
        types.h
        ui.h
        uierr.h
        whrlpool.h
        x509.h
        x509err.h
        x509v3.h
        x509v3err.h
        x509_vfy.h
        __DECC_INCLUDE_EPILOGUE.H
        __DECC_INCLUDE_PROLOGUE.H

c:\OpenSSL\OpenSSL>tree /F lib

Folder PATH listing for volume Windows
Volume serial number is 000001ED 7EA1:F0DD
C:\OPENSSL\OPENSSL\LIB
│   libcrypto.lib
│   libssl.lib
│
├───engines-3
│       capi.dll
│       capi.pdb
│       loader_attic.dll
│       loader_attic.pdb
│       padlock.dll
│       padlock.pdb
│
└───ossl-modules
        fips.dll
        fips.pdb
        legacy.dll
        legacy.pdb

@alex
Copy link
Member

alex commented Mar 5, 2025

Thanks. Unfortunately I don't see anything obviously wrong with any of these steps.

The error message "The specified module could not be found" seems (as far as I can tell) to indicate that a dynamic library that the cryptography DLL relies on isn't on the system. I guess the next move would be to figure out which module it is that's missing, but I don't know enough about Windows to tell you how to do that. On linux there are some environment variables you can set to make the dynamic linker log a bunch of stuff.

@lryindra
Copy link
Author

lryindra commented Mar 5, 2025

when I run the following from MINGW I get "nox >Program cargo not found." As you can see bellow, I can still pull the version for rustc and cargo from the same terminal.

python -m virtualenv myenv
source myenv/Scripts/activate
pip install -r ci-constraints-requirements.txt
nox -e local

and to reiterate

  • $ rustc --version
    • rustc 1.85.0 (4d91de4e4 2025-02-17)
  • cargo --version
    • cargo 1.85.0 (d73d2caf9 2024-12-31)
  • echo $OPENSSL_DIR
    • C:\OpenSSL\OpenSSL
  • echo $OPENSSL_STATIC
    • 1
  • python --version
    • Python 3.12.3

Since I'm in MinGW, I'm not running the batch file to setup Visual Studio Build Tools.

@alex
Copy link
Member

alex commented Mar 5, 2025 via email

@lryindra
Copy link
Author

lryindra commented Mar 5, 2025

So running "nox -e local" in MINGW means that it is not finding cargo or openssl on my PATH. I did try to bypass the first error by updating noxfile.py with the exact location of cargo.exe and then i got this error:

   Compiling cryptography-cffi v0.1.0 (<base dir>\cryptography-44.0.2\src\rust\cryptography-cffi)
   Compiling syn v2.0.89
error: failed to run custom build command for `cryptography-cffi v0.1.0 (<base dir>\cryptography-44.0.2\src\rust\cryptography-cffi)`

Caused by:
  process didn't exit successfully: `<base dir>\cryptography-44.0.2\target\debug\build\cryptography-cffi-dc34229e3e50e927\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=PYO3_PYTHON
  cargo:rerun-if-changed=../../_cffi_src/
  cargo:rerun-if-changed=../../cryptography/__about__.py

  --- stderr

  thread 'main' panicked at src\rust\cryptography-cffi\build.rs:35:10:
  failed to execute build_openssl.py: Error { kind: NotFound, message: "program not found" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
nox > Command <user dir>/.cargo/bin/cargo.exe check --all --tests failed with exit code 101
nox > Session local failed.

@messense
Copy link

messense commented Mar 6, 2025

It seems that you don't have python3 in $PATH

let python = env::var("PYO3_PYTHON").unwrap_or_else(|_| "python3".to_string());
println!("cargo:rerun-if-env-changed=PYO3_PYTHON");
println!("cargo:rerun-if-changed=../../_cffi_src/");
println!("cargo:rerun-if-changed=../../cryptography/__about__.py");
let output = Command::new(&python)
.env("OUT_DIR", &out_dir)
.arg("../../_cffi_src/build_openssl.py")
.output()
.expect("failed to execute build_openssl.py");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.
Development

No branches or pull requests

3 participants