0

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
Clifford
  • 88,407
  • 13
  • 85
  • 165
parera riddle
  • 148
  • 4
  • 10
  • pysqlcipher3 needs libsqlcipher to be installed, did you add it as well? I don't know the state but you can find a recipe [here](https://github.com/openwebos/meta-webos/blob/master/recipes-upstreamable/sqlcipher/sqlcipher.bb). Did you create a pysqlcipher3 recipe or you just compiled it with Yocto sdk ? – Nayfe Apr 18 '19 at 11:42
  • Yes I have added sqlcipher to the build and I compiled with yocto sdk. – parera riddle Apr 18 '19 at 11:45
  • 1
    sqlite3_enable_load_extension was removed, see [debian tracker](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=478337). Can you check following command `objdump -T /usr/lib/libsqlite3.so.0|grep -c sqlite3_enable_load_extension`? – Nayfe Apr 18 '19 at 11:54
  • 1
    Did you see [this thread](https://stackoverflow.com/a/1546162/6225741)? Maybe we have to remove SQLITE_OMIT_LOAD_EXTENSION option from sqlite3. – Nayfe Apr 18 '19 at 12:09
  • objdump show that symbol exists. I will check the other link – parera riddle Apr 18 '19 at 12:29
  • It got by building the sqlcipher package with --enable-load-extension flag. Thanks for all the help. – parera riddle Apr 19 '19 at 11:53
  • How did you manage to get pysqlcipher3 installed in your image? – Antonio Santoro Oct 04 '21 at 09:21

1 Answers1

1

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"
parera riddle
  • 148
  • 4
  • 10