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

Add support for the Visual Studio Express 2017 linker #53474

Closed
lucatrv opened this issue Aug 18, 2018 · 10 comments
Closed

Add support for the Visual Studio Express 2017 linker #53474

lucatrv opened this issue Aug 18, 2018 · 10 comments
Labels
O-windows-msvc Toolchain: MSVC, Operating system: Windows

Comments

@lucatrv
Copy link

lucatrv commented Aug 18, 2018

Support for the Visual Studio 2017 linker was added with PR #38584, and I guess that rustc now works either with the Community or the Professional or the Enterprise releases (see comparison here). However that PR does not cover Visual Studio Express 2017, whose linker is located at c:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.12.25827\bin\Hostx86\x64\link.exe.

In order for rustc to find the Visual Studio Express 2017 linker I need to run c:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\vcvarsx86_amd64.bat.

I'm on Windows 7, running rustc version 1.28.0 (stable).

@retep998
Copy link
Member

retep998 commented Aug 19, 2018

There is nothing in the VC++ detection code that is specific to Community or Professional or Enterprise or Express. However there still may be something specific to Express or to your setup that is causing it to not work. Does C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt exist? Did you make sure to install the Windows SDK? Are you able to successfully link binaries using Rust after running vcvarsx86_amd64.bat?

For diagnosing issues like this I'd recommend reaching out to WindowsBunny on Mozilla IRC.

@lucatrv
Copy link
Author

lucatrv commented Aug 19, 2018

  1. I confirm that C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt exists.
  2. With Visual Studio Express 2017 there's no choice, Windows SDK is always installed.
  3. I can build binaries with Rust after running vcvarsx86_amd64.bat.

If I do not mistake, "regular" Visual Studio releases are installed in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\, while Visual Studio Express is installed in C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\, does Rust look both within Enterprise and WDExpress folders?

@retep998
Copy link
Member

retep998 commented Aug 19, 2018

My Visual Studio is installed in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community. Enterprise is only for the Enterprise version of VS. Again, there is nothing in the code that is specific to Enterprise or Community or WDExpress. The code simply uses a COM api provided by Microsoft to ask where VS is installed, and then looks for VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt inside that installation to find the latest VC++ toolchain. You can even look at the code yourself: https://github.com/alexcrichton/cc-rs/blob/master/src/windows_registry.rs

What are the contents of C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt? Inside the directory C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC could you run either tree /F in cmd or Get-ChildItem -Recurse in powershell and upload the output?

@lucatrv
Copy link
Author

lucatrv commented Aug 21, 2018

Thanks for the explanation.

The content of C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt is:

14.12.25827

Here is the output of Get-ChildItem -Recurse: Get-ChildItem-Recurse.txt

@estebank estebank added the O-windows-msvc Toolchain: MSVC, Operating system: Windows label Aug 22, 2018
@retep998
Copy link
Member

Are you on 32-bit Windows or 64-bit Windows? It appears you only have Hostx86 toolchains. If you're on 32-bit Windows, that's fine, but if you're on 64-bit Windows (which seems likely given the existence of C:\Program Files (x86)) then Rust is trying to look for the Hostx64 toolchains and failing. Please let me know as there may need to be a fallback implemented.

@lucatrv
Copy link
Author

lucatrv commented Aug 22, 2018

Yes I am on Windows 7 64-bit. I do not see any options in the VS Express 2017 installer to choose the x86 or x64 toolchains, moreover on the VS Express website I read:

Develop for WPF, WinForms, ASP.NET, Universal Windows Platform, Win32, Android, iOS, and many more platforms all from one IDE with everything you need

so I guess VS Express 2017 is limited to Win32.

@retep998
Copy link
Member

It can still target x64 just fine, it just doesn't come with x64 host toolchains for some reason.

I've filed an issue in the cc crate to get this fixed. #53474

@MichaelMcDonnell
Copy link
Contributor

@lucatrv do you still need Visual Studio Express 2017 support? Visual Studio 2019 and 2022 have both been available for a long time.

@lucatrv
Copy link
Author

lucatrv commented Jan 4, 2023

@MichaelMcDonnell currently I am using Visual Studio Build Tools 2022, I agree that nowadays support for Visual Studio Express 2017 is not needed anymore, so I'm closing this issue.

@lucatrv lucatrv closed this as completed Jan 4, 2023
@MichaelMcDonnell
Copy link
Contributor

Great! Thanks @lucatrv!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows-msvc Toolchain: MSVC, Operating system: Windows
Projects
None yet
Development

No branches or pull requests

4 participants