Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m2crypto #53

Open
fjbardelli opened this issue Oct 20, 2018 · 4 comments
Open

m2crypto #53

fjbardelli opened this issue Oct 20, 2018 · 4 comments

Comments

@fjbardelli
Copy link

Estoy instalado m2crypto en Ubuntu 18.04, pero cuando corro pip install m2crypto>=0.18 no lo intsalara corri el instaladaor apt-get install -y swig pero tampoco. Me podrian decir los paso a seguir para su correcta instalacion

@cjadeveloper
Copy link

cjadeveloper commented Aug 16, 2019

Tengo el mismo problema al crear un entorno virtual python en Ubuntu 19.04 para py2:

mkvirtualenv -r 'pyafipws/requirements.txt' --python=python2 pyafip

Lo tenía funcionando en Ubuntu 16.04 sin problema. Me da el siguiente error:

Failed to build m2crypto
Installing collected packages: httplib2, pysimplesoap, typing, m2crypto, fpdf, aenum, dbf, Pillow
  Running setup.py install for m2crypto ... error
    ERROR: Command errored out with exit status 1:
     command: /home/cristian/.virtualenvs/pyafip/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Jp_SY2/m2crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Jp_SY2/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 /tmp/pip-record-TDhXXu/install-record.txt --single-version-externally-managed --compile --install-headers /home/cristian/.virtualenvs/pyafip/include/site/python2.7/m2crypto
         cwd: /tmp/pip-install-Jp_SY2/m2crypto/
    Complete output (499 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
    creating build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    running build_ext
    building 'M2Crypto._m2crypto' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/SWIG
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-MW0004/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/tmp/pip-install-Jp_SY2/m2crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
    SWIG/_m2crypto_wrap.c:4331:0: warning: "PyUnicode_FromString" redefined
     #define PyUnicode_FromString(x) PyString_FromString(x)
    
    In file included from /usr/include/python2.7/Python.h:88:0,
                     from SWIG/_m2crypto_wrap.c:127:
    /usr/include/python2.7/unicodeobject.h:281:0: note: this is the location of the previous definition
     # define PyUnicode_FromString PyUnicodeUCS4_FromString
    
    SWIG/_m2crypto_wrap.c:4332:0: warning: "PyUnicode_Format" redefined
     #define PyUnicode_Format(x, y) PyString_Format(x, y)
    
    In file included from /usr/include/python2.7/Python.h:88:0,
                     from SWIG/_m2crypto_wrap.c:127:
    /usr/include/python2.7/unicodeobject.h:275:0: note: this is the location of the previous definition
     # define PyUnicode_Format PyUnicodeUCS4_Format
    
    SWIG/_m2crypto_wrap.c: In function ‘_wrap__STACK_num_set’:
    SWIG/_m2crypto_wrap.c:9511:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
       if (arg1) (arg1)->num = arg2;
                       ^~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__STACK’:
    SWIG/_m2crypto_wrap.c:9738:48: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st’
       result = (struct stack_st *)calloc(1, sizeof(struct stack_st));
                                                    ^~~~~~
    SWIG/_m2crypto_wrap.c:9741:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_new_null’:
    SWIG/_m2crypto_wrap.c:9884:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_deep_copy’:
    SWIG/_m2crypto_wrap.c:9969:40: warning: passing argument 2 of ‘OPENSSL_sk_deep_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
       result = (_STACK *)sk_deep_copy(arg1,arg2,arg3);
                                            ^~~~
    In file included from /usr/include/openssl/safestack.h:13:0,
                     from /usr/include/openssl/crypto.h:23,
                     from /usr/include/openssl/bio.h:20,
                     from /usr/include/openssl/err.h:21,
                     from SWIG/_m2crypto_wrap.c:3561:
    /usr/include/openssl/stack.h:34:16: note: expected ‘OPENSSL_sk_copyfunc {aka void * (*)(const void *)}’ but argument is of type ‘void * (*)(void *)’
     OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *,
                    ^~~~~~~~~~~~~~~~~~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_STRING_stack_set’:
    SWIG/_m2crypto_wrap.c:10372:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_STRING’
       if (arg1) (arg1)->stack = *arg2;
                       ^~
    SWIG/_m2crypto_wrap.c:10372:29: error: dereferencing pointer to incomplete type ‘OPENSSL_STACK {aka struct stack_st}’
       if (arg1) (arg1)->stack = *arg2;
                                 ^~~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_STRING’:
    SWIG/_m2crypto_wrap.c:10404:63: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_STRING’
       result = (struct stack_st_OPENSSL_STRING *)calloc(1, sizeof(struct stack_st_OPENSSL_STRING));
                                                                   ^~~~~~
    SWIG/_m2crypto_wrap.c:10407:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_BLOCK_stack_set’:
    SWIG/_m2crypto_wrap.c:10452:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
       if (arg1) (arg1)->stack = *arg2;
                       ^~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_BLOCK’:
    SWIG/_m2crypto_wrap.c:10484:62: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
       result = (struct stack_st_OPENSSL_BLOCK *)calloc(1, sizeof(struct stack_st_OPENSSL_BLOCK));
                                                                  ^~~~~~
    SWIG/_m2crypto_wrap.c:10487:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_threading_init’:
    SWIG/_m2crypto_wrap.c:10517:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_threading_cleanup’:
    SWIG/_m2crypto_wrap.c:10528:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    ...blablabla...
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/cristian/.virtualenvs/pyafip/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Jp_SY2/m2crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Jp_SY2/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 /tmp/pip-record-TDhXXu/install-record.txt --single-version-externally-managed --compile --install-headers /home/cristian/.virtualenvs/pyafip/include/site/python2.7/m2crypto Check the logs for full command output.

Alguna idea?

@NicolasSandoval
Copy link
Contributor

Hola @cjadeveloper si no necesitas generar certificados y solo es para facturaciones básicas elimina m2crypto del requirement.txt, de esta forma pyafipws trabaja directamente con openSSL y funciona todo ok. Ya para la version de Python3 se estaria cambiando esta dependencia por cryptography.

@jnweiger
Copy link

apt-get install swig libssl-dev should do the trick.

@NicolasSandoval
Copy link
Contributor

Hi! @jnweiger yes, and:

sudo apt-get install python3-dev (if you work with py3k branch)

https://github.com/reingart/pyafipws#virtual-environment-testing
This must be installed before installing requirements.txt with pip.

Thanks for sharing!

reingart pushed a commit that referenced this issue Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants