【问题标题】:Python M2Crypto installation fails in Fedora 26Fedora 26 中的 Python M2Crypto 安装失败
【发布时间】:2018-02-12 12:07:35
【问题描述】:

我在我的 PC 上运行 Fedora 26,python 版本是 2.7。我已经安装了

openssl 开发

包。 现在我正在尝试安装

M2Crypto==0.25.1

使用命令在python虚拟环境中打包

pip install M2Crypto==0.25.1

。安装总是失败并显示以下日志语句。

Collecting M2Crypto==0.25.1
  Using cached M2Crypto-0.25.1.tar.gz
Requirement already satisfied: typing in ./site-packages (from M2Crypto==0.25.1)
Building wheels for collected packages: M2Crypto
  Running setup.py bdist_wheel for M2Crypto ... error
  Complete output from command /home/udara/Projects/Dev/moota/ENV/new_env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-NIhR7v/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmptqERYXpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
  -----
  -----
  copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  running build_ext
  building 'M2Crypto.__m2crypto' extension
  swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
  swig -python -D__x86_64__ -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -includeall -modern -builtin -outdir build/lib.linux-x86_64-2.7/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
  /usr/include/sys/cdefs.h:175: Warning 305: Bad constant value (ignored).
  /usr/include/bits/wchar.h:38: Warning 490: Fragment 'SWIG_From_wchar_t' not found.
  /usr/include/stdint.h:274: Warning 490: Fragment 'SWIG_From_wchar_t' not found.
  SWIG/_bio.i:64: Warning 454: Setting a pointer/reference variable may leak memory.
  -----
  -----
  SWIG/_engine.i:168: Warning 454: Setting a pointer/reference variable may leak memory.
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/SWIG
  gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -I/tmp/pip-build-NIhR7v/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -DTHREADING
  SWIG/_m2crypto_wrap.c:4185:35: error: ‘CRYPTO_NUM_LOCKS’ undeclared here (not in a function); did you mean ‘CRYPTO_UNLOCK’?
   static PyThread_type_lock lock_cs[CRYPTO_NUM_LOCKS];
                                     ^~~~~~~~~~~~~~~~
                                     CRYPTO_UNLOCK
  SWIG/_m2crypto_wrap.c: In function ‘lib_init’:
  SWIG/_m2crypto_wrap.c:4590:5: warning: implicit declaration of function ‘SSLeay_add_all_algorithms’; did you mean ‘SSLeay_add_ssl_algorithms’? [-Wimplicit-function-declaration]
       SSLeay_add_all_algorithms();
       ^~~~~~~~~~~~~~~~~~~~~~~~~
       SSLeay_add_ssl_algorithms
  SWIG/_m2crypto_wrap.c: In function ‘bn_rand’:
  SWIG/_m2crypto_wrap.c:5029:12: error: storage size of ‘rnd’ isn’t known
       BIGNUM rnd;
              ^~~
  SWIG/_m2crypto_wrap.c:5033:5: warning: implicit declaration of function ‘BN_init’; did you mean ‘bio_init’? [-Wimplicit-function-declaration]
       BN_init(&rnd);
       ^~~~~~~
       bio_init
  SWIG/_m2crypto_wrap.c:5029:12: warning: unused variable ‘rnd’ [-Wunused-variable]
       BIGNUM rnd;
              ^~~
  SWIG/_m2crypto_wrap.c: In function ‘bn_rand_range’:
  SWIG/_m2crypto_wrap.c:5058:12: error: storage size of ‘rnd’ isn’t known
       BIGNUM rnd;
              ^~~
  SWIG/_m2crypto_wrap.c:5058:12: warning: unused variable ‘rnd’ [-Wunused-variable]
  SWIG/_m2crypto_wrap.c: In function ‘rand_pseudo_bytes’:
  SWIG/_m2crypto_wrap.c:5209:5: warning: ‘RAND_pseudo_bytes’ is deprecated [-Wdeprecated-declarations]
       ret = RAND_pseudo_bytes(blob, n);
       ^~~
  In file included from /usr/include/openssl/opensslconf.h:42:0,
                   from /usr/include/openssl/crypto.h:32,
                   from /usr/include/openssl/bio.h:20,
                   from /usr/include/openssl/err.h:21,
                   from SWIG/_m2crypto_wrap.c:3828:
  /usr/include/openssl/rand.h:47:1: note: declared here
   DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))

【问题讨论】:

标签: python m2crypto fedora-26


【解决方案1】:

尝试使用 compat-openssl10-devel:

sudo dnf install compat-openssl10-devel --allowerasing

如果这与 open-ssl 冲突,您可能必须删除它。你可以在安装 M2Crypto 后重新安装 open-ssl

【讨论】:

  • 这应该没有必要。最新的 M2Crypto 与 OpenSSL 1.1.* 兼容。
  • @mcepl 我正在使用旧系统,最新的 M2Crypto 可能与它不兼容。我们需要在已知版本下保持系统稳定
  • @UdaraSeneviratne M2Crypto 现在正在与所有先前版本的 M2Crypto 相同的平台上进行测试和支持。我对 RHEL-6 以上的所有内容进行测试。如果您实际上有比这更早的东西,请告诉我,我也可以对其进行测试。
  • @UdaraSeneviratne 如果您有 Python 较旧的 2.6 或 OpenSSL
  • @UdaraSeneviratne 当然,我希望你在部署到生产环境之前做一些测试,但是我们试图在保持 API 稳定方面非常保守,所以最新的 M2Crypto 应该感觉你的应用程序和 0.25.1 一样.如果没有,我会立即提交错误,我将 API 错误视为最高优先级。
猜你喜欢
  • 2018-03-20
  • 2018-04-23
  • 2015-04-13
  • 1970-01-01
  • 1970-01-01
  • 2022-11-18
  • 1970-01-01
  • 2016-08-09
  • 2018-11-16
相关资源
最近更新 更多