pyca / cryptography

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.
https://cryptography.io
Other
6.56k stars 1.51k forks source link

error: Don't know the correct rust target for system type aarch64-unknown-linux-android. Please set the CARGO_BUILD_TARGET environment variable #6679

Closed japanese-xevvo closed 2 years ago

japanese-xevvo commented 2 years ago
      =============================DEBUG ASSISTANCE=============================
      If you are seeing a compilation error please try the following steps to
      successfully install cryptography:
      1) Upgrade to the latest pip and try again. This will fix errors for most
         users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation/ for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq/
      4) Ensure you have a recent Rust toolchain installed:
         https://cryptography.io/en/latest/installation/#rust

      Python: 3.9.7
      platform: Linux-4.14.117-perf-gf905233-aarch64-with-libc
      pip: n/a
      setuptools: 59.5.0
      setuptools_rust: 1.1.2
      =============================DEBUG ASSISTANCE=============================
error: Don't know the correct rust target for system type aarch64-unknown-linux-android. Please set the CARGO_BUILD_TARGET environment variable.

  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

pip 21.3.1 from /data/data/com.termux/files/usr/lib/python3.9/site-packages/pip (python 3.9)

alex commented 2 years ago

This is not an acceptable bug report.

You have a) Not stated what the actual bug is. For all we know it's a typo in that debug message b) not provided any details on how to reproduce the error message, c) the error message provides a suggested resolution to it, did you attempt to follow that instruction?

When you file a bug, you're asking maintainers to take time to try to resolve your issue. You have not done anything required to enable us to help.

japanese-xevvo commented 2 years ago

@alex I wrote that I was trying to establish which command - isn't this an operation? According to the form, I wrote which versions of packages, how I did and what.

tiran commented 2 years ago

The issue template asked you to provide cffi and pip version, which you did not provide. Your bug report also lacks clear steps to reproduce the problem. We don't even know which platform, Linux distro, and build environment you are targeting.

japanese-xevvo commented 2 years ago

@tiran

pip

pip 21.3.1 from /data/data/com.termux/files/usr/lib/python3.9/site-packages/pip (python 3.9)

I really forgot to provide the cffi version, but everything you need is at least in the debag information.

japanese-xevvo commented 2 years ago

~ $ uname -a Linux localhost 4.14.117-perf-gf905233 #1 SMP PREEMPT Mon Jul 19 17:26:28 CST 2021 aarch64 Android ~ $

I use termux

japanese-xevvo commented 2 years ago

`~ $ pip list Package Version


certifi 2021.10.8 cffi 1.15.0 charset-normalizer 2.0.9 idna 3.3 pip 21.3.1 pycparser 2.21 requests 2.26.0 setuptools 57.4.0 urllib3 1.26.7`

reaperhulk commented 2 years ago

It is not at all clear what you expect us to do other than try to get our own environment and debug this for you. Did you try passing the flags the error message suggested? What happened when you did? Can you cargo install something or cargo build a pure rust project?

This is a volunteer project run by two people in their spare time. When things fail on unusual platforms (and termux in android definitely qualifies as something outside the norm) open source needs users who are willing to spend some time trying to isolate the problem. It is hugely demotivating to have someone do the bare minimum and then throw the problem over the wall. We would be happy to work with you when there's a problem that we can reproduce in our available environments or has been isolated to the point where we can report a bug either here or somewhere in the rust ecosystem, but we need you to put in the work as well.

japanese-xevvo commented 2 years ago

Once I managed to install this library on thermex, but it was a different phone. Unfortunately, I don't really understand this area, but I am ready to make every effort.

~/cryptography $ ls CHANGELOG.rst LICENSE.APACHE MANIFEST.in dev-requirements.txt release.py src vectors CONTRIBUTING.rst LICENSE.BSD README.rst docs setup.cfg tests LICENSE LICENSE.PSF codecov.yml pyproject.toml setup.py tox.ini ~/cryptography $ cargo build error: could not find `Cargo.toml` in `/data/data/com.termux/files/home/cryptography` or any parent directory ~/cryptography $ cargo install error: `/data/data/com.termux/files/home/cryptography` is not a crate root; specify a crate to install from crates.io, or use --path or --git to specify an alternate source ~/cryptography $ cargo install --git https://github.com/pyca/cryptography.git Updating git repository `https://github.com/pyca/cryptography.git` error: no packages found with binaries or examples

If i tryed export

japanese-xevvo commented 2 years ago

Sorry for the time spent, I was able to solve the problem.

japanese-xevvo commented 2 years ago

How i solve this problem:

1) I enter rustc --print target-list 2) I study the aarch64 list and find aarch64-linux-android 3) ~/cryptography/src $ export CARGO_BUILD_TARGET=aarch64-linux-android ~/cryptography/src $ pip install cryptography --no-binary cryptography Collecting cryptography Using cached cryptography-36.0.0.tar.gz (571 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: cffi>=1.12 in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from cryptography) (1.15.0) Requirement already satisfied: pycparser in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21) Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml) ... done Created wheel for cryptography: filename=cryptography-36.0.0-cp310-cp310-linux_aarch64.whl size=1704186 sha256=7c8febe840153cab53f1a2ac695baeee19229a68d292d6602ffb01e6a671d125 Stored in directory: /data/data/com.termux/cache/pip/wheels/ce/9d/25/5924896234eb82ac8af98e29ce7fe8a2091f00f59b4cedb3dc Successfully built cryptography Installing collected packages: cryptography Successfully installed cryptography-36.0.0

