背景
我需要在基于arm的计算机(Jetson Nano)上运行二进制文件,我一直在编译和运行它,没有任何问题,直到我的团队决定在sqlite3中使用生成的列,该功能在版本3.31.0中实现,但由上述计算机运行的Ubuntu Image具有以前的开发版本,并导致以下使用Dieselrs库的崩溃
thread 'main' panicked at 'called `Result::unwrap()` on an
`Err` value: DatabaseError(__Unknown, "malformed database schema
(group) - near \"as\": syntax error")', src/common_queries.rs:182:35(我们处理展开,但我删除了它,以便看到真正的消息)
我知道这是一个版本问题,因为显示的消息与sqlite3文档中的声明类似
.... If an earlier version of SQLite attempts to read a
database file that contains a generated column in its schema,
then that earlier version will perceive the generated column syntax
as an error and will report that the database schema is corrupt. 而且因为在装有sqlite3版本3.34的x86计算机上运行没有任何问题。
已经尝试过的内容
更新库
我已经尝试从官方网页下载SQLite版本3.36并运行sudo make install,但这并没有在/usr/include中创建库,但不知何故它仍然编译它,它仍然显示相同的错误。(也许它知道新的库在哪里,但奇怪的是,尽管如此,它仍然不能工作)。
更改db-schema
我能想到的最简单的解决方案是更改模式,并将生成的列存储为将使用after update trigger生成的新列,但这意味着数据库将不再是标准形式。
交叉编译
因为它在x86机器上工作,所以我尝试以该架构为目标,遵循不同的方法,得到以下消息
linking with `aarch64-linux-gnu-ld` failed: exit status: 1
....
....
....
aarch64-linux-gnu-ld: cannot find -lsqlite3
aarch64-linux-gnu-ld: cannot find -lgcc_s我猜这是因为它们都没有出现在/usr/aarch64-linux-gnu/include/中,但是安装libsqlite3-dev并不能解决这个问题。
对如何解决这个问题有什么想法吗?
发布于 2021-08-05 06:53:28
尝试将libsqlite3-sys = { version = "0.22.0", features = ["bundled"]}添加到您的Cargo.toml。这将强制从源代码为正确的目标构建libsqlite3。这使用最新版本的sqlite。详情请参考libsqlite3-sys的documentation。
https://stackoverflow.com/questions/68431113
复制相似问题