This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Install on windows - M2Crypto compile error #148
Copy link
Copy link
Open
Description
Hello,
I am trying to install pip install adb on windows 10 and python 2.7. Downloaded openssl from https://slproweb.com/products/Win32OpenSSL.html (both 32 and 64bits version) and when installing, m2crypto fails to compile:
c:\Python27\Scripts> pip.exe install adb
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting adb
Using cached https://files.pythonhosted.org/packages/39/c0/715acc4e0c37a6a93f73daf8536baea94ac9fb6539ef1fd9c42205e1c3fa/adb-1.3.0-py2-none-any.whl
Collecting M2Crypto<=0.26.4,>=0.21.1 (from adb)
Using cached https://files.pythonhosted.org/packages/dc/5b/1ff81e2dda5d2dee62d1c26f5df91b1ea3a560b6611cea67e6c55d1f2e15/M2Crypto-0.26.4.tar.gz
Requirement already satisfied: libusb1>=1.0.16 in c:\python27\lib\site-packages (from adb) (1.7)
Requirement already satisfied: typing in c:\python27\lib\site-packages (from M2Crypto<=0.26.4,>=0.21.1->adb) (3.6.6)
Installing collected packages: M2Crypto, adb
Running setup.py install for M2Crypto ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\xxx\\appdata\\local\\temp\\pip-install-vc6z5t\\M2Crypto\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\xxx\appdata\local\temp\pip-record-aywxhw\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
copying M2Crypto\ASN1.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\AuthCookie.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\BIO.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\BN.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\callback.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\DH.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\DSA.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\EC.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\Engine.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\Err.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\EVP.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\ftpslib.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\httpslib.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\m2.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\m2crypto.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\m2urllib.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\m2urllib2.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\m2xmlrpclib.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\Rand.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\RC4.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\RSA.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\six.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\SMIME.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\threading.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\util.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\X509.py -> build\lib.win-amd64-2.7\M2Crypto
copying M2Crypto\__init__.py -> build\lib.win-amd64-2.7\M2Crypto
creating build\lib.win-amd64-2.7\M2Crypto\PGP
copying M2Crypto\PGP\constants.py -> build\lib.win-amd64-2.7\M2Crypto\PGP
copying M2Crypto\PGP\packet.py -> build\lib.win-amd64-2.7\M2Crypto\PGP
copying M2Crypto\PGP\PublicKey.py -> build\lib.win-amd64-2.7\M2Crypto\PGP
copying M2Crypto\PGP\PublicKeyRing.py -> build\lib.win-amd64-2.7\M2Crypto\PGP
copying M2Crypto\PGP\RSA.py -> build\lib.win-amd64-2.7\M2Crypto\PGP
copying M2Crypto\PGP\__init__.py -> build\lib.win-amd64-2.7\M2Crypto\PGP
creating build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\cb.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\Checker.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\Cipher.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\Connection.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\Context.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\Session.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\SSLServer.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\ssl_dispatcher.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\timeout.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\TwistedProtocolWrapper.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
copying M2Crypto\SSL\__init__.py -> build\lib.win-amd64-2.7\M2Crypto\SSL
running build_ext
building 'M2Crypto._m2crypto' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\SWIG
C:\Users\xxx\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC "-IC:\Program Files\OpenSSL\include" -Ic:\users\xxx\appdata\local\temp\pip-install-vc6z5t\M2Crypto\SWIG /TcSWIG/_m2crypto_wrap.c /Fobuild\temp.win-amd64-2.7\Release\SWIG/_m2crypto_wrap.obj -DTHREADING -D_CRT_SECURE_NO_WARNINGS
_m2crypto_wrap.c
SWIG/_m2crypto_wrap.c(3550) : warning C4068: unknown pragma
SWIG/_m2crypto_wrap.c(3551) : warning C4068: unknown pragma
SWIG/_m2crypto_wrap.c(4395) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(4466) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(4586) : error C2275: 'PyObject' : illegal use of this type as an expression
c:\python27\include\object.h(108) : see declaration of 'PyObject'
SWIG/_m2crypto_wrap.c(4586) : error C2065: 'x509mod' : undeclared identifier
SWIG/_m2crypto_wrap.c(4587) : error C2065: 'x509mod' : undeclared identifier
SWIG/_m2crypto_wrap.c(4587) : warning C4047: 'function' : 'PyObject *' differs in levels of indirection from 'int'
SWIG/_m2crypto_wrap.c(4587) : warning C4024: 'PyObject_GetAttrString' : different types for formal and actual parameter 1
SWIG/_m2crypto_wrap.c(4742) : warning C4244: 'return' : conversion from 'Py_ssize_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(5077) : error C2275: 'BIO' : illegal use of this type as an expression
C:\Program Files\OpenSSL\include\openssl/ossl_typ.h(79) : see declaration of 'BIO'
SWIG/_m2crypto_wrap.c(5077) : error C2065: 'bio' : undeclared identifier
SWIG/_m2crypto_wrap.c(5079) : error C2065: 'bio' : undeclared identifier
SWIG/_m2crypto_wrap.c(5079) : warning C4047: '==' : 'int' differs in levels of indirection from 'void *'
SWIG/_m2crypto_wrap.c(5098) : error C2065: 'bio' : undeclared identifier
SWIG/_m2crypto_wrap.c(5098) : warning C4047: 'return' : 'BIO *' differs in levels of indirection from 'int'
SWIG/_m2crypto_wrap.c(5191) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(5256) : warning C4267: 'function' : conversion from 'size_t' to 'long', possible loss of data
SWIG/_m2crypto_wrap.c(5328) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(5350) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(7963) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(8006) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(8435) : error C2143: syntax error : missing ';' before 'const'
SWIG/_m2crypto_wrap.c(8436) : error C2065: 'tmp_str' : undeclared identifier
SWIG/_m2crypto_wrap.c(8436) : warning C4047: 'function' : 'const unsigned char **' differs in levels of indirection from 'int *'
SWIG/_m2crypto_wrap.c(8436) : warning C4024: 'd2i_SEQ_CERT' : different types for formal and actual parameter 2
SWIG/_m2crypto_wrap.c(8436) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data
SWIG/_m2crypto_wrap.c(8445) : error C2143: syntax error : missing '{' before '*'
SWIG/_m2crypto_wrap.c(8467) : warning C4133: 'return' : incompatible types - from 'PyObject *' to 'int *'
SWIG/_m2crypto_wrap.c(8621) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(8683) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(8812) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data
SWIG/_m2crypto_wrap.c(8838) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'long', possible loss of data
SWIG/_m2crypto_wrap.c(9267) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data
SWIG/_m2crypto_wrap.c(9293) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data
SWIG/_m2crypto_wrap.c(9489) : error C2037: left of 'num' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9509) : error C2037: left of 'num' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9538) : error C2037: left of 'data' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9558) : error C2037: left of 'data' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9587) : error C2037: left of 'sorted' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9607) : error C2037: left of 'sorted' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9636) : error C2037: left of 'num_alloc' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9656) : error C2037: left of 'num_alloc' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9684) : error C2037: left of 'comp' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9704) : error C2037: left of 'comp' specifies undefined struct/union 'stack_st'
SWIG/_m2crypto_wrap.c(9716) : error C2027: use of undefined type 'stack_st'
C:\Program Files\OpenSSL\include\openssl/stack.h(17) : see declaration of 'stack_st'
SWIG/_m2crypto_wrap.c(9947) : warning C4090: 'function' : different 'const' qualifiers
SWIG/_m2crypto_wrap.c(9947) : warning C4028: formal parameter 1 different from declaration
SWIG/_m2crypto_wrap.c(10350) : error C2037: left of 'stack' specifies undefined struct/union 'stack_st_OPENSSL_STRING'
SWIG/_m2crypto_wrap.c(10370) : error C2037: left of 'stack' specifies undefined struct/union 'stack_st_OPENSSL_STRING'
SWIG/_m2crypto_wrap.c(10382) : error C2027: use of undefined type 'stack_st_OPENSSL_STRING'
C:\Program Files\OpenSSL\include\openssl/safestack.h(159) : see declaration of 'stack_st_OPENSSL_STRING'
SWIG/_m2crypto_wrap.c(10430) : error C2037: left of 'stack' specifies undefined struct/union 'stack_st_OPENSSL_BLOCK'
SWIG/_m2crypto_wrap.c(10450) : error C2037: left of 'stack' specifies undefined struct/union 'stack_st_OPENSSL_BLOCK'
SWIG/_m2crypto_wrap.c(10462) : error C2027: use of undefined type 'stack_st_OPENSSL_BLOCK'
C:\Program Files\OpenSSL\include\openssl/safestack.h(167) : see declaration of 'stack_st_OPENSSL_BLOCK'
SWIG/_m2crypto_wrap.c(19168) : warning C4013: 'sslv3_method' undefined; assuming extern returning int
SWIG/_m2crypto_wrap.c(22567) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
SWIG/_m2crypto_wrap.c(25155) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
error: command 'C:\\Users\\xxx\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\xxx\\appdata\\local\\temp\\pip-install-vc6z5t\\M2Crypto\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\xxx\appdata\local\temp\pip-record-aywxhw\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\xxx\appdata\local\temp\pip-install-vc6z5t\M2Crypto\
What am i missing?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Install on windows[/-][+]Install on windows - M2Crypto compile error[/+]RamseyK commentedon Apr 8, 2019
Install pycryptodome, which has precompiled wheels, and that’ll work as a replacement for M2Crypto
shungabubus commentedon May 28, 2019
I had the same issue on Ubuntu.
BitbeyHub commentedon Jun 15, 2019
Mine the same error unsolved
salvorapi commentedon Jun 24, 2019
Same error
BitbeyHub commentedon Aug 1, 2019
when would someone handsome update the pypi source with a non-M2Crypto version?
BitbeyHub commentedon Aug 2, 2019
For all these days struggling for this issue, where M2Crypto is really hard to compile, I have found another way to install python-adb based on the helpful commit 4b555e6 by @bif-g .
After merged ,the source codes in github for now differ slightly from the PyPi package mainly on the M2Crypto changing parts.
So we first install the github version by cloning to the local and execute
python setup.py installor directly use the VCS method of pip withpip install -e git+https://github.com/google/python-adb.git#egg=adb. This will install cryptography or rsa as dependency instead of the erroneous M2Crypto.This will install a python-adb package which could be listed by
pip listbutconda list, that unfortunately I used to mistake as installation unsuccess, causing a lot of backward trouble for poor me.For others, the installation could end here. But for me, the bugs continue. I then come across the error of libusb issue, which indicate that I don't have the .dll file in the right path. So I download the zip from the original url and extract the .dll file through
libusb-1.0.22\MinGW64\dll\libusb-1.0.dll. Then copy it toC:\Windows\System32according to the README instruction in the zip file. This should end up bugless.Change the path to use relative to your own condition.
May the issus be closed by my experience.