jborean93 / pykrb5

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

Compilation fails with modern compilers #36

Open UnitedMarsupials opened 9 months ago

UnitedMarsupials commented 9 months ago

Trying to add the module (using pip3 install) I get the following warning from gcc-13.2. Which turns into an error, because of -Werror:

src/krb5/_ccache.c: In function '__Pyx_Import':
src/krb5/_ccache.c:24344:21: error: the comparison will always evaluate as 'true' for the pointer operand in '(char *)"krb5._ccache" must not be NULL [-Werror=address]+ 4"

The workaround is to add CFLAGS=-w to the environment (which disables all warnings), but that shouldn't be necessary.

jborean93 commented 9 months ago

Can you share what Linux distro you are using?

I'm running with gcc 13.2.1 and installing the latest version from PyPI or straight from source and it works properly.

$ gcc --version
gcc (GCC) 13.2.1 20230801
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ pip install --no-cache-dir krb5
Collecting krb5
  Downloading krb5-0.5.1.tar.gz (221 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 221.1/221.1 kB 11.3 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: krb5
  Building wheel for krb5 (pyproject.toml) ... done
  Created wheel for krb5: filename=krb5-0.5.1-cp312-cp312-linux_x86_64.whl size=6025804 sha256=600f2974d2c77a256f9feb778cffee38b7c244a2a69a9cfc981fcfe4db7e8d7e
  Stored in directory: /tmp/pip-ephem-wheel-cache-cc5gidb2/wheels/5d/d3/21/fc49fac6e002db188fb567b370a9df3608de2a72dbad22d438
Successfully built krb5
Installing collected packages: krb5
Successfully installed krb5-0.5.1

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: python3.12 -m pip install --upgrade pip
UnitedMarsupials commented 9 months ago

RedHat7, python-3.6. krb-0.5.1 is not available -- presumably, because python is too old. The error encountered is from 0.3.0.

jborean93 commented 9 months ago

I think your problem was originally reported in https://github.com/jborean93/pykrb5/issues/13 and was fixed in a newer release. The PR https://github.com/jborean93/pykrb5/pull/14 that fixed this removed the already cythonized files in the sdist and makes Cython part of a the build step which resulted in newer and more compliant .c files being generated.

Unfortunately I don't think I can do anything more to help you here.