Closed lingr7 closed 4 years ago
问题解决了吗?我这边手头没有windows环境,没有重现你这个问题。
问题解决了。先说明一下,可能无关的配置,那就是我把windows下的msvc工具链,换为了windows-gnu,但是估计这条是没有用的。
$ rustup show
Default host: x86_64-pc-windows-msvc
rustup home: D:\Programe\Rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu (default)
stable-x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-gnu (default)
rustc 1.44.1 (c7087fe00 2020-06-17)
因为仅仅是报错不同,缺少sqllite3库的动态链接问题没有改变。 后来,看了 rusqlite/rusqlite: Ergonomic bindings to SQLite for Rust 中的
If you use the bundled feature, libsqlite3-sys will use the cc crate to compile SQLite from source and link against that. This source is embedded in the libsqlite3-sys crate and is currently SQLite 3.30.1 (as of rusqlite 0.21.0 / libsqlite3-sys 0.17.0). This is probably the simplest solution to any build problems. You can enable this by adding the following in your Cargo.toml file:
[dependencies.rusqlite] version = "0.21.0" features = ["bundled"]
我就对依赖语句做了改写(在7月3日你的commits基础上)
[dependencies]
time = "~0.2.16" ansi_term = "~0.12" clap = "~2.33.0" dirs = "~2.0.2" anyhow = "~1.0" prettytable-rs = "^0.8"
[dependencies.migrant_lib] version = "0.28.0" features = ["d-sqlite"]
[dependencies.rusqlite] version = "0.21.0" features = ["bundled"]
[features] d-sqlite=[] bundled=[]
成功编译运行,链接上了sqllite3库。
![image](https://user-images.githubusercontent.com/37898999/86535071-3652cf00-bf10-11ea-87a0-1b19069fd728.png)
![image](https://user-images.githubusercontent.com/37898999/86535074-3fdc3700-bf10-11ea-8e63-99b2ebd85c6f.png)
❯ cargo build --release
Compiling winapi-x86_64-pc-windows-gnu v0.4.0
Compiling winapi v0.3.8
Compiling memchr v2.3.3
Compiling cc v1.0.52
Compiling proc-macro2 v1.0.10
Compiling libc v0.2.68
Compiling serde v1.0.106
Compiling unicode-xid v0.2.0
Compiling autocfg v1.0.0
Compiling byteorder v1.3.4
Compiling version_check v0.9.1
Compiling cfg-if v0.1.10
Compiling syn v1.0.17
Compiling lazy_static v1.4.0
Compiling ryu v1.0.3
Compiling pkg-config v0.3.17
Compiling bitflags v1.2.1
Compiling matches v0.1.8
Compiling smallvec v1.3.0
Compiling itoa v0.4.5
Compiling standback v0.2.8
Compiling unicode-width v0.1.7
Compiling linked-hash-map v0.5.2
Compiling proc-macro-hack v0.5.15
Compiling log v0.4.8
Compiling rustc-demangle v0.1.16
Compiling regex-syntax v0.6.17
Compiling fallible-streaming-iterator v0.1.9
Compiling percent-encoding v2.1.0
Compiling fallible-iterator v0.2.0
Compiling anyhow v1.0.28
Compiling vec_map v0.8.1
Compiling strsim v0.8.0
Compiling encode_unicode v0.3.6
Compiling num-traits v0.2.11
Compiling num-integer v0.1.42
Compiling thread_local v1.0.1
Compiling error-chain v0.12.2
Compiling time v0.2.16
Compiling unicode-bidi v0.3.4
Compiling unicode-normalization v0.1.12
Compiling textwrap v0.11.0
Compiling lru-cache v0.1.2
Compiling backtrace-sys v0.1.36
Compiling libsqlite3-sys v0.17.1
Compiling idna v0.2.0
Compiling aho-corasick v0.7.10
Compiling csv-core v0.1.10
Compiling quote v1.0.3
Compiling regex-automata v0.1.9
Compiling url v2.1.1
Compiling toml v0.5.6
Compiling serde_json v1.0.51
Compiling regex v1.3.7
Compiling time v0.1.42
Compiling winapi-util v0.1.5
Compiling dirs v1.0.5
Compiling atty v0.2.14
Compiling dirs-sys v0.3.4
Compiling ansi_term v0.12.1
Compiling bstr v0.2.13
Compiling same-file v1.0.6
Compiling term v0.5.2
Compiling clap v2.33.0
Compiling dirs v2.0.2
Compiling csv v1.1.3
Compiling backtrace v0.3.46
Compiling chrono v0.4.11
Compiling walkdir v2.3.1
Compiling prettytable-rs v0.8.0
Compiling rusqlite v0.21.0
Compiling time-macros-impl v0.1.0
Compiling serde_derive v1.0.106
Compiling time-macros v0.1.0
Compiling migrant_lib v0.28.0
Compiling rtd v0.3.1 (D:\git-for-use\rtd)
Finished release [optimized] target(s) in 5m 31s
给出 release编译版本exe文件 rtd.zip
在windows下用msvc工具链编译。
查看了一下,
我下载了官网sqlite-dll-win64-x64-3320300里的sqlite3.dll文件,如何配置呢加入编译呢?