Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptography does not build with python and fails at trying to build _openssl.c #6929

Closed
sanchayanghosh opened this issue Mar 3, 2022 · 8 comments

Comments

@sanchayanghosh
Copy link
Contributor

If you're filing a bug (as opposed to a feature request), please try the
following things:

  • Check the FAQ to see if your issue is covered there:
    https://cryptography.io/en/latest/faq.html
  • Upgrade to the latest version of setuptools and pip
  • Make sure you're on a supported version of OpenSSL
  • Try with the latest version of cryptography
  • Be sure you have the required compilers (both a C compiler and Rust)
    installed if you aren't using the binary wheels.

If none of that works, please make sure to include the following information in
your bug report:

  • Versions of Python, cryptography, cffi, pip, and setuptools
    you're using
  • How you installed cryptography
  • Clear steps for reproducing your bug

Please do not report security issues on Github! Follow the instructions in our
documentation for reporting security issues:
https://cryptography.io/en/latest/security.html

Here, python3.11 is built with static linking against openssl and hashlib.

When building with python3.11 (also happens with python3.10), the build fails due to:


[root@581cda299512 cryptography]# gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.11 -c build/temp.linux-x86_64-3.11/_openssl.c -o build/temp.linux-x86_64-3.11/build/temp.linux-x86_64-3.11/_openssl.o -Wconversion -Wno-error=sign-conversion
In file included from /usr/local/include/python3.11/Python.h:66,
                 from build/temp.linux-x86_64-3.11/_openssl.c:57:
/usr/local/include/python3.11/moduleobject.h:82:3: error: unknown type name ‘PyModuleDef_Slot’
   82 |   PyModuleDef_Slot *m_slots;
      |   ^~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘Cryptography_pem_password_cb’:
build/temp.linux-x86_64-3.11/_openssl.c:2341:37: warning: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
 2341 |         memcpy(buf, st->password, st->length);
      |                                   ~~^~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_ASN1_STRING_data’:
build/temp.linux-x86_64-3.11/_openssl.c:7757:3: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
 7757 |   return ASN1_STRING_data(x0);
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/asn1.h:554:1: note: declared here
  554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_ASN1_STRING_data’:
