Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh Win 10 install link.exe 1181 error #51659

Closed
oliverjanik opened this issue Jun 20, 2018 · 3 comments
Closed

Fresh Win 10 install link.exe 1181 error #51659

oliverjanik opened this issue Jun 20, 2018 · 3 comments

Comments

@oliverjanik
Copy link

Hello.

Decided to try rust tonight. Can't get even hello world compiled. I tried searching but there's lot's of similar reports and most of them marked as resolved?

C:\Users\Oliver\dev\rust-hello>rustc main.rs
error: linking with `C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\link.exe` failed: exit code: 1181
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin\\amd64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "main.main0.rcgu.o" "main.main1.rcgu.o" "main.main2.rcgu.o" "main.main3.rcgu.o" "/OUT:main.exe" "main.crate.allocator.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-7448a93a40cf2c3f.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-1eb9a4cd8388f802.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-ffbf31c50cb70f99.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-49f242c4944f2f4b.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc_system-4fc81c8f97d71835.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-85d92121f1ed0b0c.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_unicode-63f640f34ce6d9b1.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-e2f4c2f8ebed02cb.rlib" "C:\\Users\\Oliver\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-c4ca9f329f3bf160.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "shell32.lib" "msvcrt.lib"
  = note: LINK : warning LNK4044: unrecognized option '/NATVIS:C:\Users\Oliver\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis'; ignored
          LINK : warning LNK4044: unrecognized option '/NATVIS:C:\Users\Oliver\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis'; ignored
          LINK : warning LNK4044: unrecognized option '/NATVIS:C:\Users\Oliver\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis'; ignored
          LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'


error: aborting due to previous error
@retep998
Copy link
Member

The warnings about /NATVIS are because the linker from VS 2013 doesn't yet support them, but that should be harmless. I do recommend upgrading of course, but it's not strictly necessary in this case.

The error about being unable to find advapi32.lib is because rustc is able to find link.exe in your PATH but you don't have LIB configured with the Windows SDK library directories, so link.exe is unable to find any of the necessary system libraries such as advapi32.lib. Ensure you have the Windows SDK installed and that your environment variables are configured correctly.

@oliverjanik
Copy link
Author

Thanks for the response. Maybe dependencies on windows should be documented in the Getting Started guide?

I sorted my problem by launching VS2017 installer and installing C++ for Desktop Module.

@cuzfrog
Copy link

cuzfrog commented Jul 5, 2020

Running VC\Auxiliary\Build\vcvarsall.bat solved my env var issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants