I am trying to bind a compiled C-library to my python code with ctypes. I have compiled my library and it works well on my desktop.
However, when I try to run the same code on the Balena platform in a Docker container, it can not locate my library, event though the os-module can find it:
>>> os.path.exists("/app/com/libmylib.so")
True
>>> ctypes.cdll.LoadLibrary("/app/com/libmylib.so")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /app/com/libmylib.so: cannot open shared object file: No such file or directory
Any ideas as to why it can not find it?
It turned out, that the library was compiled for the wrong architecture.