alexander-akhmetov / python-telegram

Python client for the Telegram's tdlib
MIT License
610 stars 122 forks source link

libtdjson.so: invalid ELF header on Ubuntu 18.04 with linux 4.15.0-65-generic #47

Closed melfnt closed 4 years ago

melfnt commented 5 years ago

I could not run any of the example files because of this error: libtdjson.so: invalid ELF header. These are the steps I did to install python-telegram: I could install and use it correctly a few months ago.

$ cd /tmp
$ git clone https://github.com/alexander-akhmetov/python-telegram.git
$ cd python-telegram/
$ python -m pip install --user .
$ python examples/get_me.py [MY-APP-ID] [MY-APP-HASH] [MY_TELEPHONE-NUMBER]
Traceback (most recent call last):
  File "examples/get_me.py", line 16, in <module>
    database_encryption_key='changeme1234',
  File "/MY-HOME/.local/lib/python3.6/site-packages/telegram/client.py", line 103, in __init__
    self._tdjson = TDJson(library_path=library_path, verbosity=tdlib_verbosity)
  File "/MY-HOME/.local/lib/python3.6/site-packages/telegram/tdjson.py", line 27, in __init__
    self._build_client(library_path, verbosity)
  File "/MY-HOME/.local/lib/python3.6/site-packages/telegram/tdjson.py", line 36, in _build_client
    self._tdjson = CDLL(library_path)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /MY-HOME/.local/lib/python3.6/site-packages/telegram/lib/linux/libtdjson.so: invalid ELF header

I tried to increase tdlib_verbosity to 10 but I get no output back.

My environment:

$ uname -a
Linux 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:    18.04
Codename:   bionic

I tried with the manually compiled tdlib (version 1.5) and it works perfectly.

alexander-akhmetov commented 5 years ago

Sorry for the inconvenience. Can you try again? I just pushed a fix.

melfnt commented 4 years ago

Thank you, now it works