pysqlcipher3找不到sqllite3共享库

时间:2019-04-18 11:20:18

标签: python shared-libraries embedded-linux yocto

我有一个用于ARM板的定制linux操作系统。 我在yocto构建中为平台编译了pysqlcipher3。 python3程序无法在共享库中识别sqlite3符号。

>>> 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

但是我在yocto中添加了sqlite3软件包。我在rootfs中确定了该库。

/usr/lib/libsqlite3.so.0

我已经使用nm命令检查了库中的符号,并且似乎缺少符号(sqlite3_enable_load_extension)。 请帮助我解决此问题。 一些论坛建议使用LD_PRELOAD选项,它会与sqlcipher操作混淆

当我尝试对数据库进行操作时,出现此错误

getSingle failed  file is encrypted or is not a database

1 个答案:

答案 0 :(得分:1)

pysqlcipher模块取决于设备中的libsqlcipher.so库。 libsqlcipher应该使用--enable-load-extension生成,以避免出现此错误

对于Yocto构建,我在sqlcipher配方文件中添加了该标志以避免出现此问题。

position: relative;