0

Using static-python

When I compile the binary (3.3.2 version), and run ./python, if I import hashlib, I am receiving this error:

:akiva@akiva-ThinkPad-X230:~/Programming/Projects/youtube-downloader/static/static-python$ ./python
Python 3.3.2+ (default, Aug  4 2015, 03:07:14) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512

I used this command to compile:

make -f Static.make BUILTINS="_bisect  _codecs_cn  _codecs_hk  _codecs_iso2022  _codecs_jp  _codecs_kr  _codecs_tw  _collections  _csv  _ctypes  _ctypes_test  _elementtree  _functools  _hashlib  _heapq  _hotshot  _io  _json  _locale  _lsprof  _multibytecodec  _multiprocessing  _random  _socket   _struct  _testcapi  array  audioop  binascii  cmath  crypt   fcntl  future_builtins  grp  itertools  linuxaudiodev  math  mmap  nis  operator  ossaudiodev  parser  pyexpat  resource  select  spwd  syslog  termios  time  unicodedata  zlib ssl atexit"

The main reason for so many modules is to make sure it is compatible with youtube-dl 's script.

This question seems to have the solution here:

Error importing hashlib with python 2.7 but not with 2.6

But this solution is not applicable obviously to a static version of python. Is this the solution I am looking for, and is there a way to link openssl while running my make command?

Community
  • 1
  • 1
Akiva
  • 1,682
  • 2
  • 21
  • 44
  • 1
    My _guess_ is that you don't have the openssl developer package, libssl-dev, which contains the required headers. If that's the case, install that package & try compiling again. You may not need to change your compile command: with any luck `_hashlib` will handle that for you. – PM 2Ring Aug 04 '15 at 10:55
  • I have libssl-dev already installed, so I'll try to make it statically I guess~ – Akiva Aug 04 '15 at 11:04

0 Answers0