Python M2Crypto在Fedora 26中安装失败

Python M2Crypto在Fedora 26中安装失败,python,m2crypto,fedora-26,Python,M2crypto,Fedora 26,我在我的电脑上运行Fedora26,python版本是2.7。我已经安装了 openssl-devel 包裹。 现在我正在尝试安装 M2Crypto==0.25.1 使用命令在python虚拟环境中打包 pip安装M2Crypto==0.25.1 。安装始终失败,并出现以下日志语句 Collecting M2Crypto==0.25.1 Using cached M2Crypto-0.25.1.tar.gz Requirement already satisfied: typing in .

我在我的电脑上运行Fedora26,python版本是2.7。我已经安装了

openssl-devel

包裹。 现在我正在尝试安装

M2Crypto==0.25.1

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

pip安装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))

尝试使用compat-openssl10-devel:

sudo dnf install compat-openssl10-devel --allowerasing

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

为什么要使用过时且有缺陷的M2Crypto版本?0.28.2是最新版本。如果这对你不起作用,请在那里提交一份bug报告,这是不必要的。最新的M2Crypto与OpenSSL 1.1兼容。*@mcepl我使用的是传统系统,最新的M2Crypto可能与此不兼容。我们需要在已知的情况下保持系统稳定versions@UdaraSeneviratneM2Crypto现在正在与所有以前版本的M2Crypto相同的平台上测试和支持。我对RHEL-6以上的所有产品进行测试。如果你有比这更老的东西,请告诉我,我也可以对它进行测试。@UdaraSeneviratne如果你有Python2.6或OpenSSL<1.0.1e,我不确定你有什么希望。我不会移植到Python2.4,但我认为0.25.1无论如何都不会对您有所帮助(恐怕这是您的最小问题)。@Udaraseneviratine当然,我希望您在部署到生产环境之前进行一些测试,但我们在保持API稳定方面非常保守,因此,最新的M2Crypto应该让您的应用程序感觉与0.25.1相同。文件错误,如果没有,我会立即跳下去,我认为API漏洞最高优先级。