如何用货物编译rusqlite 0.20.0

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

我正在尝试在rust项目中添加sqlite支持。 I found rusqlite on crates.io.我将版本行添加到Cargo.toml。我添加了在rusqlite docs page上找到的一些导入(未使用)。开车修车后,我恢复了一个错误。

我还没有实现任何东西。我只是想添加依赖项并进行编译。 main.rs:

extern crate rusqlite;

use rusqlite::{Connection, Result};
use rusqlite::NO_PARAMS;

Cargo.toml:

[package]
name = "program"
version = "0.1.0"
authors = ["97"]

[dependencies]
argparse = "0.2.2"
rand = "0.4.0"
rusqlite = "0.20.0"

收到错误:

$ cargo build
   Compiling pkg-config v0.3.16
   Compiling fallible-iterator v0.2.0
   Compiling memchr v2.2.1
   Compiling bitflags v1.2.1
   Compiling lru-cache v0.1.2
error[E0432]: unresolved import `std::ops::Bound`
  --> /home/seamus/.cargo/registry/src/github.com-1ecc6299db9ec823/pkg-config-0.3.16/src/lib.rs:72:16
   |
72 | use std::ops::{Bound, RangeBounds};
   |                ^^^^^ no `Bound` in `ops`

error[E0432]: unresolved import `std::ops::RangeBounds`
  --> /home/seamus/.cargo/registry/src/github.com-1ecc6299db9ec823/pkg-config-0.3.16/src/lib.rs:72:23
   |
72 | use std::ops::{Bound, RangeBounds};
   |                       ^^^^^^^^^^^ no `RangeBounds` in `ops`

error[E0658]: `dyn Trait` syntax is unstable (see issue #44662)
   --> /home/seamus/.cargo/registry/src/github.com-1ecc6299db9ec823/pkg-config-0.3.16/src/lib.rs:143:32
    |
143 |     fn cause(&self) -> Option<&dyn error::Error> {
    |                                ^^^^^^^^^^^^^^^^

error: aborting due to 3 previous errors

error: Could not compile `pkg-config`.
warning: build failed, waiting for other jobs to finish...
error[E0658]: `crate` in paths is experimental (see issue #45477)
  --> /home/seamus/.cargo/registry/src/github.com-1ecc6299db9ec823/fallible-iterator-0.2.0/src/lib.rs:98:5
   |
98 | use crate::imports::*;
   |     ^^^^^

error[E0658]: `dyn Trait` syntax is unstable (see issue #44662)
    --> /home/seamus/.cargo/registry/src/github.com-1ecc6299db9ec823/fallible-iterator-0.2.0/src/lib.rs:2606:24
     |
2606 | fn _is_object_safe(_: &dyn DoubleEndedFallibleIterator<Item = (), Error = ()>) {}
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

error: Could not compile `fallible-iterator`.
warning: build failed, waiting for other jobs to finish...
error: build failed

编辑

货物0.26.0(41480f5cc 2018-02-26)

rustc 1.25.0(84203cac6 2018-03-25)

sqlite rust
1个回答
0
投票

大多数包装箱仅支持最新的Rust版本。您可以尝试使用旧版本的板条箱,但最简单的方法是将Rust更新为当前支持的版本。

[如果您正在Linux发行版中使用Rust,请先将其卸载,然后从https://rustup.rs中获取它,以使其保持最新状态。 Rust生态系统的移动速度快于大多数分布。

运行rustup update

© www.soinside.com 2019 - 2024. All rights reserved.