build/temp.linux-x86_64-3.11/_openssl.c:7780:3: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
 7780 |   { result = ASN1_STRING_data(x0); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/asn1.h:554:1: note: declared here
  554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_BIO_s_mem’:
build/temp.linux-x86_64-3.11/_openssl.c:8785:10: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 8785 |   return BIO_s_mem();
      |          ^~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_BIO_s_mem’:
build/temp.linux-x86_64-3.11/_openssl.c:8796:12: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 8796 |   { result = BIO_s_mem(); }
      |            ^
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_DTLSv1_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:13641:3: warning: ‘DTLSv1_client_method’ is deprecated [-Wdeprecated-declarations]
13641 |   return DTLSv1_client_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1897:1: note: declared here
 1897 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_DTLSv1_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:13652:3: warning: ‘DTLSv1_client_method’ is deprecated [-Wdeprecated-declarations]
13652 |   { result = DTLSv1_client_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1897:1: note: declared here
 1897 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_DTLSv1_method’:
build/temp.linux-x86_64-3.11/_openssl.c:13758:3: warning: ‘DTLSv1_method’ is deprecated [-Wdeprecated-declarations]
13758 |   return DTLSv1_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1895:1: note: declared here
 1895 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_DTLSv1_method’:
build/temp.linux-x86_64-3.11/_openssl.c:13769:3: warning: ‘DTLSv1_method’ is deprecated [-Wdeprecated-declarations]
13769 |   { result = DTLSv1_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1895:1: note: declared here
 1895 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_DTLSv1_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:13784:3: warning: ‘DTLSv1_server_method’ is deprecated [-Wdeprecated-declarations]
13784 |   return DTLSv1_server_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1896:1: note: declared here
 1896 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_DTLSv1_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:13795:3: warning: ‘DTLSv1_server_method’ is deprecated [-Wdeprecated-declarations]
13795 |   { result = DTLSv1_server_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1896:1: note: declared here
 1896 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_OPENSSL_config’:
build/temp.linux-x86_64-3.11/_openssl.c:22383:3: warning: ‘OPENSSL_config’ is deprecated [-Wdeprecated-declarations]
22383 |   OPENSSL_config(x0);
      |   ^~~~~~~~~~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/conf.h:91:1: note: declared here
   91 | DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_OPENSSL_config’:
build/temp.linux-x86_64-3.11/_openssl.c:22404:3: warning: ‘OPENSSL_config’ is deprecated [-Wdeprecated-declarations]
22404 |   { OPENSSL_config(x0); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/conf.h:91:1: note: declared here
   91 | DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_add_extra_chain_cert’:
build/temp.linux-x86_64-3.11/_openssl.c:26624:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
26624 |   return SSL_CTX_add_extra_chain_cert(x0, x1);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_add_extra_chain_cert’:
build/temp.linux-x86_64-3.11/_openssl.c:26662:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
26662 |   { result = SSL_CTX_add_extra_chain_cert(x0, x1); }
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_clear_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:26803:10: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
26803 |   return SSL_CTX_clear_mode(x0, x1);
      |          ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:26803:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_clear_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:26836:14: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
26836 |   { result = SSL_CTX_clear_mode(x0, x1); }
      |              ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:26836:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_get_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:27211:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
27211 |   return SSL_CTX_get_mode(x0);
      |          ^~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_get_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:27234:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
27234 |   { result = SSL_CTX_get_mode(x0); }
      |              ^~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_get_session_cache_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:27325:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
27325 |   return SSL_CTX_get_session_cache_mode(x0);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_get_session_cache_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:27348:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
27348 |   { result = SSL_CTX_get_session_cache_mode(x0); }
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_set_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:29037:10: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
29037 |   return SSL_CTX_set_mode(x0, x1);
      |          ^~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:29037:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_set_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:29070:14: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
29070 |   { result = SSL_CTX_set_mode(x0, x1); }
      |              ^~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:29070:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
In file included from build/temp.linux-x86_64-3.11/_openssl.c:831:
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_set_session_cache_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:29319:45: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
29319 |   return SSL_CTX_set_session_cache_mode(x0, x1);
      |                                             ^~
build/temp.linux-x86_64-3.11/_openssl.c:29319:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
29319 |   return SSL_CTX_set_session_cache_mode(x0, x1);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from build/temp.linux-x86_64-3.11/_openssl.c:831:
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_set_session_cache_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:29352:49: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
29352 |   { result = SSL_CTX_set_session_cache_mode(x0, x1); }
      |                                                 ^~
build/temp.linux-x86_64-3.11/_openssl.c:29352:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
29352 |   { result = SSL_CTX_set_session_cache_mode(x0, x1); }
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_set_tmp_dh’:
build/temp.linux-x86_64-3.11/_openssl.c:29725:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
29725 |   return SSL_CTX_set_tmp_dh(x0, x1);
      |          ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_set_tmp_dh’:
build/temp.linux-x86_64-3.11/_openssl.c:29763:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
29763 |   { result = SSL_CTX_set_tmp_dh(x0, x1); }
      |              ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_CTX_set_tmp_ecdh’:
build/temp.linux-x86_64-3.11/_openssl.c:29778:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
29778 |   return SSL_CTX_set_tmp_ecdh(x0, x1);
      |          ^~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_CTX_set_tmp_ecdh’:
build/temp.linux-x86_64-3.11/_openssl.c:29816:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
29816 |   { result = SSL_CTX_set_tmp_ecdh(x0, x1); }
      |              ^~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_SESSION_get_ticket_lifetime_hint’:
build/temp.linux-x86_64-3.11/_openssl.c:30445:10: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
30445 |   return SSL_SESSION_get_ticket_lifetime_hint(x0);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_SESSION_get_ticket_lifetime_hint’:
build/temp.linux-x86_64-3.11/_openssl.c:30468:14: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
30468 |   { result = SSL_SESSION_get_ticket_lifetime_hint(x0); }
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_clear_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:30656:10: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
30656 |   return SSL_clear_mode(x0, x1);
      |          ^~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:30656:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_clear_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:30689:14: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
30689 |   { result = SSL_clear_mode(x0, x1); }
      |              ^~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:30689:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_get_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:31561:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
31561 |   return SSL_get_mode(x0);
      |          ^~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_get_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:31584:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
31584 |   { result = SSL_get_mode(x0); }
      |              ^~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_SSL_set_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:33251:10: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
33251 |   return SSL_set_mode(x0, x1);
      |          ^~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:33251:10: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_SSL_set_mode’:
build/temp.linux-x86_64-3.11/_openssl.c:33284:14: warning: conversion to ‘long int’ from ‘long unsigned int’ may change the sign of the result [-Wsign-conversion]
33284 |   { result = SSL_set_mode(x0, x1); }
      |              ^~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:33284:14: warning: conversion to ‘long unsigned int’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_1_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34488:3: warning: ‘TLSv1_1_client_method’ is deprecated [-Wdeprecated-declarations]
34488 |   return TLSv1_1_client_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1885:1: note: declared here
 1885 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_1_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34499:3: warning: ‘TLSv1_1_client_method’ is deprecated [-Wdeprecated-declarations]
34499 |   { result = TLSv1_1_client_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1885:1: note: declared here
 1885 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_1_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34514:3: warning: ‘TLSv1_1_method’ is deprecated [-Wdeprecated-declarations]
34514 |   return TLSv1_1_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1883:1: note: declared here
 1883 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_1_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34525:3: warning: ‘TLSv1_1_method’ is deprecated [-Wdeprecated-declarations]
34525 |   { result = TLSv1_1_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1883:1: note: declared here
 1883 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_1_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34540:3: warning: ‘TLSv1_1_server_method’ is deprecated [-Wdeprecated-declarations]
34540 |   return TLSv1_1_server_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1884:1: note: declared here
 1884 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_1_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34551:3: warning: ‘TLSv1_1_server_method’ is deprecated [-Wdeprecated-declarations]
34551 |   { result = TLSv1_1_server_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1884:1: note: declared here
 1884 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_2_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34566:3: warning: ‘TLSv1_2_client_method’ is deprecated [-Wdeprecated-declarations]
34566 |   return TLSv1_2_client_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1891:1: note: declared here
 1891 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_2_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34577:3: warning: ‘TLSv1_2_client_method’ is deprecated [-Wdeprecated-declarations]
34577 |   { result = TLSv1_2_client_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1891:1: note: declared here
 1891 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_2_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34592:3: warning: ‘TLSv1_2_method’ is deprecated [-Wdeprecated-declarations]
34592 |   return TLSv1_2_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1889:1: note: declared here
 1889 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_2_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34603:3: warning: ‘TLSv1_2_method’ is deprecated [-Wdeprecated-declarations]
34603 |   { result = TLSv1_2_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1889:1: note: declared here
 1889 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_2_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34618:3: warning: ‘TLSv1_2_server_method’ is deprecated [-Wdeprecated-declarations]
34618 |   return TLSv1_2_server_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1890:1: note: declared here
 1890 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_2_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34629:3: warning: ‘TLSv1_2_server_method’ is deprecated [-Wdeprecated-declarations]
34629 |   { result = TLSv1_2_server_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1890:1: note: declared here
 1890 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34644:3: warning: ‘TLSv1_client_method’ is deprecated [-Wdeprecated-declarations]
34644 |   return TLSv1_client_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1879:1: note: declared here
 1879 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_client_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34655:3: warning: ‘TLSv1_client_method’ is deprecated [-Wdeprecated-declarations]
34655 |   { result = TLSv1_client_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1879:1: note: declared here
 1879 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34670:3: warning: ‘TLSv1_method’ is deprecated [-Wdeprecated-declarations]
34670 |   return TLSv1_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1877:1: note: declared here
 1877 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34681:3: warning: ‘TLSv1_method’ is deprecated [-Wdeprecated-declarations]
34681 |   { result = TLSv1_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1877:1: note: declared here
 1877 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_TLSv1_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34696:3: warning: ‘TLSv1_server_method’ is deprecated [-Wdeprecated-declarations]
34696 |   return TLSv1_server_method();
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1878:1: note: declared here
 1878 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_TLSv1_server_method’:
build/temp.linux-x86_64-3.11/_openssl.c:34707:3: warning: ‘TLSv1_server_method’ is deprecated [-Wdeprecated-declarations]
34707 |   { result = TLSv1_server_method(); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/ssl.h:1878:1: note: declared here
 1878 | DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_X509_CRL_get_lastUpdate’:
build/temp.linux-x86_64-3.11/_openssl.c:35419:3: warning: ‘X509_CRL_get_lastUpdate’ is deprecated [-Wdeprecated-declarations]
35419 |   return X509_CRL_get_lastUpdate(x0);
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/x509.h:730:1: note: declared here
  730 | DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_X509_CRL_get_lastUpdate’:
build/temp.linux-x86_64-3.11/_openssl.c:35442:3: warning: ‘X509_CRL_get_lastUpdate’ is deprecated [-Wdeprecated-declarations]
35442 |   { result = X509_CRL_get_lastUpdate(x0); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/x509.h:730:1: note: declared here
  730 | DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_d_X509_CRL_get_nextUpdate’:
build/temp.linux-x86_64-3.11/_openssl.c:35457:3: warning: ‘X509_CRL_get_nextUpdate’ is deprecated [-Wdeprecated-declarations]
35457 |   return X509_CRL_get_nextUpdate(x0);
      |   ^~~~~~
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/x509.h:731:1: note: declared here
  731 | DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: In function ‘_cffi_f_X509_CRL_get_nextUpdate’:
build/temp.linux-x86_64-3.11/_openssl.c:35480:3: warning: ‘X509_CRL_get_nextUpdate’ is deprecated [-Wdeprecated-declarations]
35480 |   { result = X509_CRL_get_nextUpdate(x0); }
      |   ^
In file included from /usr/local/include/openssl/e_os2.h:13,
                 from build/temp.linux-x86_64-3.11/_openssl.c:595:
/usr/local/include/openssl/x509.h:731:1: note: declared here
  731 | DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl))
      | ^~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c: At top level:
build/temp.linux-x86_64-3.11/_openssl.c:793:13: warning: ‘ERR_load_Cryptography_OSRandom_strings’ declared ‘static’ but never defined [-Wunused-function]
  793 | static void ERR_load_Cryptography_OSRandom_strings(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.11/_openssl.c:794:13: warning: ‘ERR_Cryptography_OSRandom_error’ declared ‘static’ but never defined [-Wunused-function]
  794 | static void ERR_Cryptography_OSRandom_error(int function, int reason,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@581cda299512 cryptography]# 

The error is becuase Py_LIMITED_API is defined and hence, PyModuleDef_Slot will not be defined. Somehow, the Py_LIMITED_API version is being defined as lesser than 3.5 somewhere in the toolchain or the source. I had to

edit /usr/local/include/python3.11/moduleobject.h :

from struct PyModuleDef_slot to
typedef struct PyModuleDef_slot PyModuleDef_slot to compile cryptography.

OpenSSL version is 1.1.1m
cpython - 3.11a5+

@alex
Copy link
Member

alex commented Mar 3, 2022

Py_LIMITED_API is always defined for cffi modules.

Can you provide instructions to reproduce this from a clean environment (e.g. a dockerfile)? It sounds like this has something to do with how you've built openssl.

@sanchayanghosh
Copy link
Contributor Author

I did not explicitely use a dockerfile.

Steps to reproduce. In docker,

docker run -it archlinux tail -f /dev/null
docker exec -it archlinux bash
curl https://www.openssl.org/source/openssl-1.1.1m.tar.gz -O
cd openssl-1.1.1m
./config --prefix=/usr/local --openssldir=/usr/local -Wl,-rpath=/usr/local/lib -Wl,--enable-new-dtags

After that make and make install

Next, I clone cpython, and I uncomment static linking of openssl against cpython/Lib/Setup file.

then i do

cd cpython
./configure --with-openssl=/usr/local --with-openssl-rpath=auto
then
make
make install

After that,
go to cryptography
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Follow the steps after that.
Then, pip3.11 install setuptools_rust
pip3.11 install cffi
python3.11 setup.py install

You will see the above error.

@tiran
Copy link
Contributor

tiran commented Mar 3, 2022

This looks like a new regression in Python and was probably introduced in PR python/cpython#31528
@vstinner

@vstinner
Copy link

vstinner commented Mar 3, 2022

It should be fixed by: python/cpython#31668

The error is becuase Py_LIMITED_API is defined and hence, PyModuleDef_Slot will not be defined. Somehow, the Py_LIMITED_API version is being defined as lesser than 3.5 somewhere in the toolchain or the source.

Oh right, I broke the limited API targeting Python older than Python 3.5. Sadly, we only test the limited C API 3.5 and 3.11 currently in Python.

Py_LIMITED_API is always defined for cffi modules.

What's the default limited C API version targeted by cffi?

@alex
Copy link
Member

alex commented Mar 4, 2022

I'm not positive, I think it's 3.4?

@alex
Copy link
Member

alex commented Mar 5, 2022

Going to close this as it's an upstream python bug that's now been fixed.

@alex alex closed this as completed Mar 5, 2022
@vstinner
Copy link

I fixed the regression in Python commit python/cpython@0b63215 which is part of the just released Python 3.11 alpha6. The regression was never part of any Python release thanks to this bug report, so thanks!

@alex
Copy link
Member

alex commented Mar 12, 2022

Thanks for the fix, and thanks to @tiran for flagging that it was an upstream issue!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants