Skip to content

Instantly share code, notes, and snippets.

@AhnMo
Created July 1, 2020 06:40
Show Gist options
  • Save AhnMo/ccc7bd8f40d7950ef5a3cd87d72e7d05 to your computer and use it in GitHub Desktop.
Save AhnMo/ccc7bd8f40d7950ef5a3cd87d72e7d05 to your computer and use it in GitHub Desktop.

M2Crypto Installation error

If you have trobble with installing M2Crypto, please install libssl-dev and swig.

$ sudo apt install libssl-dev swig

Error message (libssl-dev)

    ERROR: Command errored out with exit status 1:
     command: /home/notroot/.virtualenvs/tad/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8NAhTW/M2Crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8NAhTW/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-fvI7gc/install-record.txt --single-version-externally-managed --compile --install-headers /home/notroot/.virtualenvs/tad/include/site/python2.7/M2Crypto
         cwd: /tmp/pip-install-8NAhTW/M2Crypto/
    Complete output (55 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/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/DSA.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/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
    creating 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/Cipher.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/__init__.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/Session.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/Connection.py -> 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/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Context.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 -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-1x6jhf/python2.7-2.7.18~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/tmp/pip-install-8NAhTW/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:3557:10: fatal error: openssl/err.h: No such file or directory
     3557 | #include <openssl/err.h>
          |          ^~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------

Error message (swig)

  ERROR: Command errored out with exit status 1:
   command: /home/notroot/.virtualenvs/tad/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-SzUc_k/M2Crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-SzUc_k/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/pip-wheel-5ALAZ1
       cwd: /tmp/pip-install-SzUc_k/M2Crypto/
  Complete output (89 lines):
  running bdist_wheel
  running build
  running build_py
  copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/DSA.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/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
  creating 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/Cipher.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/__init__.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/Session.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/Connection.py -> 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/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/Context.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 -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-1x6jhf/python2.7-2.7.18~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/tmp/pip-install-SzUc_k/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: In function ‘_wrap__STACK_num_set’:
  SWIG/_m2crypto_wrap.c:9493:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
   9493 |   if (arg1) (arg1)->num = arg2;
        |                   ^~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__STACK’:
  SWIG/_m2crypto_wrap.c:9720:48: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st’
   9720 |   result = (struct stack_st *)calloc(1, sizeof(struct stack_st));
        |                                                ^~~~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_deep_copy’:
  SWIG/_m2crypto_wrap.c:9951:40: warning: passing argument 2 of ‘OPENSSL_sk_deep_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
   9951 |   result = (_STACK *)sk_deep_copy(arg1,arg2,arg3);
        |                                        ^~~~
        |                                        |
        |                                        void * (*)(void *)
  In file included from /usr/include/openssl/safestack.h:13,
                   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:3557:
  /usr/include/openssl/stack.h:34:16: note: expected ‘OPENSSL_sk_copyfunc’ {aka ‘void * (*)(const void *)’} but argument is of type ‘void * (*)(void *)’
     34 | 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:10354:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_STRING’
  10354 |   if (arg1) (arg1)->stack = *arg2;
        |                   ^~
  SWIG/_m2crypto_wrap.c:10354:29: error: dereferencing pointer to incomplete type ‘OPENSSL_STACK’ {aka ‘struct stack_st’}
  10354 |   if (arg1) (arg1)->stack = *arg2;
        |                             ^~~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_STRING’:
  SWIG/_m2crypto_wrap.c:10386:63: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_STRING’
  10386 |   result = (struct stack_st_OPENSSL_STRING *)calloc(1, sizeof(struct stack_st_OPENSSL_STRING));
        |                                                               ^~~~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_BLOCK_stack_set’:
  SWIG/_m2crypto_wrap.c:10434:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
  10434 |   if (arg1) (arg1)->stack = *arg2;
        |                   ^~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_BLOCK’:
  SWIG/_m2crypto_wrap.c:10466:62: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
  10466 |   result = (struct stack_st_OPENSSL_BLOCK *)calloc(1, sizeof(struct stack_st_OPENSSL_BLOCK));
        |                                                              ^~~~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment