Связывание с объектом SQLite с помощью Rusqlite - PullRequest
0 голосов
/ 20 марта 2020

Я использую WSL (Ubuntu 18.04), Rust 1.41.0, SQLite 3.22.0 и пытаюсь использовать ящик rusqlite (0.21.0) для подключения к базе данных sqlite:

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

#[allow(unused_variables)]
fn main() {
    let conn = Connection::open("xz.db");

    match conn {
        Ok(c) => println!("Opened!"),
        Err(e) => println!("Error: {}", e),
    }
}

с автомобилем go .toml:

[package]
name = "exercise"
version = "0.1.0"
authors = ["gvkv"]
edition = "2020"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regex = "1"
rusqlite = "0"

, но я получаю ошибку соединения:

   gvkv@budapest:~/projects/exercise$ cargo run
   Compiling exercise v0.1.0 (/home/gvkv/projects/exercise)


    error: linking with `cc` failed: exit code: 1
      |
      = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.1b1tn91malxv84j2.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.1f3zejypfojfyf2g.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.1phby6z30bn9itzu.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.1z2zgmaujm7l3q39.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.3t9t8m5jq27guhp9.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.401cmbkw5566lc2p.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.443vbrljbzufraq8.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.4tu3gzsncvxano48.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.4x32lwzqzryfrvrn.rcgu.o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.5eleeyw4tgku9yy.rcgu.o" "-o" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6" "/home/gvkv/projects/exercise/target/debug/deps/exercise-5ce5621c10c4bdf6.1howi0dbz9bsuybo.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/gvkv/projects/exercise/target/debug/deps" "-L" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/gvkv/projects/exercise/target/debug/deps/librusqlite-71a193b8f542d048.rlib" "/home/gvkv/projects/exercise/target/debug/deps/libmemchr-49c50c282182e819.rlib" "/home/gvkv/projects/exercise/target/debug/deps/libbitflags-37b966951bf56db9.rlib" "/home/gvkv/projects/exercise/target/debug/deps/libtime-fcdf1b17fb822dcd.rlib" "/home/gvkv/projects/exercise/target/debug/deps/liblibc-a0764da72f8f4b80.rlib" "/home/gvkv/projects/exercise/target/debug/deps/libfallible_streaming_iterator-2784c8327caad89b.rlib" "/home/gvkv/projects/exercise/target/debug/deps/libfallible_iterator-91244d3e65b5490e.rlib" "/home/gvkv/projects/exercise/target/debug/deps/liblru_cache-22ebfec79de2fb55.rlib" "/home/gvkv/projects/exercise/target/debug/deps/liblinked_hash_map-ff60fbcb5f8224cb.rlib" "/home/gvkv/projects/exercise/target/debug/deps/liblibsqlite3_sys-db08ae2f31a9c1fb.rlib" "-Wl,--start-group" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a2a766dac798f7cf.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-a85f7d74095723ea.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-4ed27bd07d52ec56.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-4c323f23cb5b2482.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-2e6de4a7e177acee.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-80571e4a1921bf51.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1772b65d0f093257.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-37ebc98487d077f2.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-fa7cce2e70cf53f1.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-a60fcf932d3053cd.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-da705bf7dd482e5a.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-8a2e90edf20d7f0b.rlib" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4888dfadf2ff3780.rlib" "-Wl,--end-group" "/home/gvkv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-a0ee5f37b860b20a.rlib" "-Wl,-Bdynamic" "-lutil" "-ldl" "-lutil" "-lsqlite3" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
      = note: /usr/bin/ld: cannot find -lsqlite3
              collect2: error: ld returned 1 exit status


    error: aborting due to previous error

    error: could not compile `exercise`.

Я действительно не уверен, как действовать.

...