I successfully compiled tdlib, using the manual https://github.com/isopen/docker/blob/master/tdlib/Dockerfile.debian
Then:
$ python tdjson_example.py
Traceback (most recent call last):
File "tdjson_example.py", line 10, in <module>
tdjson = CDLL(tdjson_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: tdjson.dll: cannot open shared object file: No such file or directory
make install https://github.com/tdlib/td/issues/72
td/build$ make install
Output:
Install the project...
-- Install configuration: "Release"
...
-- Installing: /usr/local/lib/libtdjson.so
...
Success.
Then:
td/example/python$ python tdjson_example.py
Traceback (most recent call last):
File "tdjson_example.py", line 10, in <module>
tdjson = CDLL(tdjson_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libtdjson.so: cannot open shared object file: No such file or directory
Try to explicitly prescribe the path to the library.
tdjson_path = "your way to the library"
example: tdjson_path = "/usr/local/lib/libtdjson.so"
Try it...
root@web:/srv/www/td/example/python# tdjson_path = "/usr/local/lib/libtdjson.so"
-bash: tdjson_path: command not found
root@web:/srv/www/td/example/python# export tdjson_path = "/usr/local/lib/libtdjson.so"
-bash: export:=': not a valid identifier
-bash: export: /usr/local/lib/libtdjson.so': not a valid identifier
root@web:/srv/www/td/example/python# export tdjson_path="/usr/local/lib/libtdjson.so"
root@web:/srv/www/td/example/python# echo $tdjson_path
/usr/local/lib/libtdjson.so
root@web:/srv/www/td/example/python# python tdjson_example.py
Traceback (most recent call last):
File "tdjson_example.py", line 10, in <module>
tdjson = CDLL(tdjson_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libtdjson.so: cannot open shared object file: No such file or directory
tdjson_example.py::
from ctypes.util import find_library
from ctypes import *
import json
import sys
tdjson_path = "/usr/local/lib/libtdjson.so"
if tdjson_path is None:
print('can\'t find tdjson library')
quit()
tdjson = CDLL(tdjson_path)
td_json_client_create = tdjson.td_json_client_create
td_json_client_create.restype = c_void_p
td_json_client_create.argtypes = []
...
Also, check that the libtdjson.so file is exactly in /usr/local/lib/and it is available for reading to the current user.
Most helpful comment
Also, check that the
libtdjson.sofile is exactly in/usr/local/lib/and it is available for reading to the current user.