japanese-xevvo commented 2 years ago

https://pastebin.com/aDJSGBy7

reaperhulk commented 2 years ago

Great, thanks for following up and providing your solution for others who might run into this issue in the future!

eingengraou commented 2 years ago

How i solve this problem:

1. I enter `rustc --print target-list`

2. I study the aarch64 list and find aarch64-linux-android

3. `~/cryptography/src $ export CARGO_BUILD_TARGET=aarch64-linux-android ~/cryptography/src $ pip install cryptography --no-binary cryptography Collecting cryptography   Using cached cryptography-36.0.0.tar.gz (571 kB)   Installing build dependencies ... done   Getting requirements to build wheel ... done   Preparing metadata (pyproject.toml) ... done Requirement already satisfied: cffi>=1.12 in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from cryptography) (1.15.0) Requirement already satisfied: pycparser in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21) Building wheels for collected packages: cryptography   Building wheel for cryptography (pyproject.toml) ... done   Created wheel for cryptography: filename=cryptography-36.0.0-cp310-cp310-linux_aarch64.whl size=1704186 sha256=7c8febe840153cab53f1a2ac695baeee19229a68d292d6602ffb01e6a671d125   Stored in directory: /data/data/com.termux/cache/pip/wheels/ce/9d/25/5924896234eb82ac8af98e29ce7fe8a2091f00f59b4cedb3dc Successfully built cryptography Installing collected packages: cryptography Successfully installed cryptography-36.0.0`

please can you clarify how you're in a ~/cryptography/src directory? I don't have that and I'm stuck in the cargo_build_target step , was the ~/cryptography/src from your installation?

eingengraou commented 2 years ago

How i solve this problem:

1. I enter `rustc --print target-list`

2. I study the aarch64 list and find aarch64-linux-android

3. `~/cryptography/src $ export CARGO_BUILD_TARGET=aarch64-linux-android ~/cryptography/src $ pip install cryptography --no-binary cryptography Collecting cryptography   Using cached cryptography-36.0.0.tar.gz (571 kB)   Installing build dependencies ... done   Getting requirements to build wheel ... done   Preparing metadata (pyproject.toml) ... done Requirement already satisfied: cffi>=1.12 in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from cryptography) (1.15.0) Requirement already satisfied: pycparser in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21) Building wheels for collected packages: cryptography   Building wheel for cryptography (pyproject.toml) ... done   Created wheel for cryptography: filename=cryptography-36.0.0-cp310-cp310-linux_aarch64.whl size=1704186 sha256=7c8febe840153cab53f1a2ac695baeee19229a68d292d6602ffb01e6a671d125   Stored in directory: /data/data/com.termux/cache/pip/wheels/ce/9d/25/5924896234eb82ac8af98e29ce7fe8a2091f00f59b4cedb3dc Successfully built cryptography Installing collected packages: cryptography Successfully installed cryptography-36.0.0`

please can you clarify how you're in a ~/cryptography/src directory? I don't have that and I'm stuck in the cargo_build_target step , was the ~/cryptography/src from your installation?

FIXED

I just changed the cargo_build_target from arm-linux-androideabi to aarch64-linux-android and back to arm-linux-androideabi and it's working

henry13655 commented 2 years ago

This specific command change the CARGO TARGET:

export CARGO_BUILD_TARGET=aarch64-linux-android

mdsremon commented 2 years ago

This specific command change the CARGO TARGET:

export CARGO_BUILD_TARGET=aarch64-linux-android

yeah... it worked for me.. thank you all...

ghost commented 2 years ago

Please help

( Termux )

error: cargo failed with code: 101

ghost commented 2 years ago

This specific command change the CARGO TARGET:

export CARGO_BUILD_TARGET=aarch64-linux-android

I got a error: 101

eingengraou commented 2 years ago

This specific command change the CARGO TARGET: export CARGO_BUILD_TARGET=aarch64-linux-android

I got a error: 101

change it to something else, try it and then change it to the right option again, worked for me

yeyuchen198 commented 2 years ago

Have the same issue, pip install cryptography failed.

pkg install rust export CRYPTOGRAPHY_DONT_BUILD_RUST=1 export CARGO_BUILD_TARGET=aarch64-linux-android pip3 install --upgrade homeassistant

this way doesn't work at 2022/04/03

ferryvg commented 2 years ago

@yeyuchen198

I have the same issue while install mitmproxy via termux on MIUI 12.5.3 Redmi 9. CARGO_BUILD_TARGET=aarch64-linux-android solved for me.

Full command was: CRYPTOGRAPHY_DONT_BUILD_RUST=1 CARGO_BUILD_TARGET=aarch64-linux-android CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 LDFLAGS="$PREFIX/lib/openssl-1.1/libssl.a $PREFIX/lib/openssl-1.1/libcrypto.a" CFLAGS="-I$PREFIX/include/openssl-1.1" pip install mitmproxy

emanuele-f commented 2 years ago

Full command was: CRYPTOGRAPHY_DONT_BUILD_RUST=1 CARGO_BUILD_TARGET=aarch64-linux-android CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 LDFLAGS="$PREFIX/lib/openssl-1.1/libssl.a $PREFIX/lib/openssl-1.1/libcrypto.a" CFLAGS="-I$PREFIX/include/openssl-1.1" pip install mitmproxy

It would be nice to give proper credit for the recipe