Search code examples
raspberry-picryptographypython-3.7python-cryptography

'/usr/bin/arm-linux-gnueabihf-gcc' Error while installing cryptography python package


I am getting an error while trying to install cryptography in a python 3.7.3 venv with latest pip(23.0.1). I have Rust version 1.56.1 installed using rustup, and have all other linux packages relevant to it installed , such as :

libffi-dev/oldstable,now 3.2.1-9 armhf [installed] libssl-dev/oldstable 1.1.1n-0+deb10u3 armhf libssl1.1/oldstable 1.1.1n-0+deb10u3 armhf [upgradable from: 1.1.1d-0+deb10u5+rpt1] openssl/oldstable 1.1.1n-0+deb10u3 armhf [upgradable from: 1.1.1d-0+deb10u5+rpt1]

These were are the installations that were recommended for in other stackoverflow or github questions, i am still getting this error after trying to build the wheel.

          Python: 3.7.3
          platform: Linux-4.19.118-v7l+-armv7l-with-debian-10.8
          pip: n/a
          setuptools: 67.6.0
          setuptools_rust: 1.5.2
          =============================DEBUG ASSISTANCE=============================


      error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 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

Please find additional logs below.

 Copying rust artifact from /tmp/pip-install-r5nwrym0/cryptography_0b2d5b190ad44705ad9de39270ef65f2/src/rust/target/release/libcryptography_rust.so to build/lib.linux-armv7l-cpython-37/cryptography/hazmat/bindings/_rust.abi3.so
      building '_openssl' extension
      creating build/temp.linux-armv7l-cpython-37/build
      creating build/temp.linux-armv7l-cpython-37/build/temp.linux-armv7l-cpython-37
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -I/home/.venv/include -I/usr/include/python3.7m -c build/temp.linux-armv7l-cpython-37/_openssl.c -o build/temp.linux-armv7l-cpython-37/build/temp.linux-armv7l-cpython-37/_openssl.o -Wconversion -Wno-error=sign-conversion
      build/temp.linux-armv7l-cpython-37/_openssl.c:605:6: error: #error "pyca/cryptography MUST be linked with Openssl 1.1.0 or later"
           #error "pyca/cryptography MUST be linked with Openssl 1.1.0 or later"
            ^~~~~
      build/temp.linux-armv7l-cpython-37/_openssl.c: In function ‘Cryptography_CRYPTO_set_mem_functions’:
      build/temp.linux-armv7l-cpython-37/_openssl.c:980:37: warning: passing argument 1 of ‘CRYPTO_set_mem_functions’ from incompatible pointer type [-Wincompatible-pointer-types]
           return CRYPTO_set_mem_functions(m, r, f);
                                           ^
      In file included from /usr/include/openssl/bio.h:69,
                       from /usr/include/openssl/asn1.h:65,
                       from build/temp.linux-armv7l-cpython-37/_openssl.c:632:
      /usr/include/openssl/crypto.h:499:38: note: expected ‘void * (*)(size_t)’ {aka ‘void * (*)(unsigned int)’} but argument is of type ‘void * (*)(size_t,  const char *, int)’ {aka ‘void * (*)(unsigned int,  const char *, int)’}
       int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
                                    ~~~~~~~~^~~~~~~~~~~
      build/temp.linux-armv7l-cpython-37/_openssl.c:980:40: warning: passing argument 2 of ‘CRYPTO_set_mem_functions’ from incompatible pointer type [-Wincompatible-pointer-types]
           return CRYPTO_set_mem_functions(m, r, f);
                                              ^
      In file included from /usr/include/openssl/bio.h:69,
                       from /usr/include/openssl/asn1.h:65,
                       from build/temp.linux-armv7l-cpython-37/_openssl.c:632:
      /usr/include/openssl/crypto.h:499:59: note: expected ‘void * (*)(void *, size_t)’ {aka ‘void * (*)(void *, unsigned int)’} but argument is of type ‘void * (*)(void *, size_t,  const char *, int)’ {aka ‘void * (*)(void *, unsigned int,  const char *, int)’}
       int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),


Solution

  • I was able to solve the issue by installing a pre built wheel from https://www.piwheels.org/project/cryptography/, Since building the wheel was causing the issue.