【发布时间】:2021-09-26 13:31:24
【问题描述】:
背景
我需要在基于 arm 的计算机 (Jetson Nano) 中运行二进制文件,并且在我的团队决定使用 sqlite3 中的 Generated Columns 之前,我正在编译和运行它没有任何问题,这是在 3.31.0 版本中实现的功能但是该计算机运行的 Ubuntu 映像具有以前的开发版本,并使用 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.
因为在 x86 计算机上使用 sqlite3 版本 3.34 可以正常工作。
尝试过什么
更新库
我已经尝试从官方网页下载 SQLite 3.36 版并运行sudo make install,但没有在/usr/include 中创建库,但不知何故它仍然编译它并且仍然显示相同的错误。 (也许它知道新库在哪里,但奇怪的是尽管它仍然不起作用)。
更改数据库模式
我能想出的最简单的解决方案是更改架构并将生成的列存储为一个新列,该列将使用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 并不能解决问题。
关于如何解决这个问题的任何想法?
【问题讨论】:
标签: linux sqlite rust arm rust-diesel