我在Windows 10上使用32位版本的Rust 1.6來編譯rustlab。當我運行cargo build
構建它,它針對以下本土文物我可以得到Rust鏈接的原生文物的完整路徑嗎?
鏈接反對這種靜態庫鏈接
時說,我想這樣做。有沒有辦法獲得使用的庫的完整路徑?
PS C:\rs\rustlab> cargo build -v
Compiling libc v0.2.7
Running `rustc C:\Users\cameron\.cargo\registry\src\github.com-48ad6e4054423464\libc-0.2.7\src\lib.rs --crate-name libc --crate-typ
e lib -g --cfg "feature=\"default\"" -C metadata=0c94fdfb80c4b805 -C extra-filename=-0c94fdfb80c4b805 --out-dir C:\rs\rustlab\target\deb
ug\deps --emit=dep-info,link -L dependency=C:\rs\rustlab\target\debug\deps -L dependency=C:\rs\rustlab\target\debug\deps --cap-lints all
ow`
Compiling rustlab v0.1.0 (file:///C:/rs/rustlab)
Running `rustc src\lib.rs --crate-name rustlab --crate-type staticlib --crate-type dylib -g --out-dir C:\rs\rustlab\target\debug --
emit=dep-info,link -L dependency=C:\rs\rustlab\target\debug -L dependency=C:\rs\rustlab\target\debug\deps --extern libc=C:\rs\rustlab\ta
rget\debug\deps\liblibc-0c94fdfb80c4b805.rlib`
note: link against the following native artifacts when linking against this static library
note: the order and any duplication can be significant on some platforms, and so may need to be preserved
note: library: gcc_eh
note: library: gcc_eh
note: library: ws2_32
note: library: userenv
note: library: shell32
note: library: advapi32
例如,我有WS2_32.lib
3個x86
版本。哪一個被使用?
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\WS2_32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x86\WS2_32.Lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x86\WS2_32.Lib
你猜對了。我正在使用Rust的GNU 32位版本來爲GNU Octave構建庫。我看到Rust有一個'libws2_32.a',Octave也有'libws2_32.a'。我如何知道它們是否兼容?我可以讓Rust使用Octave中的一個嗎?這些位置是'C:\ Program Files(x86)\ Rust stable GNU 1.6 \ lib \ rustlib \ i686-pc-windows-gnu \ lib \ libws2_32.a'和'C:\ Octave \ Octave-4.0.0 \ lib \ libws2_32.a'。如果我創建了一個將'rustc-link-search'輸出到Octave路徑的構建腳本,它會從那裏使用'libws2_32.a'嗎? –
*我怎麼知道它們是否兼容?*嘗試它們兩個!說真的,我認爲他們都應該工作,只要他們定義你的應用程序及其依賴關係需要的符號。如果與Octave的'libws2_32.a'鏈接不起作用,您將無法鏈接Octave的其他庫! * ...它會使用'libws2_32.a'嗎?*我想是的。確保一種方法是使用[進程監視器](https://technet.microsoft.com/en-us/sysinternals/bb896645)來監視具有該名稱的文件上的事件。 –