在 opensuse 上构建 Python kerberos 扩展失败
Posted
技术标签:
【中文标题】在 opensuse 上构建 Python kerberos 扩展失败【英文标题】:Building Python kerberos extension on opensuse fails 【发布时间】:2016-01-20 04:32:17 【问题描述】:我正在尝试在 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
【问题讨论】:
rpm -ql krb5-devel | grep krb5-config
有什么回报吗?
'bash-4.2# rpm -ql krb5-devel | grep krb5-config /usr/lib/mit/bin/krb5-config /usr/share/man/man1/krb5-config.1.gz'
那个目录/usr/lib/mit/bin
在路径中吗?
不,不是。我现在加了。谢谢!
但是,仍然无法构建。 ` 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 src/base64.c:17:20:致命错误:base64.h:没有这样的文件或目录#include“base64.h " ^ 编译终止`
【参考方案1】:
Python kerberos 包似乎很难编译,这至少是一个临时的解决方法
pip install kerberos==1.1.1
以后的版本好像漏掉了需要的头文件,所以可能有一些打包问题。
【讨论】:
src/kerberos.c:19:27:致命错误:kerberosbasic.h:没有这样的文件或目录#include "kerberosbasic.h" ^ 编译终止。 @praving5 kerberos-1.1.2 中缺少该标头,但在 kerberos-1.1.1 中存在,即我可能混合了这些版本。 太棒了!我最终想通了。即使在 1.2.3 版本中也缺少标题。 1.1.1 就像一个魅力。【参考方案2】:试试 1.2.4;不确定 1.2.3 中的标头出了什么问题,但它们在 1.2.4 中存在。
【讨论】:
以上是关于在 opensuse 上构建 Python kerberos 扩展失败的主要内容,如果未能解决你的问题,请参考以下文章