Install M2crypto error Swig error:unrecognized option-builtin

Source: Internet
Author: User
Tags builtin openssl rsa

M2crypto is the most complete of a library tool for Python wrapper OpenSSL Rsa,dsa,dh,ec,hmacs, Message digest, symmetric cipher algorithm (including AES).
Since M2crypto was upgraded to version 0.22.5, it always fails to install M2crypto with the PIP install M2crypto command.
There is no problem with PIP installation before you upgrade to this release. Let's look for the reasons below.
System environment: CentOS 6.7 x86
Failure Keyword: Swig

Failure behavior:

swigging swig/_m2crypto.i to Swig/_m2crypto_wrap.cswig-python-i/usr/include/python2.6-i/usr/include-includeall- Modern-builtin-outdir build/lib.linux-i686-2.6/m2crypto-d__i386__-o swig/_m2crypto_wrap.c SWIG/_m2crypto.iswig error:unrecognized option-builtinuse ' Swig-help ' for available Options.error:command ' Swig ' failed with exit status 1

Here is one of the most obvious error hints:
Swig error:unrecognized Option-builtin

This indicates that the swig installed in the system is not-builtin this option. Take a look at the Swig version installed on the system.
Rpm-qa | grep Swig
Return:
swig-1.3.40-6.el6.i686
Is the version older because of the cause? Look again at Swig's help.
Swig-help
See among them are:
Note: ' Swig-<lang>-help ' displays options for a specific target language.
Because it involves Python, change the command to see.
Swig-python-help
Return (excerpt):
-buildnone–use Py_buildvalue () to obtain Py_none (default in Windows)
Note that the options, sure enough, are not-builtin this option.

Well, obviously, the Swig version that the installation M2crypto relies on has been upgraded, and the CentOS default swig version is too low.
Below to upgrade the Swig version. The latest version of the official website has reached 3.0.7, install this version on the build.

Wget-o swig-3.0.7.tar.gz Http://prdownloads.sourceforge.net/swig/swig-3.0.7.tar.gztar zxf SWIG-3.0.7.TAR.GZCD Swig-3.0.7./configure--prefix=/usrmake && make install

Once the installation is complete, take a look at the version number.
Swig-version
Return:
SWIG Version 3.0.7

At this point, upgrade Swig is complete. Let's see if the new version of Swig has-builtin this option.
Swig-python-help
Return (excerpt):
-buildnone–use Py_buildvalue () to obtain Py_none (default in Windows)
-builtin–create new Python built-in types, rather than proxy classes, for better performance

Sure enough. In that case, go ahead and install M2crypto with PIP.
Pip Install M2crypto

Boom, it's wrong again. The error message is as follows:

swigging swig/_m2crypto.i to Swig/_m2crypto_wrap.cswig-python-i/usr/include/python2.6-i/usr/include-includeall- Modern-builtin-outdir build/lib.linux-i686-2.6/m2crypto-d__i386__-o swig/_m2crypto_wrap.c SWIG/_m2crypto.i/usr/  Include/openssl/opensslconf.h:13:error:unable to find ' opensslconf-i386.h ' Error:command ' Swig ' failed with exit status 1

What is the reason? M2crypto didn't find OpenSSL's header file Opensslconf-i386.h
If it is installed under the x86_64, you will not find Opensslconf-x86_64.h

What do we do? It looks like it can't be installed by Pip, so let's do it manually.

wget--no-check-certificate-o m2crypto-0.22.5.tar.gz https://pypi.python.org/packages/source/M/M2Crypto/ M2crypto-0.22.5.tar.gztar zxf m2crypto-0.22.5.tar.gzcd m2crypto-0.22.5cp/usr/include/openssl/opensslconf-i386.h.  #手动把头文件复制过来 (for x86) cp/usr/include/openssl/opensslconf-x86_64.h./  #手动把头文件复制过来 (for x86_64) Python setup.py Install

Well, this is finally the installation done. Look at the results:
PIP List | grep m2crypto
Return:
M2crypto (0.22.5)

Later I went to M2crypto's official website to see the next, already someone with the author reflects this matter.
Https://gitlab.com/m2crypto/m2crypto/issues/69
Hopefully the author can improve it in the next version.


The original link: Solve the PIP installation m2crypto failure problem

Install M2crypto error Swig error:unrecognized option-builtin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.