在 opensuse 上构建 Python kerberos 扩展失败

Building Python kerberos extension on opensuse fails

我正在尝试在 docker 容器内的 opensuse 13.2 上构建 kerberos。我已经安装了所需的库:

bash-4.2# cat /etc/os-release
NAME=openSUSE
VERSION="13.2 (Harlequin)"
VERSION_ID="13.2"
PRETTY_NAME="openSUSE 13.2 (Harlequin) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:13.2"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"
bash-4.2#

bash-4.2# zypper search --installed krb5
S | Name       | Summary                                     | Type
--+------------+---------------------------------------------+--------
i | krb5       | MIT Kerberos5 Implementation--Libraries     | package
i | krb5-devel | MIT Kerberos5 - Include Files and Libraries | package


bash-4.2# pip install kerberos
Downloading/unpacking kerberos
  Downloading kerberos-1.2.3.tar.gz
  Running setup.py (path:/tmp/pip_build_root/kerberos/setup.py) egg_info for package kerberos

Installing collected packages: kerberos
  Running setup.py install for kerberos
    building 'kerberos' extension
    gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python2.7 -c src/base64.c -o build/temp.linux-x86_64-2.7/src/base64.o sh: krb5-config: command not found
    gcc: error: sh:: No such file or directory
    gcc: error: krb5-config:: No such file or directory
    gcc: error: command: No such file or directory
    gcc: error: not: No such file or directory
    gcc: error: found: No such file or directory
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/kerberos/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-8u80ki-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_ext

building 'kerberos' extension

creating build

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python2.7 -c src/base64.c -o build/temp.linux-x86_64-2.7/src/base64.o sh: krb5-config: command not found

gcc: error: sh:: No such file or directory

gcc: error: krb5-config:: No such file or directory

gcc: error: command: No such file or directory

gcc: error: not: No such file or directory

gcc: error: found: No such file or directory

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/kerberos/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-8u80ki-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/kerberos
Storing debug log for failure in /root/.pip/pip.log

我尝试了各种方法,例如查找 krb5-config 或其他 krb5 库。但是,在 openSUSE 上,一切都在 krb5-devel 包中。你有什么指示吗?

我的核心意图是在 openSUSE

上构建 Ansible Windows support

Python kerberos 包似乎很难编译,这至少是一个临时的解决方法

pip install kerberos==1.1.1

以后的版本好像少了需要的头文件,可能是打包问题。

试试1.2.4;不确定 1.2.3 中的 headers 出了什么问题,但它们在 1.2.4 中存在。