unrar.rs icon indicating copy to clipboard operation
unrar.rs copied to clipboard

Compiling trouble on Windows platform

Open QuietJoon opened this issue 6 years ago • 5 comments

Problem

I've got some trouble with using unrar.rs when compiling with this on Windows platform. (I'm very new Rust beginner(just for 5 days)

I just tried to compile this code,

main.rs:

extern crate unrar;

use unrar::Archive;

fn main() {
    for entry in Archive::new("data\\version.rar".into()).list().unwrap() {
        println!("{}", entry.unwrap());
    }
}

Cargo.toml:

[package]
name = "unrar_test"

[dependencies]
unrar = "0.4.3"

And I've got some linking errors like

$ cargo run
   Compiling unrar_test v0.1.0 (file:///H:/tmp/unrar_test)
error: linking with `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.10ygozpgsu0ud2lu.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.121jttcduank54om.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.16u6js6g0l3k1ic6.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.1y16o1qfye96o7m0.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.3hi2o6go6kdhu8v.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.3rngp6bm2u2q5z0y.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.4c8itjjwy0tlum5x.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.4oc10dk278mpk1vy.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.4xq48u46a1pwiqn7.rcgu.o" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.8xzrsc1ux72v29j.rcgu.o" "/OUT:H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.exe" "H:\\tmp\\unrar_test\\target\\debug\\deps\\unrar_test-f0ee6aee41073987.crate.allocator.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis"
"/NATVIS:C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:H:\\tmp\\unrar_test\\target\\debug\\deps" "/LIBPATH:H:\\tmp\\unrar_test\\target\\debug\\build\\unrar_sys-1b43a073752b4807\\out" "/LIBPATH:C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libunrar-c9a8fb8670b3f1cb.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libbitflags-7fc2d8f48e8aed82.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\liblog-35c0ba364a0b3cab.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\liblog-0b1544bfab8a999f.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libcfg_if-2c5b4986ebb831b2.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libenum_primitive-2d484da1c715c39b.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_traits-6f3422832661d7f2.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\liblazy_static-562934c7ef5207b9.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum-6c910313f5e57786.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_rational-365d910df3452270.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_bigint-082a2f9c2ca72f7b.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\librand-98d9dcc5238258c0.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libwinapi-3217d0af9161f402.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_complex-346e019707f2ae79.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\librustc_serialize-e24fd64c5758dc03.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_iter-666cead0865da915.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_integer-0be11c0b6ddcc33e.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libnum_traits-4620d8e4e44490a5.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libregex-4f1f6c64f53a7537.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libutf8_ranges-8c542cbf9db79cde.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libregex_syntax-faf293bcdf68c0ff.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libthread_local-d3302ede0234eb12.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libthread_id-14dd25d100944810.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libkernel32-87cf55884c866146.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libwinapi-636159d5ed2cf316.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libaho_corasick-5cd928f945ea9fe8.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libmemchr-51abb37d78747816.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\liblibc-5f5478e9c0490835.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\libunrar_sys-53fb048c60948416.rlib" "H:\\tmp\\unrar_test\\target\\debug\\deps\\liblibc-bc3c5edccda19a49.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-5405d4704f8995f7.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-79fac0e20ebb1ed3.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-4531ae36a5e21b20.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-249d49c9b4d4eaed.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc_system-521078d8407a2729.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-35c442d806c09626.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-2e4b9f5d4458ba9b.rlib" "C:\\Users\\YongJoon Joe\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-35dcb253c8a4f1fc.rlib" "advapi32.lib" "credui.lib" "kernel32.lib" "secur32.lib" "kernel32.lib" "kernel32.lib" "shell32.lib" "msvcrt.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "shell32.lib" "msvcrt.lib"
  = note: libunrar_sys-53fb048c60948416.rlib(dll.o) : error LNK2019: unresolved external symbol __imp_CharToOemA referenced in function RARReadHeaderEx
          libunrar_sys-53fb048c60948416.rlib(dll.o) : error LNK2019: unresolved external symbol __imp_OemToCharA referenced in function "int __cdecl ProcessFile(void *,int,char *,char *,wchar_t *,wchar_t *)" (?ProcessFile@@YAHPEAXHPEAD1PEA_W2@Z)
          libunrar_sys-53fb048c60948416.rlib(archive.o) : error LNK2001: unresolved external symbol __imp_OemToCharA
          libunrar_sys-53fb048c60948416.rlib(filestr.o) : error LNK2001: unresolved external symbol __imp_OemToCharA
          libunrar_sys-53fb048c60948416.rlib(dll.o) : error LNK2019: unresolved external symbol __imp_OemToCharBuffA referenced in
function RAROpenArchiveEx
          libunrar_sys-53fb048c60948416.rlib(strfn.o) : error LNK2001: unresolved external symbol __imp_OemToCharBuffA
          libunrar_sys-53fb048c60948416.rlib(archive.o) : error LNK2001: unresolved external symbol __imp_OemToCharBuffA
          libunrar_sys-53fb048c60948416.rlib(unicode.o) : error LNK2019: unresolved external symbol __imp_CharUpperW referenced in
function "int __cdecl toupperw(int)" (?toupperw@@YAHH@Z)
          libunrar_sys-53fb048c60948416.rlib(unicode.o) : error LNK2019: unresolved external symbol __imp_CharLowerW referenced in
function "int __cdecl tolowerw(int)" (?tolowerw@@YAHH@Z)
          libunrar_sys-53fb048c60948416.rlib(strfn.o) : error LNK2019: unresolved external symbol __imp_CharUpperA referenced in function "unsigned char __cdecl loctoupper(unsigned char)" (?loctoupper@@YAEE@Z)
          libunrar_sys-53fb048c60948416.rlib(strfn.o) : error LNK2019: unresolved external symbol __imp_CharLowerA referenced in function "unsigned char __cdecl loctolower(unsigned char)" (?loctolower@@YAEE@Z)
          libunrar_sys-53fb048c60948416.rlib(extract.o) : error LNK2019: unresolved external symbol __imp_CharToOemBuffW referenced in function "private: void __cdecl CmdExtract::ConvertDosPassword(class Archive &,class SecPassword &)" (?ConvertDosPassword@CmdExtract@@AEAAXAEAVArchive@@AEAVSecPassword@@@Z)
          libunrar_sys-53fb048c60948416.rlib(system.o) : error LNK2019: unresolved external symbol __imp_ExitWindowsEx referenced in function "void __cdecl Shutdown(void)" (?Shutdown@@YAXXZ)
          H:\tmp\unrar_test\target\debug\deps\unrar_test-f0ee6aee41073987.exe : fatal error LNK1120: 9 unresolved externals


error: aborting due to previous error

error: Could not compile `unrar_test`.

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

(I'm using msvc toolchain from VS 2017 on Windows 10)

Solution(?)

I thought this error messages is not depended on unrar.rs. However, when I add dev-dependencies section to Cargo.toml like below,

[dev-dependencies]
tempdir = "0.3"

it works.

$ cargo run --release
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling winapi v0.3.6
   ...
   Compiling unrar_test v0.1.0 (file:///H:/tmp/unrar_test)
    Finished release [optimized] target(s) in 25.00s
     Running `target\release\unrar_test.exe`
VERSION

I do not have good understand about the background of Rust. Therefore, this section may be needed. However, I can not think this problem depends on unrar.rs.

QuietJoon avatar Oct 08 '18 13:10 QuietJoon

Thank you! I think #15 fixes this. Please report back if this error still occurs.

muja avatar Dec 09 '19 19:12 muja

Thanks for fix. But in my case, the problem is still exist.

I've clean up Cargo.lock and cargo clean and confirm that it checkout the last commit. And, the result is as shown below.

Without tempdir

$ cargo run --example unrar_test
    Blocking waiting for file lock on package cache
    Updating git repository `https://github.com/muja/unrar.rs`
    Updating crates.io index
    Blocking waiting for file lock on package cache
   Compiling memchr v2.2.1
   Compiling cc v1.0.48
   Compiling bitflags v1.2.1
   Compiling lazy_static v1.4.0
   Compiling regex-syntax v0.6.12
   Compiling thread_local v0.3.6
   Compiling aho-corasick v0.7.6
   Compiling unrar_sys v0.2.0 (https://github.com/muja/unrar.rs#6e891ae4)
   Compiling regex v1.3.1
   Compiling unrar v0.4.3 (https://github.com/muja/unrar.rs#6e891ae4)
   Compiling archive_differ_rust v0.1.0 (T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.1c599apmczazbya1.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.22wiwsfk4fjsikvj.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.24ckdqljfue8umy7.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.3d9yhqpb0ykpop65.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.3fxe5eyz4vy27s3a.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.3wqp1e1573akwrna.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.41i1htwhe2yc654p.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.4h97awmgnewb0m1v.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.4r76otvd5t813vn3.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.hkf2yv4epkfdyb1.rcgu.o" "/OUT:T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.exe" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.c2k2hlvfci4driq.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps" "/LIBPATH:T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\build\\unrar_sys-7965448aad38cb8a\\out" "/LIBPATH:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libunrar-010193c7c36b0d23.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libbitflags-a7ae99c8910cbfe7.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libenum_primitive-f20429e92bdabc7d.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_traits-c8f68f202ffd23db.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum-3e5c9a7aede0e156.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_rational-47e9695ba0888a75.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_bigint-894acbe516c80d0f.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\librand-2761610c8f847454.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libwinapi-b0165dec7cdad839.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_complex-e6b9c4d3d4e49ea0.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\librustc_serialize-4d7a547979cf5bf7.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_iter-19ce1381b56f78a8.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_integer-324f3736b67d43eb.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_traits-0f891a6145f9bed1.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libregex-abc0ed140befd0bf.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libthread_local-df9c2ce10c9e835d.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\liblazy_static-c803ad1fce84ef45.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libregex_syntax-fefdc02842a93253.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libaho_corasick-e7b646026261cde5.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libmemchr-db92221912163af3.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libunrar_sys-4c9cebe473f72f5d.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\liblibc-9b8752856c6bedc6.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-f3cd9033b21bfd69.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-7177cc63e2247a71.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-dc4f9fa6045181bb.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-b42f2443bfe541d3.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace-727167d019576e4a.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-b116c11df52ba1e2.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-d4c5a28b76348d5c.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-79bcbf9ce75fa48d.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-c9478dd7b586b8cc.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-c80eff7d74f3988c.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-fd0f5d5cd3b3863d.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-49f9f21b6d32d457.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-b32ee8ba444e5f7c.rlib" "advapi32.lib" "credui.lib" "kernel32.lib" "secur32.lib" "powrprof.lib" "shell32.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: Non-UTF-8 output: libunrar_sys-4c9cebe473f72f5d.rlib(dll.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharToOemA \x82\xaa\x8a\xd6\x90\x94 RARReadHeaderEx \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(dll.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_OemToCharA \x82\xaa\x8a\xd6\x90\x94 \"int __cdecl ProcessFile(void *,int,char *,char *,wchar_t *,wchar_t *)\" (?ProcessFile@@YAHPEAXHPEAD1PEA_W2@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(archive.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(filestr.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(dll.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_OemToCharBuffA \x82\xaa\x8a\xd6\x90\x94 RAROpenArchiveEx \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(strfn.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharBuffA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(archive.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharBuffA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(unicode.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharUpperW \x82\xaa\x8a\xd6\x90\x94 \"int __cdecl toupperw(int)\" (?toupperw@@YAHH@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(unicode.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharLowerW \x82\xaa\x8a\xd6\x90\x94 \"int __cdecl tolowerw(int)\" (?tolowerw@@YAHH@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(strfn.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharUpperA \x82\xaa\x8a\xd6\x90\x94 \"unsigned char __cdecl loctoupper(unsigned char)\" (?loctoupper@@YAEE@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(strfn.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharLowerA \x82\xaa\x8a\xd6\x90\x94 \"unsigned char __cdecl loctolower(unsigned char)\" (?loctolower@@YAEE@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(extract.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharToOemBuffW \x82\xaa\x8a\xd6\x90\x94 \"private: void __cdecl CmdExtract::ConvertDosPassword(class Archive &,class SecPassword &)\" (?ConvertDosPassword@CmdExtract@@AEAAXAEAVArchive@@AEAVSecPassword@@@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(system.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_ExitWindowsEx \x82\xaa\x8a\xd6\x90\x94 \"void __cdecl Shutdown(enum POWER_MODE)\" (?Shutdown@@YAXW4POWER_MODE@@@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nT:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.exe : fatal error LNK1120: 9 \x8c\x8f\x82\xcc\x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x8eQ\x8f\xc6\r\n

error: aborting due to previous error

error: could not compile `archive_differ_rust`.

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

Also, I could get proper result when I re-enables tempdir in dev-dependencies.

QuietJoon avatar Dec 10 '19 02:12 QuietJoon

Can you rerun it with --verbose? Also, which Windows version are you using, which toolchain, which rustc version etc?

muja avatar Dec 10 '19 22:12 muja

Here is log with --verbose

The main.rs code described in the above is renamed to unrar_test.rs in examples directory now.

Windows version: Windows 10 1909(18363.476) Rustc: stable-x86_64-pc-windows-msvc unchanged - rustc 1.39.0 (4560ea788 2019-11-04) Toolchain: Visual Studio 2019 Build Tools (According to rustup guide)

$ cargo run --example unrar_test --verbose
       Fresh autocfg v0.1.7
       Fresh rustc-serialize v0.3.24
       Fresh cc v1.0.48
       Fresh lazy_static v1.4.0
       Fresh regex-syntax v0.6.12
       Fresh thread_local v0.3.6
       Fresh winapi v0.3.8
       Fresh memchr v2.2.1
       Fresh libc v0.2.66
       Fresh num-traits v0.2.10
       Fresh rand v0.4.6
       Fresh aho-corasick v0.7.6
       Fresh unrar_sys v0.2.0 (https://github.com/muja/unrar.rs#6e891ae4)
       Fresh bitflags v1.2.1
       Fresh num-integer v0.1.41
       Fresh num-traits v0.1.43
       Fresh num-complex v0.1.43
       Fresh regex v1.3.1
       Fresh num-bigint v0.1.44
       Fresh num-iter v0.1.39
       Fresh enum_primitive v0.1.1
       Fresh num-rational v0.1.42
       Fresh num v0.1.42
       Fresh unrar v0.4.3 (https://github.com/muja/unrar.rs#6e891ae4)
   Compiling archive_differ_rust v0.1.0 (T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust)
     Running `rustc --crate-name unrar_test 'examples\unrar_test.rs' --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7d5c70285755da42 -C extra-filename=-7d5c70285755da42 --out-dir 'T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\examples' -C 'incremental=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\incremental' -L 'dependency=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\deps' --extern 'archive_differ_rust=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\deps\libarchive_differ_rust-b637992e73a7a454.rlib' --extern 'unrar=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\deps\libunrar-010193c7c36b0d23.rlib' -L 'native=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\build\unrar_sys-7965448aad38cb8a\out'`
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.1c599apmczazbya1.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.22wiwsfk4fjsikvj.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.24ckdqljfue8umy7.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.3d9yhqpb0ykpop65.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.3fxe5eyz4vy27s3a.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.3wqp1e1573akwrna.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.41i1htwhe2yc654p.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.4h97awmgnewb0m1v.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.4r76otvd5t813vn3.rcgu.o" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.hkf2yv4epkfdyb1.rcgu.o" "/OUT:T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.exe" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.c2k2hlvfci4driq.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps" "/LIBPATH:T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\build\\unrar_sys-7965448aad38cb8a\\out" "/LIBPATH:C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libunrar-010193c7c36b0d23.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libbitflags-a7ae99c8910cbfe7.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libenum_primitive-f20429e92bdabc7d.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_traits-c8f68f202ffd23db.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum-3e5c9a7aede0e156.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_rational-47e9695ba0888a75.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_bigint-894acbe516c80d0f.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\librand-2761610c8f847454.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libwinapi-b0165dec7cdad839.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_complex-e6b9c4d3d4e49ea0.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\librustc_serialize-4d7a547979cf5bf7.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_iter-19ce1381b56f78a8.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_integer-324f3736b67d43eb.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libnum_traits-0f891a6145f9bed1.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libregex-abc0ed140befd0bf.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libthread_local-df9c2ce10c9e835d.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\liblazy_static-c803ad1fce84ef45.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libregex_syntax-fefdc02842a93253.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libaho_corasick-e7b646026261cde5.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libmemchr-db92221912163af3.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\libunrar_sys-4c9cebe473f72f5d.rlib" "T:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\deps\\liblibc-9b8752856c6bedc6.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-f3cd9033b21bfd69.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-7177cc63e2247a71.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-dc4f9fa6045181bb.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-b42f2443bfe541d3.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace-727167d019576e4a.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-b116c11df52ba1e2.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-d4c5a28b76348d5c.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-79bcbf9ce75fa48d.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-c9478dd7b586b8cc.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-c80eff7d74f3988c.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-fd0f5d5cd3b3863d.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-49f9f21b6d32d457.rlib" "C:\\Users\\YongJoon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-b32ee8ba444e5f7c.rlib" "advapi32.lib" "credui.lib" "kernel32.lib" "secur32.lib" "powrprof.lib" "shell32.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note: Non-UTF-8 output: libunrar_sys-4c9cebe473f72f5d.rlib(dll.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharToOemA \x82\xaa\x8a\xd6\x90\x94 RARReadHeaderEx \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(dll.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_OemToCharA \x82\xaa\x8a\xd6\x90\x94 \"int __cdecl ProcessFile(void *,int,char *,char *,wchar_t *,wchar_t *)\" (?ProcessFile@@YAHPEAXHPEAD1PEA_W2@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(archive.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(filestr.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(dll.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_OemToCharBuffA \x82\xaa\x8a\xd6\x90\x94 RAROpenArchiveEx \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(strfn.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharBuffA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(archive.o) : error LNK2001: \x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b \"__imp_OemToCharBuffA\" \x82\xcd\x96\xa2\x89\xf0\x8c\x88\x82\xc5\x82\xb7\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(unicode.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharUpperW \x82\xaa\x8a\xd6\x90\x94 \"int __cdecl toupperw(int)\" (?toupperw@@YAHH@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(unicode.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharLowerW \x82\xaa\x8a\xd6\x90\x94 \"int __cdecl tolowerw(int)\" (?tolowerw@@YAHH@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(strfn.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharUpperA \x82\xaa\x8a\xd6\x90\x94 \"unsigned char __cdecl loctoupper(unsigned char)\" (?loctoupper@@YAEE@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(strfn.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharLowerA \x82\xaa\x8a\xd6\x90\x94 \"unsigned char __cdecl loctolower(unsigned char)\" (?loctolower@@YAEE@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(extract.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_CharToOemBuffW \x82\xaa\x8a\xd6\x90\x94 \"private: void __cdecl CmdExtract::ConvertDosPassword(class Archive &,class SecPassword &)\" (?ConvertDosPassword@CmdExtract@@AEAAXAEAVArchive@@AEAVSecPassword@@@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nlibunrar_sys-4c9cebe473f72f5d.rlib(system.o) : error LNK2019: \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x83\x8b __imp_ExitWindowsEx \x82\xaa\x8a\xd6\x90\x94 \"void __cdecl Shutdown(enum POWER_MODE)\" (?Shutdown@@YAXW4POWER_MODE@@@Z) \x82\xc5\x8eQ\x8f\xc6\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nT:\\AoSh\\ArchiveDiffer\\ArchiveDiffer-Rust\\target\\debug\\examples\\unrar_test-7d5c70285755da42.exe : fatal error LNK1120: 9 \x8c\x8f\x82\xcc\x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x8eQ\x8f\xc6\r\n

error: aborting due to previous error

error: could not compile `archive_differ_rust`.

Caused by:
  process didn't exit successfully: `rustc --crate-name unrar_test 'examples\unrar_test.rs' --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7d5c70285755da42 -C extra-filename=-7d5c70285755da42 --out-dir 'T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\examples' -C 'incremental=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\incremental' -L 'dependency=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\deps' --extern 'archive_differ_rust=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\deps\libarchive_differ_rust-b637992e73a7a454.rlib' --extern 'unrar=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\deps\libunrar-010193c7c36b0d23.rlib' -L 'native=T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust\target\debug\build\unrar_sys-7965448aad38cb8a\out'` (exit code: 1)

When I got this error first, the Toolchain was Visual Studio 2017 Build Tools as you can see from the first report log.

Log with enabling tempdir cargo in dev-dependencies in my Cargo.toml:

$ cargo run --example unrar_test --verbose
    Blocking waiting for file lock on package cache
    Updating crates.io index
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
       Fresh autocfg v0.1.7
       Fresh rustc-serialize v0.3.24
       Fresh cc v1.0.48
       Fresh lazy_static v1.4.0
       Fresh regex-syntax v0.6.12
       Fresh thread_local v0.3.6
       Fresh winapi v0.3.8
       Fresh memchr v2.2.1
       Fresh libc v0.2.66
       Fresh bitflags v1.2.1
       Fresh num-traits v0.2.10
       Fresh rand v0.4.6
       Fresh aho-corasick v0.7.6
       Fresh unrar_sys v0.2.0 (https://github.com/muja/unrar.rs#6e891ae4)
       Fresh remove_dir_all v0.5.2
       Fresh num-integer v0.1.41
       Fresh num-traits v0.1.43
       Fresh num-complex v0.1.43
       Fresh regex v1.3.1
       Fresh tempdir v0.3.7
       Fresh num-bigint v0.1.44
       Fresh num-iter v0.1.39
       Fresh enum_primitive v0.1.1
       Fresh num-rational v0.1.42
       Fresh num v0.1.42
       Fresh unrar v0.4.3 (https://github.com/muja/unrar.rs#6e891ae4)
       Fresh archive_differ_rust v0.1.0 (T:\AoSh\ArchiveDiffer\ArchiveDiffer-Rust)
    Finished dev [unoptimized + debuginfo] target(s) in 1.52s
     Running `target\debug\examples\unrar_test.exe`
VERSION

QuietJoon avatar Dec 11 '19 01:12 QuietJoon

Hey, I have a hunch on what might be happening here.

  1. The linking errors are because it's not linking user32 library. This should be fixed by adding println!("cargo:rustc-link-lib=user32"); to build.rs.

  2. It's working with tempdir because tempdir pulls remove_dir_all as a dependency, which again pulls winapi with winbase feature enabled. From there the winbase feature results in user32 getting linked.

If this turns out to be correct, then maybe it would be worth it to just go and figure out all the Windows libraries unrar needs and add them to the build.rs in unrar_sys?

vjoki avatar Dec 11 '19 23:12 vjoki

This has been fixed I presume, we also have windows on the build matrix. Closing, but feel free to reopen if issue persists.

muja avatar Jun 22 '23 22:06 muja