Pysqlcipher3找不到sqllite3共享库

问题描述 投票:0回答:1

我有一个ARM板的自定义Linux操作系统。我在yocto build中为平台编译了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中识别了库。

/US人/礼拜/lib SQLite3.so.0

我使用nm命令检查了库中的符号,它似乎有缺少的符号(sqlite3_enable_load_extension)。请帮我解决这个问题。一些论坛建议使用LD_PRELOAD选项,它搞乱了sqlcipher操作

当我尝试打开数据库时,我收到此错误

getSingle failed  file is encrypted or is not a database
python shared-libraries embedded-linux yocto
1个回答
1
投票

pysqlcipher模块依赖于设备中的libsqlcipher.so库。应使用--enable-load-extension构建libsqlcipher以避免此错误

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

EXTRA_OECONF = "--enable-load-extension --disable-tcl  CFLAGS=-DSQLITE_HAS_CODEC"
© www.soinside.com 2019 - 2024. All rights reserved.