benfogle / crossenv

Cross-compiling virtualenv for Python
MIT License
108 stars 22 forks source link

cryptography: error: can't find Rust compiler #89

Closed Sylva1n closed 2 years ago

Sylva1n commented 2 years ago

Hello,

I can't build cryptography since Rust compiler isn't found.

Python: 3.8.5 platform: Linux-aarch64-with pip: n/a setuptools: 60.6.0 setuptools_rust: 1.1.2

error: can't find Rust compiler

I have created the venv with this command:

/usr/local/bin/python3 -m crossenv /opt/buildroot-2020.08/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/bin/python3 venv

All related rust stuff is here:

ls /opt/buildroot-2020.08/output/host/bin/*rust*

/opt/buildroot-2020.08/output/host/bin/rustc
/opt/buildroot-2020.08/output/host/bin/rust-gdb
/opt/buildroot-2020.08/output/host/bin/rust-lldb /opt/buildroot-2020.08/output/host/bin/rustdoc /opt/buildroot-2020.08/output/host/bin/rust-gdbgui

How can crossenv find rustc?

Regards

Sylva1n commented 2 years ago

python -m sysconfig

Platform: "linux-aarch64" Python version: "3.8" Current installation scheme: "posix_prefix"

Paths: data = "/home/sylvain/venv/cross" include = "/opt/buildroot-2020.08/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/python3.8" platinclude = "/opt/buildroot-2020.08/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/python3.8" platlib = "/home/sylvain/venv/cross/lib/python3.8/site-packages" platstdlib = "/home/sylvain/venv/cross/lib/python3.8" purelib = "/home/sylvain/venv/cross/lib/python3.8/site-packages" scripts = "/home/sylvain/venv/cross/bin" stdlib = "/opt/buildroot-2020.08/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/python3.8"

Variables: ABIFLAGS = "" AC_APPLE_UNIVERSAL_BUILD = "0" AIX_GENUINE_CPLUSPLUS = "0" ALT_SOABI = "0" ANDROID_API_LEVEL = "0" AR = "/opt/buildroot-2020.08/output/host/bin/aarch64-buildroot-linux-gnu-ar" ARFLAGS = "rcs" BASECFLAGS = "-Wno-unused-result -Wsign-compare" BASECPPFLAGS = "" BASEMODLIBS = "" BINDIR = "/usr/bin" BINLIBDEST = "/usr/lib/python3.8" BLDLIBRARY = "-L. -lpython3.8" BLDSHARED = "/opt/buildroot-2020.08/output/host/bin/aarch64-buildroot-linux-gnu-gcc -shared" BUILDEXE = "" BUILDPYTHON = "python" BUILD_GNU_TYPE = "x86_64-pc-linux-gnu" BYTESTR_DEPS = "\" CC = "/opt/buildroot-2020.08/output/host/bin/aarch64-buildroot-linux-gnu-gcc"

The is no information about Rust.

Sylva1n commented 2 years ago

I have installed rust on my build and also setuptools_rust. Rust is now found but the compilation fails with:

     Compiling autocfg v1.0.1
       Running `rustc --crate-name autocfg /home/sylvain/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on -C metadata=5fd2c81f4f36cc41 -C extra-filename=-5fd2c81f4f36cc41 --out-dir /tmp/pip-install-gk7jvxg1/cryptography_61a7ab97eb43439ea62e9ace3d327b53/src/rust/target/release/deps -L dependency=/tmp/pip-install-gk7jvxg1/cryptography_61a7ab97eb43439ea62e9ace3d327b53/src/rust/target/release/deps --cap-lints allow`
  error: linking with `cc` failed: exit status: 1

/usr/bin/ld: /opt/buildroot-2020.08/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib/Scrt1.o: Relocations in generic ELF (EM: 183) /usr/bin/ld: /opt/buildroot-2020.08/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib/Scrt1.o: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status

error: could not compile proc-macro2 due to previous error

error: build failed cargo rustc --lib --manifest-path src/rust/Cargo.toml --target aarch64-unknown-linux-gnu --release -v --features pyo3/abi3-py36 pyo3/extension-module -- --crate-type cdylib -C linker=/opt/buildroot-2020.08/output/host/bin/aarch64-buildroot-linux-gnu-gcc