yutaodou / rtd

Manage your todo in command line with rtd
11 stars 2 forks source link

windows编译 #2

Closed lingr7 closed 4 years ago

lingr7 commented 4 years ago

在windows下用msvc工具链编译。

error: linking with `link.exe` failed: exit code: 1181                                                                   
  |
  = note: "D:\\Programe\\vs\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.1a7fl4vbw7u1ndqb.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.1b7df8485xmah46m.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.1k7cbti2au7j1om7.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.1sqey2ra1dhz69ea.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.20zs65gt51oes7df.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.2c7f5olv3j8gn3gi.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.2jggabb7d4i6lbk0.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.31l5htnpe0abzyb8.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.3blzim84biv61z8v.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.40ssjktfq9h3kiow.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.4pzjvzxs63unua98.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.55h7xgf3xlfj7zb1.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.55jcmbgnk06wjlmv.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.59ilnwtbilh863gw.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.5ckyoc9431fdqx85.rcgu.o" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.5e66widbcro4pdwg.rcgu.o" "/OUT:D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.exe" "D:\\git-for-use\\rtd\\target\\debug\\deps\\rtd.2qtmej5xar5was11.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "/LIBPATH:D:\\git-for-use\\rtd\\target\\debug\\deps" "/LIBPATH:D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\librtd-ae2e1d2c79952da9.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libdirs-2706cb33898668cd.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libdirs_sys-5b02600e7cd155a6.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libansi_term-9f88d8f208e1f18a.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libtime-d5e9f35607689db2.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libstandback-f42dfec7446eddb1.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libtime_macros-49caac0c83ecdc79.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libmigrant_lib-c32b0ce65d8b75f0.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\librusqlite-f4dfd8183f2d9603.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libfallible_streaming_iterator-afa76f0a1925fa02.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libfallible_iterator-8ebbf1b457c1298f.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liblru_cache-34d9527788d51ac9.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liblinked_hash_map-f8f7e922041e54ac.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liblibsqlite3_sys-10e1d776c41f3598.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libwalkdir-7b2c7b3a5ff03a6a.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libsame_file-6e49bef3c429477b.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libwinapi_util-ccf14e34d6dba429.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liburl-ccb2aaee165f6743.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libidna-764ff5caeef7c4d0.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libunicode_normalization-ef1f9fa09ac5a918.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libsmallvec-621ff1e89759be7b.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libunicode_bidi-a7b969498b05af9e.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libmatches-825a9da6541dd2e7.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libtoml-0f235d6db714ec35.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libserde_json-05fa82710c189e72.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libryu-6a0bb6603b9fb40d.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libitoa-8c8a50955ef015f6.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libserde-30a47ec2e602fcc8.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libregex-5c917ba103a1b730.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libthread_local-661439548ccc4444.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libregex_syntax-6b10266e9c591a4a.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libaho_corasick-07ab38ddd86f9de7.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libmemchr-d872fa87956f840d.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libpercent_encoding-28cc184c33c42d80.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libchrono-fcf8811fd2e4ecf0.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libnum_integer-1ccfdc8e98322363.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libnum_traits-fbba19e7189913b5.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libtime-809dc70c6c03f326.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liblazy_static-700c63f896ce711b.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liblog-f56f83aad184cf45.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\liberror_chain-5a33c37b35c06e73.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libbacktrace-e2262daa5dc3b2a3.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libcfg_if-514dfd5c12d7de6d.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\librustc_demangle-9ee531405029e313.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libanyhow-c5beed121fb1a49f.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libclap-2832c305f0414022.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libvec_map-fe6ee42253e2a5c4.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libtextwrap-26e49ba2a7c396a5.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libunicode_width-85707ff002bc3859.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libstrsim-95191d96e69e7ca8.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libbitflags-77bc054a1cdb8c56.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libatty-ec40b4a4bccb5880.rlib" "D:\\git-for-use\\rtd\\target\\debug\\deps\\libwinapi-63a7a79c4fd84e6a.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-a21b889540613dfc.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-83bfb8861ef57f40.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-14549e8b52e9aa92.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-917aa5a73e1d450f.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace-8b6151daa356874f.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-3a2163f7734147c1.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-617422d63bed4eff.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-0c111a1d0f47d4d2.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-d497a9b0207a701b.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-f48e1371179fb3a7.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-03e655876d14719e.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-586bbf58a5e8a4d5.rlib" "D:\\Programe\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-0762d9d8dc651503.rlib" "sqlite3.lib" "advapi32.lib" "cfgmgr32.lib" "gdi32.lib" "kernel32.lib" "msimg32.lib" "ole32.lib" "opengl32.lib" "shell32.lib" "user32.lib" "winspool.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: LINK : fatal error LNK1181: cannot open input file 'sqlite3.lib'

error: aborting due to previous error

error: could not compile `rtd`.

To learn more, run the command again with --verbose.

查看了一下,

[dependencies.migrant_lib]
version = "0.28.0"
features = ["d-sqlite"]

我下载了官网sqlite-dll-win64-x64-3320300里的sqlite3.dll文件,如何配置呢加入编译呢?

yutaodou commented 4 years ago

问题解决了吗?我这边手头没有windows环境,没有重现你这个问题。

lingr7 commented 4 years ago

问题解决了。先说明一下,可能无关的配置,那就是我把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)
lingr7 commented 4 years ago
 ❯ 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