Bug 273960 - security/py-cryptography: `make test` fails with 'DEFAULT_VERSIONS+=ssl=openssl30'
Summary: security/py-cryptography: `make test` fails with 'DEFAULT_VERSIONS+=ssl=opens...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on: 273961
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-20 08:18 UTC by Yasuhiro Kimura
Modified: 2024-01-29 20:38 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura freebsd_committer freebsd_triage 2023-09-20 08:18:20 UTC
On 13.2-RELEASE amd64 I add 'DEFAULT_VERSIONS+=ssl=openssl30' to /etc/make.conf and do `cd /usr/ports/security/py-cryptography; make test`. Then it fails as following.

----------------------------------------------------------------------
cd /usr0/freebsd/ports/work/usr/ports/security/py-cryptography/work-py39/cryptography-41.0.3 && /usr/bin/env PYTHONPATH=/usr0/freebsd/ports/work/usr/ports/security/py-cryptography/work-py39/stage/usr/local/lib/python3.9/site-packages /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts= 
ImportError while loading conftest '/usr0/freebsd/ports/work/usr/ports/security/py-cryptography/work-py39/cryptography-41.0.3/tests/conftest.py'.
tests/conftest.py:9: in <module>
    from cryptography.hazmat.backends.openssl import backend as openssl_backend
../stage/usr/local/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__init__.py:7: in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
../stage/usr/local/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/backend.py:13: in <module>
    from cryptography import utils, x509
../stage/usr/local/lib/python3.9/site-packages/cryptography/x509/__init__.py:7: in <module>
    from cryptography.x509 import certificate_transparency
../stage/usr/local/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py:11: in <module>
    from cryptography.hazmat.bindings._rust import x509 as rust_x509
E   ImportError: /usr0/freebsd/ports/work/usr/ports/security/py-cryptography/work-py39/stage/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so: Undefined symbol "EVP_default_properties_is_fips_enabled"
*** Error code 4

Stop.
make: stopped in /usr/ports/security/py-cryptography
----------------------------------------------------------------------

I check shared libraies liked to _rust.abi3.so and get following result.

----------------------------------------------------------------------
root@rolling-vm-freebsd5[93]# ldd /usr0/freebsd/ports/work/usr/ports/security/py-cryptography/work-py39/stage/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so 
/usr0/freebsd/ports/work/usr/ports/security/py-cryptography/work-py39/stage/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so:
        libssl.so.111 => /usr/lib/libssl.so.111 (0x22a9a2f7f000)
        libcrypto.so.111 => /lib/libcrypto.so.111 (0x22a9a42f5000)
        libthr.so.3 => /lib/libthr.so.3 (0x22a9a55c6000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x22a9a5719000)
        libc.so.7 => /lib/libc.so.7 (0x22a99f91d000)
root@rolling-vm-freebsd5[94]#
----------------------------------------------------------------------

Since 'DEFAULT_VERSIONS+=ssl=openssl30' is added to /etc/make.conf, libcrypto.so and libssl.so from openssl30 package should be linked. As you can see, however, what are really linked are ones in base system. And probably this is the cause of the runtime error.

