Search code examples
pythonshared-librariesembedded-linuxyocto

Pysqlcipher3 cannot find sqllite3 shared library


I have custom linux OS for an ARM board. I compiled the pysqlcipher3 for the platform in the yocto build. The python3 program fails to identify a sqlite3 symbol in the shared libraries.

>>> from pysqlcipher3 import dbapi2 as sqlcipher
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/pysqlcipher3/dbapi2.py", line 33, in <module>
    from pysqlcipher3._sqlite3 import *
ImportError: /usr/lib/python3.5/site-packages/pysqlcipher3/_sqlite3.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: sqlite3_enable_load_extension

But I have added sqlite3 packages in the yocto. I identified the library in the rootfs.

/usr/lib/libsqlite3.so.0

I have checked the symbols in the library using the nm command and it seems to have the missing symbol (sqlite3_enable_load_extension). Please help me to resolve this issue. Some forum suggested the usage of LD_PRELOAD option, It mess ups with sqlcipher operations

when I try to opne the database I get this error

getSingle failed  file is encrypted or is not a database

Solution

  • The pysqlcipher module depends on the libsqlcipher.so library in the device. The libsqlcipher should be built with --enable-load-extension to avoid this error

    For Yocto build, I have added the flag in sqlcipher recipe file to avoid the issue.

    EXTRA_OECONF = "--enable-load-extension --disable-tcl  CFLAGS=-DSQLITE_HAS_CODEC"