jborean93 / pykrb5

Python krb5 API interface
MIT License
17 stars 8 forks source link

krb5 v0.7.0 build fail #56

Open adpavlov opened 1 month ago

adpavlov commented 1 month ago

I know that rhel 7 is outdated long time ago, but still for some reason krb5 build failed with version 0.7.0 whereas it worked fine with version 0.6.0. Here is the log:

Collecting krb5>=0.3.0 (from pyspnego[kerberos]; extra == "kerberos"->pypsrp[credssp,kerberos]->-r requirements.txt (line 73))
  Downloading krb5-0.7.0.tar.gz (235 kB)
  Installing build dependencies ... - \ | / done
  Getting requirements to build wheel ... - done
  Preparing metadata (pyproject.toml) ... - done

Building wheels for collected packages: ansible-sign, krb5
  Building wheel for ansible-sign (pyproject.toml) ... - \ done
  Created wheel for ansible-sign: filename=ansible_sign-0.1.1.post1.dev12+g6ac1f09-py3-none-any.whl size=15842 sha256=e8b82d0901275e5742300fca1e235e21d48325e8fab160ab7a523157fa3f38e6
  Stored in directory: /tmp/pip-ephem-wheel-cache-4ykvkap2/wheels/61/ce/b0/2b59624a5957a4c42789639df0849015bce51a02479f47854e
  Building wheel for krb5 (pyproject.toml) ... -
  error: subprocess-exited-with-error

  × Building wheel for krb5 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [111 lines of output]
      Using krb5-config at 'krb5-config'
      Using libkrb5.so as Kerberos module for platform checks
      Compiling src/krb5/_ccache.pyx
      Compiling src/krb5/_ccache_mit.pyx
      Compiling src/krb5/_ccache_match.pyx
      Compiling src/krb5/_ccache_support_switch.pyx
      Compiling src/krb5/_cccol.pyx
      Compiling src/krb5/_chpw_message_mit.pyx
      Compiling src/krb5/_context.pyx
      Compiling src/krb5/_context_mit.pyx
      Compiling src/krb5/_creds.pyx
      Skipping src/krb5/_creds_marshal_mit.pyx as it is not supported by the selected Kerberos implementation.
      Skipping src/krb5/_creds_mit.pyx as it is not supported by the selected Kerberos implementation.
      Compiling src/krb5/_creds_opt.pyx
      Skipping src/krb5/_creds_opt_heimdal.pyx as it is not supported by the selected Kerberos implementation.
      Compiling src/krb5/_creds_opt_mit.pyx
      Compiling src/krb5/_creds_opt_set_in_ccache.pyx
      Compiling src/krb5/_creds_opt_set_pac_request.pyx
      Compiling src/krb5/_exceptions.pyx
      Compiling src/krb5/_keyblock.pyx
      Compiling src/krb5/_keyblock_mit.pyx
      Compiling src/krb5/_kt.pyx
      Compiling src/krb5/_kt_mit.pyx
      Skipping src/krb5/_kt_heimdal.pyx as it is not supported by the selected Kerberos implementation.
      Compiling src/krb5/_kt_have_content.pyx
      Compiling src/krb5/_principal.pyx
      Skipping src/krb5/_principal_heimdal.pyx as it is not supported by the selected Kerberos implementation.
      Compiling src/krb5/_set_password.pyx
      Compiling src/krb5/_string.pyx
      Compiling src/krb5/_string_mit.pyx
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_adpi.py -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/__init__.py -> build/lib.linux-x86_64-cpython-311/krb5
      running egg_info
      writing src/krb5.egg-info/PKG-INFO
      writing dependency_links to src/krb5.egg-info/dependency_links.txt
      writing top-level names to src/krb5.egg-info/top_level.txt
      reading manifest file 'src/krb5.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching '.coverage'
      warning: no previously-included files found matching '.gitignore'
      warning: no previously-included files found matching '.pre-commit-config.yaml'
      warning: no previously-included files matching '*.pyc' found under directory 'tests'
      adding license file 'LICENSE'
      writing manifest file 'src/krb5.egg-info/SOURCES.txt'
      copying src/krb5/_ccache.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_ccache_match.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_ccache_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_ccache_support_switch.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_cccol.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_chpw_message_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_context.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_context_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_marshal_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_opt.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_opt_heimdal.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_opt_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_opt_set_in_ccache.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_creds_opt_set_pac_request.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_exceptions.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_keyblock.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_keyblock_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_kt.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_kt_have_content.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_kt_heimdal.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_kt_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_principal.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_principal_heimdal.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_set_password.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_string.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/_string_mit.pyi -> build/lib.linux-x86_64-cpython-311/krb5
      copying src/krb5/py.typed -> build/lib.linux-x86_64-cpython-311/krb5
      running build_ext
      building 'krb5._ccache' extension
      creating build/temp.linux-x86_64-cpython-311/src/krb5
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_ccache.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_ccache.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_ccache.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_ccache.cpython-311-x86_64-linux-gnu.so
      building 'krb5._ccache_mit' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_ccache_mit.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_ccache_mit.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_ccache_mit.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_ccache_mit.cpython-311-x86_64-linux-gnu.so
      building 'krb5._ccache_match' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_ccache_match.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_ccache_match.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_ccache_match.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_ccache_match.cpython-311-x86_64-linux-gnu.so
      building 'krb5._ccache_support_switch' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_ccache_support_switch.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_ccache_support_switch.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_ccache_support_switch.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_ccache_support_switch.cpython-311-x86_64-linux-gnu.so
      building 'krb5._cccol' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_cccol.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_cccol.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_cccol.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_cccol.cpython-311-x86_64-linux-gnu.so
      building 'krb5._chpw_message_mit' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_chpw_message_mit.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_chpw_message_mit.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_chpw_message_mit.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_chpw_message_mit.cpython-311-x86_64-linux-gnu.so
      building 'krb5._context' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_context.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_context.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_context.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_context.cpython-311-x86_64-linux-gnu.so
      building 'krb5._context_mit' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_context_mit.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_context_mit.o
      gcc -pthread -shared build/temp.linux-x86_64-cpython-311/src/krb5/_context_mit.o -lkrb5 -lk5crypto -lcom_err -o build/lib.linux-x86_64-cpython-311/krb5/_context_mit.cpython-311-x86_64-linux-gnu.so
      building 'krb5._creds' extension
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/krb5 -I/opt/Python-3.11.5/include/python3.11 -c src/krb5/_creds.c -o build/temp.linux-x86_64-cpython-311/src/krb5/_creds.o
      src/krb5/_creds.c: In function ‘pykrb5_creds_get’:
      src/krb5/_creds.c:1333:13: error: ‘for’ loop initial declarations are only allowed in C99 mode
                   for (int i = 0; i < 32; i++) {
                   ^
      src/krb5/_creds.c:1333:13: note: use option -std=c99 or -std=gnu99 to compile your code
      error: command '/bin/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 krb5
jborean93 commented 1 month ago

The error seems to be something related to how Cython is generating the C code and is probably related to us increasing the Cython version itself. You could look at adding custom build flags for gcc to add the c99 flag on the build but unless this is a trivial problem we can fix in the code I am very reluctant to make larger changes to support EL 7. EL 7 uses an older krb5 lib version which is not tested by this library in CI (1.11 vs 1.17 min) and there's bound to be other problems when you try to use it.

TLDR you can either