Open xiaoquanju opened 2 years ago
Hi @xiaoquanju, thanks for reaching out, by looking at the output, it seems that the errors occur when trying to link against winpty
. Is it possible to know how are you installing/downloading it?
Hi, I encountered a simliar problem:
MSVC Link.exe complaining winpty.lib could not be opened.
For me it was necessary to ensure the folder containing winpty.lib
was listed in PATH and in LIB. It did not work before I updated LIB, which previously was empty, to point to the directory I placed the files from the release into.
@andfoy If this is indeed the case that LIB must contain the folder, it might be helpfull to update the README to include that information.
@jakob-ledermann I think a more accurate detection of winpty
is needed here: https://github.com/andfoy/winpty-rs/issues/38
I think that ist adjacent but not necessarily sufficient. I have winpty-agent.exe
available in the same folder as winpty.lib.
The Problem seemed to be that PATH as stated in your README ist insufficient and LIB ist required.
Yes a more sofisticated detection should capture this mismatch.
I think I had those Problems previously, but I think I solved them then by using a mingw Windows target. So LIB could be a msvc
specific requirement.
In the meantime, let me update the README to state the importance of setting LIB
to link winpty binaries appropriately
error: linking with
link.exe
failed: exit code: 1120 | = note: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x86\link.exe" "/NOLOGO" "/LARGEADDRESSAWARE" "/SAFESEH" "D:\study\winpty-rs\target\debug\deps\winpty_example.1cc0n9mo8xxdkvnj.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.1h6q82nb5xjxekpv.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.1p7clx5cqo08w7vu.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.25bbqhge3itqpcsf.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.2ur222iavxzor748.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.2zx9bwgoaki2fq52.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.3cnerrzwt8j9ideo.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.4orgf2r8nbysh0lb.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.4sjxucpri6ueyzzc.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.4vt5dbdxsd18evbx.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.54umx4w230kxe4gl.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.563p9grhvga0eovv.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.xahomzpyzy6p6de.rcgu.o" "D:\study\winpty-rs\target\debug\deps\winpty_example.1kwo34bf8nmt1kal.rcgu.o" "/LIBPATH:D:\study\winpty-rs\target\debug\deps" "/LIBPATH:C:\Users\quanjuxiao\.cargo\registry\src\github.com-1285ae84e5963aae\windows_i686_msvc-0.29.0\lib" "/LIBPATH:C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib" "D:\study\winpty-rs\target\debug\deps\libwinptyrs-0c902c681de41b38.rlib" "D:\study\winpty-rs\target\debug\deps\libwindows-dcacc3ebf5ecb0e9.rlib" "D:\study\winpty-rs\target\debug\deps\libbitflags-68d00a4e11d9743c.rlib" "D:\study\winpty-rs\target\debug\deps\libnum_traits-fed6dc9a2723642c.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libstd-931225e3dbd6b9f4.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libpanic_unwind-3dd48e6b2ad65903.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libstd_detect-f63b27864b05a521.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\librustc_demangle-f8b6d72193202ff4.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libhashbrown-72d837e9cd5d8b77.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\librustc_std_workspace_alloc-6ec2898ba2b1042e.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libunwind-6548855e4850707e.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libcfg_if-a7defd1b9cb83850.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\liblibc-c96b1d609efb6ca9.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\liballoc-3ab92b4282a29b72.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\librustc_std_workspace_core-a463996c0bf14c25.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libcore-01fe738051057f88.rlib" "C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libcompiler_builtins-50742d5067b78384.rlib" "windows.lib" "kernel32.lib" "oleaut32.lib" "ole32.lib" "oleaut32.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "libcmt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib" "/OUT:D:\study\winpty-rs\target\debug\deps\winpty_example.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\quanjuxiao\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\etc\libstd.natvis" = note: Non-UTF-8 output: libwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.2cf62bgbl3jbsz2g.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_free\xa3\xac\xba\xaf\xca\xfd ZN84_$LT$winptyrs..pty..winpty..pty_impl..WinPTYPtr$u20$as$u20$core..ops..drop..Drop$GT$4drop17h6cdcc7b5ea0df39aE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_conin_name\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl9WinPTYPtr14get_conin_name17h8308ce77c6d41ad4E \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_conout_name\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl9WinPTYPtr15get_conout_name17h64cd82b221127259E \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_spawn_config_new\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl9WinPTYPtr5spawn17h510cf0b48c63dcb4E \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_spawn\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl9WinPTYPtr5spawn17h510cf0b48c63dcb4E \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_spawn_config_free\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl9WinPTYPtr5spawn17h510cf0b48c63dcb4E \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_set_size\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl9WinPTYPtr8set_size17haa942c00c307530eE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_error_msg\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl17get_error_message17h444c28e8e6e5473dE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_error_free\xa3\xac\xba\xaf\xca\xfd ZN8winptyrs3pty6winpty8pty_impl17get_error_message17h444c28e8e6e5473dE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_config_new\xa3\xac\xba\xaf\xca\xfd ZN88_$LT$winptyrs..pty..winpty..pty_impl..WinPTY$u20$as$u20$winptyrs..pty..base..PTYImpl$GT$3new17h8dd6c6fd0a3a64faE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_config_set_initial_size\xa3\xac\xba\xaf\xca\xfd ZN88_$LT$winptyrs..pty..winpty..pty_impl..WinPTY$u20$as$u20$winptyrs..pty..base..PTYImpl$GT$3new17h8dd6c6fd0a3a64faE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_config_set_mouse_mode\xa3\xac\xba\xaf\xca\xfd _ZN88$LT$winptyrs..pty..winpty..pty_impl..WinPTY$u20$as$u20$winptyrs..pty..base..PTYImpl$GT$3new17h8dd6c6fd0a3a64faE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_config_set_agent_timeout\xa3\xac\xba\xaf\xca\xfd ZN88_$LT$winptyrs..pty..winpty..pty_impl..WinPTY$u20$as$u20$winptyrs..pty..base..PTYImpl$GT$3new17h8dd6c6fd0a3a64faE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_open\xa3\xac\xba\xaf\xca\xfd _ZN88$LT$winptyrs..pty..winpty..pty_impl..WinPTY$u20$as$u20$winptyrs..pty..base..PTYImpl$GT$3new17h8dd6c6fd0a3a64faE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nlibwinptyrs-0c902c681de41b38.rlib(winptyrs-0c902c681de41b38.59ch8ca6nwbt6chw.rcgu.o) : error LNK2019: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 _winpty_config_free\xa3\xac\xba\xaf\xca\xfd _ZN88$LT$winptyrs..pty..winpty..pty_impl..WinPTY$u20$as$u20$winptyrs..pty..base..PTYImpl$GT$3new17h8dd6c6fd0a3a64faE \xd6\xd0\xd2\xfd\xd3\xc3\xc1\xcb\xb8\xc3\xb7\xfb\xba\xc5\r\nD:\study\winpty-rs\target\debug\deps\winpty_example.exe : fatal error LNK1120: 15 \xb8\xf6\xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xc3\xfc\xc1\xee\r\n