There's multiple components here, but when built with dev-lang/rust, dev-python/cryptography crashes on import (in libunwind) on loong. It does not crash when built with dev-lang/rust-bin. This reproduces in clean stage3. Demo: # eselect rust list Available Rust versions: [1] rust-bin-1.76.0 [2] rust-1.76.0 * # emerge -v1 dev-python/cryptography ... # python3 -c 'import cryptography.hazmat.bindings._rust' Segmentation fault # eselect rust set 1 # env-update >>> Regenerating /etc/ld.so.cache... # emerge -v1 dev-python/cryptography # python3 -c 'import cryptography.hazmat.bindings._rust' # Attached is a sample backtrace, from running twisted-regen-cache which is how I discovered it. Unfortunately the parts after std::panicking::try::do_call seem to be unreliable, as running it against just an import shows a completely different backtrace ending in openssl instead. Reproducible: Always
Created attachment 889165 [details] gdb context and complete backtrace
So that sounds like a Rust compiler bug?
(In reply to Michał Górny from comment #2) > So that sounds like a Rust compiler bug? Normally I would say yes, but it does not crash when built with rust-bin. That indicates that there has to be something different in the Gentoo environment building dev-lang/rust vs rust-bin.
Not sure it is related, but I am having somewhat similar problems with the rust module of dev-python/cryptography-42.0.5, which affects ansible-vault downstream. I found the following test line at https://github.com/ansible/ansible/issues/77878#issuecomment-1136089951 python3 -c 'from cryptography.exceptions import InvalidSignature; from cryptography.hazmat.backends import default_backend; from cryptography.hazmat.primitives import hashes, padding; from cryptography.hazmat.primitives.hmac import HMAC; from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC; from cryptography.hazmat.primitives.ciphers import (Cipher as C_Cipher, algorithms, modes); default_backend();' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.11/site-packages/cryptography/exceptions.py", line 9, in <module> from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions ImportError: cannot import name 'exceptions' from 'cryptography.hazmat.bindings._rust' (unknown location) I am using python-3.11 via eselect, but I have installed: dev-python/python 3.10.13_p3 (ensurepip gdbm ncurses pgo readline sqlite ssl tk -bluetooth -build -debug -examples -libedit -test -valgrind -verify-sig) 3.11.8_p1 (ensurepip gdbm ncurses pgo readline sqlite ssl tk -bluetooth -build -debug -examples -libedit -test -valgrind -verify-sig) 3.12.2_p1 (ensurepip gdbm ncurses pgo readline sqlite ssl tk -bluetooth -build -debug -examples -libedit -test -valgrind -verify-sig) dev-python/cryptography 42.0.5 (-debug -test PYTHON_TARGETS="python3_10 python3_11 -pypy3 -python3_12") dev-lang/rust 1.74.1 (lto -big-endian -clippy -debug -dist -doc -llvm-libunwind -miri -nightly -parallel-compiler -profiler -rust-analyzer -rust-src -rustfmt -system-bootstrap -system-llvm -test -verify-sig -wasm ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" CPU_FLAGS_X86="sse2" LLVM_TARGETS="X86 -AArch64 -AMDGPU -ARC -ARM -AVR -BPF -CSKY -DirectX -Hexagon -Lanai -LoongArch -M68k -MSP430 -Mips -NVPTX -PowerPC -RISCV -SPIRV -Sparc -SystemZ -VE -WebAssembly -XCore -Xtensa") while dev-lang/rust-bin is not installed.
Not the same issue, this is loong-specific and results in a segfault, not an ImportError.