I'm far from familiar with Rust. But I guess options to specify header files path (${OPENSSLINC}) and libraries path (${OPENSSLLIB}) need to be passed to Rust compiler.
Comment 1 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-09-20 23:24:41 UTC
(In reply to Yasuhiro Kimura from comment #0)

I applied attachment 245058 [details] to ports 00b6b938e86f and did same
test. But unfortunately error happened while installing lang/python39
as following.

----------------------------------------------------------------------
===>  Installing for python39-3.9.18
===>  Checking if python39 is already installed
===>   Registering installation for python39-3.9.18 as automatic
pkg-static: Unable to access file /usr0/freebsd/ports/work/usr/ports/lang/python39/work/stage/usr/local/lib/python3.9/lib-dynload/_elementtree.cpython-39.so:No such file or directory
pkg-static: Unable to access file /usr0/freebsd/ports/work/usr/ports/lang/python39/work/stage/usr/local/lib/python3.9/lib-dynload/pyexpat.cpython-39.so:No such file or directory
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/lang/python39
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/py-setuptools
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/py-cffi
*** Error code 1

Stop.
make: stopped in /usr/ports/security/py-cryptography
----------------------------------------------------------------------
Comment 2 Yasuhiro Kimura freebsd_committer freebsd_triage 2023-09-21 01:57:45 UTC
(In reply to Yasuhiro Kimura from comment #1)

After removing all installed packages I tried `make test` again and this time lang/python39 is built and installed successfully. But build of lang/rust failed as following.

----------------------------------------------------------------------
command did not execute successfully: cd "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/rustc-1.72.0-src" && AR_x86_64_unknown_freebsd="ar" CARGO_INCREMENTAL="0" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_TARGET_DIR="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1-tools" CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER="cc" CC_x86_64_unknown_freebsd="cc" CFG_COMPILER_HOST_TRIPLE="x86_64-unknown-freebsd" CFG_RELEASE="1.72.0" CFG_RELEASE_CHANNEL="stable" CFG_RELEASE_NUM="1.72.0" CFG_VERSION="1.72.0 (5680fa18f 2023-08-23) (built from a source tarball)" CFG_VER_DATE="2023-08-23" CFG_VER_HASH="5680fa18feaa87f3ff04063800aec256c3d4b4be" CFLAGS_x86_64_unknown_freebsd="-ffunction-sections -fdata-sections -fPIC -m64 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing" CXXFLAGS_x86_64_unknown_freebsd="-ffunction-sections -fdata-sections -fPIC -m64 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing" CXX_x86_64_unknown_freebsd="c++" DOC_RUST_LANG_ORG_CHANNEL="https://doc.rust-lang.org/1.72.0" LIBC_CHECK_CFG="1" LIBRARY_PATH="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/lib" LZMA_API_STATIC="1" RANLIB_x86_64_unknown_freebsd="ar s" REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/native" RUSTC="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/tmp/extended-error-metadata" RUSTC_HOST_LINKER="cc" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1/lib" RUSTC_REAL="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1/bin/rustc" RUSTC_SNAPSHOT="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1/lib" RUSTC_STAGE="1" RUSTC_SYSROOT="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1" RUSTC_TLS_MODEL_INITIAL_EXEC="1" RUSTC_VERBOSE="2" RUSTDOC="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="--cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=values(bootstrap) --check-cfg=values(parallel_compiler) --check-cfg=values(no_btreemap_remove_entry) --check-cfg=values(crossbeam_loom) --check-cfg=values(span_locations) --check-cfg=values(rustix_use_libc) --check-cfg=values(emulate_second_only_system) --check-cfg=values(windows_raw_dylib) --crate-version 1.72.0\t(5680fa18f\t2023-08-23)\t(built\tfrom\ta\tsource\ttarball)" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="--cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=values(bootstrap) --check-cfg=values(parallel_compiler) --check-cfg=values(no_btreemap_remove_entry) --check-cfg=values(crossbeam_loom) --check-cfg=values(span_locations) --check-cfg=values(rustix_use_libc) --check-cfg=values(emulate_second_only_system) --check-cfg=values(windows_raw_dylib) -Zmacro-backtrace -Clink-args=-Wl,-z,origin -Clink-args=-Wl,-rpath,$ORIGIN/../lib -Zunstable-options -Csplit-debuginfo=off" RUST_TEST_THREADS="6" SYSROOT="/usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage1" __CARGO_DEFAULT_LIB_METADATA="stabletool-rustc" "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/bootstrap/bin/cargo" "build" "--target" "x86_64-unknown-freebsd" "--release" "-Zcheck-cfg=names,values,output,features" "-Zbinary-dep-depinfo" "-j" "6" "-v" "-v" "--frozen" "--manifest-path" "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/rustc-1.72.0-src/src/tools/cargo/Cargo.toml"
expected success, got: exit status: 101


Traceback (most recent call last):
  File "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/rustc-1.72.0-src/x.py", line 50, in <module>
    bootstrap.main()
  File "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/rustc-1.72.0-src/src/bootstrap/bootstrap.py", line 1113, in main
    bootstrap(args)
  File "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/rustc-1.72.0-src/src/bootstrap/bootstrap.py", line 1088, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/usr0/freebsd/ports/work/usr/ports/lang/rust/work/rustc-1.72.0-src/src/bootstrap/bootstrap.py", line 184, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /usr0/freebsd/ports/work/usr/ports/lang/rust/work/_build/bootstrap/debug/bootstrap dist --jobs=6
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/lang/rust
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/py-setuptools-rust
*** Error code 1

Stop.
make: stopped in /usr/ports/security/py-cryptography
----------------------------------------------------------------------
Comment 3 Petri 2023-11-10 22:12:54 UTC
(In reply to Yasuhiro Kimura from comment #0)
I have the same problem, albeit slightly different versions:

ImportError: /usr/local/lib/python3.10/site-packages/cryptography/hazmat/bindings/_rust.abi3.so: Undefined symbol "EVP_default_properties_is_fips_enabled"

FreeBSD 13.2-RELEASE-p5
Python 3.10.13
rustc 1.73.0

$ ldd ./_rust.abi3.so 
./_rust.abi3.so:
	libssl.so.111 => /usr/lib/libssl.so.111 (0x343cddece000)
	libcrypto.so.111 => /lib/libcrypto.so.111 (0x343cdea5b000)
	libthr.so.3 => /lib/libthr.so.3 (0x343cdf411000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x343cdfb2c000)
	libc.so.7 => /lib/libc.so.7 (0x343cdab64000)

Looks like it is linked to the old OpenSSL version.

My make.conf doesn't support ssl=openssl30:

make: "/usr/ports/Mk/Uses/ssl.mk" line 96: You are using an unsupported SSL provider openssl30
Comment 4 Bryan Drewery freebsd_committer freebsd_triage 2024-01-29 18:21:19 UTC
Having this same problem on 14.0-RELEASE-p4 with ssl=openssl.

# ldd /usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so
/usr/local/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so:
        libssl.so.30 => /usr/lib/libssl.so.30 (0x3e742df67000)
        libcrypto.so.30 => /lib/libcrypto.so.30 (0x3e7430aeb000)
        libthr.so.3 => /lib/libthr.so.3 (0x3e742f757000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x3e7430243000)
        libc.so.7 => /lib/libc.so.7 (0x3e742e9e1000)
Comment 5 Bryan Drewery freebsd_committer freebsd_triage 2024-01-29 20:38:09 UTC
(In reply to Bryan Drewery from comment #4)

My issue was fixed by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273961#c64