-DOPENSSL_NO_ENGINE=1 still fails with #include <openssl/engine.h>
hroncok opened this issue · comments
Miro Hrončok commented
On a system without openssl engine, such as CentOS Stream 10, I cannot compile cryptography with -DOPENSSL_NO_ENGINE=1
.
-
Versions of Python,
cryptography
,cffi
,pip
, andsetuptools
you're using- Python 3.12.4
- pip 24.1.2
- cryptography 43.0.0
- no other packages installed when reproducing
-
How you installed
cryptography
CFLAGS=-DOPENSSL_NO_ENGINE=1 pip install cryptography --no-binary :all:
-
Clear steps for reproducing your bug
$ CFLAGS=-DOPENSSL_NO_ENGINE=1 pip install cryptography --no-binary :all:
Collecting cryptography
Downloading cryptography-43.0.0.tar.gz (686 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 686.9/686.9 kB 5.0 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.12 (from cryptography)
Using cached cffi-1.16.0-cp312-cp312-linux_x86_64.whl
Collecting pycparser (from cffi>=1.12->cryptography)
Using cached pycparser-2.22-py3-none-any.whl
Building wheels for collected packages: cryptography
Building wheel for cryptography (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for cryptography (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [151 lines of output]
Running `maturin pep517 build-wheel -i /builddir/env/bin/python3 --compatibility off`
📦 Including license file "/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/LICENSE"
📦 Including license file "/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/LICENSE.APACHE"
📦 Including license file "/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/LICENSE.BSD"
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.7
🐍 Not using a specific python interpreter
📡 Using build options features, locked from pyproject.toml
Compiling proc-macro2 v1.0.86
Compiling target-lexicon v0.12.15
Compiling unicode-ident v1.0.12
Compiling cc v1.1.6
Compiling once_cell v1.19.0
Compiling pkg-config v0.3.30
Compiling vcpkg v0.2.15
Compiling libc v0.2.155
Compiling cfg-if v1.0.0
Compiling autocfg v1.3.0
Compiling heck v0.5.0
Compiling foreign-types-shared v0.1.1
Compiling openssl v0.10.65
Compiling memoffset v0.9.1
Compiling quote v1.0.36
Compiling foreign-types v0.3.2
Compiling bitflags v2.6.0
Compiling pyo3-build-config v0.22.2
Compiling cryptography-key-parsing v0.1.0 (/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/cryptography-key-parsing)
Compiling syn v2.0.71
Compiling indoc v2.0.5
Compiling unindent v0.2.3
Compiling cryptography-openssl v0.1.0 (/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/cryptography-openssl)
Compiling cryptography-rust v0.1.0 (/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust)
Compiling base64 v0.22.1
Compiling self_cell v1.0.4
Compiling pem v3.0.4
Compiling openssl-sys v0.9.103
Compiling cryptography-cffi v0.1.0 (/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/cryptography-cffi)
Compiling pyo3-ffi v0.22.2
Compiling pyo3-macros-backend v0.22.2
Compiling pyo3 v0.22.2
The following warnings were emitted during compilation:
warning: cryptography-cffi@0.1.0: /tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out/_openssl.c:634:10: fatal error: openssl/engine.h: No such file or directory
warning: cryptography-cffi@0.1.0: 634 | #include <openssl/engine.h>
warning: cryptography-cffi@0.1.0: | ^~~~~~~~~~~~~~~~~~
warning: cryptography-cffi@0.1.0: compilation terminated.
error: failed to run custom build command for `cryptography-cffi v0.1.0 (/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/cryptography-cffi)`
Caused by:
process didn't exit successfully: `/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-bf5c321d594e5743/build-script-build` (exit status: 1)
--- stdout
cargo:rustc-check-cfg=cfg(python_implementation, values("CPython", "PyPy"))
cargo:rerun-if-env-changed=PYO3_PYTHON
cargo:rerun-if-changed=../../_cffi_src/
cargo:rerun-if-changed=../../cryptography/__about__.py
cargo:rustc-cfg=python_implementation="CPython"
OUT_DIR = Some(/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out)
TARGET = Some(x86_64-unknown-linux-gnu)
OPT_LEVEL = Some(3)
HOST = Some(x86_64-unknown-linux-gnu)
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
CC_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
CC_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(false)
CARGO_CFG_TARGET_FEATURE = Some(avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,popcnt,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave)
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = Some(-DOPENSSL_NO_ENGINE=1)
OUT_DIR = Some(/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out)
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some(avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,popcnt,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave)
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = Some(-DOPENSSL_NO_ENGINE=1)
OUT_DIR = Some(/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out)
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some(avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,popcnt,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave)
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = Some(-DOPENSSL_NO_ENGINE=1)
OUT_DIR = Some(/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out)
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some(avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,popcnt,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave)
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = Some(-DOPENSSL_NO_ENGINE=1)
OUT_DIR = Some(/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out)
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some(avx,avx2,bmi1,bmi2,cmpxchg16b,f16c,fma,fxsr,lzcnt,movbe,popcnt,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave)
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = Some(-DOPENSSL_NO_ENGINE=1)
cargo:warning=/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out/_openssl.c:634:10: fatal error: openssl/engine.h: No such file or directory
cargo:warning= 634 | #include <openssl/engine.h>
cargo:warning= | ^~~~~~~~~~~~~~~~~~
cargo:warning=compilation terminated.
--- stderr
error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/usr/include" "-I" "/builddir/env/include" "-I" "/usr/include/python3.12" "-DOPENSSL_NO_ENGINE=1" "-Wconversion" "-Wno-error=sign-conversion" "-Wno-unused-parameter" "-fmacro-prefix-map=/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out=." "-DPy_LIMITED_API=0x030700f0" "-o" "/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out/2c8a923f5375f521-_openssl.o" "-c" "/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/target/release/build/cryptography-cffi-d06ec7b8e7ca949d/out/_openssl.c" with args cc did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
💥 maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.12-64bit" PYO3_PYTHON="/builddir/env/bin/python3" PYTHON_SYS_EXECUTABLE="/builddir/env/bin/python3" "cargo" "rustc" "--features" "pyo3/abi3-py37" "--message-format" "json-render-diagnostics" "--locked" "--manifest-path" "/tmp/pip-install-5oe9iloi/cryptography_c721c0c8b2804e97b40cf397884c6bc6/src/rust/Cargo.toml" "--release" "--lib"`
Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/builddir/env/bin/python3', '--compatibility', 'off'] returned non-zero exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cryptography)
Alex Gaynor commented
Your colleague has sent #11328 to resolve this.
Miro Hrončok commented
I see it now, sorry for the noise. I started typing this before the PR was open.