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

msvc command line tools are not on %PATH% #10853

Closed
3 of 15 tasks
bnoordhuis opened this issue Oct 23, 2024 · 10 comments
Closed
3 of 15 tasks

msvc command line tools are not on %PATH% #10853

bnoordhuis opened this issue Oct 23, 2024 · 10 comments

Comments

@bnoordhuis
Copy link

Description

Sorta similar to #6205 but I can offer a few more observations:

  1. Trying to invoke cl.exe (and presumably ld.exe etc.) directly right now is... I didn't manage to get it working in Add C++ compile test quickjs-ng/quickjs#615 and I believe I qualify as at least moderately competent. It's definitely harder than it should be. The "ordained" way (according to search engines: use hard-coded paths to the current msvc point release) is extremely brittle.

  2. clang-cl.exe, the cl.exe-compatible frontend for clang, is on the path. I'm not complaining but that seems inconsistent.

Maybe there's an easy and robust way to accomplish running cl.exe. In that case I would be grateful for improved documentation.

Blame where blame is due: I expected vcvarsall.bat to update %PATH% but it doesn't.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

n/a

Is it regression?

Has always been broken AFAICT

Expected behavior

n/a

Actual behavior

n/a

Repro steps

n/a

@sean-mcmanus
Copy link

I believe this is "by design". I think you're expected to run vcvarsall.bat and pass arguments like amd64_arm64, x64, -vcvars_ver=14.41, etc. to control which of the many possible installed cl.exe versions are used.

@Prabhatkumar59
Copy link
Contributor

Hi @bnoordhuis - Thank you for bringing this issue to our attention. We will look into this issue and will update you on this issue after investigating.


@bnoordhuis
Copy link
Author

As another data point: we finally got it working but only after pulling in https://github.com/egor-tensin/vs-shell

@Prabhatkumar59
Copy link
Contributor

Hi @bnoordhuis - Thanks for your input! So, just to confirm, is it working fine for you and your issue got resolved?

@bnoordhuis
Copy link
Author

I wouldn't call it resolved; we found a workaround. You could summarize my original report as "invoking cl.exe is too darn hard" and that didn't change.

@Prabhatkumar59
Copy link
Contributor

Hi @bnoordhuis- Thanks for your reply!
I will check and update you for "invoking cl.exe".
You are referring this original report- #6205 correct?

@bnoordhuis
Copy link
Author

Original report as in #10853 (comment)

@Prabhatkumar59
Copy link
Contributor

Thanks @bnoordhuis your reply. I will check and update for "invoking cl.exe".

@Prabhatkumar59
Copy link
Contributor

Hi @bnoordhuis - As per your issue description, i can summarise that invoking cl.exe is overly complicated and not easy though. Despite finding a workaround using vs-shell, the core challenge of setting up a straightforward, reliable environment for msvc tools remains unresolved."

However, as per my observation, in order to resolve the issue of msvc command line tools not being on %PATH%, you can try to use the following possibilities:-

  • You can try to manually Set Up the Environment Using vcvarsall.bat.
  • Also please make sure cl.exe is executed in the same shell session where vcvarsall.bat was called. This ensures that the environment variables set by vcvarsall.bat are available

These possible ways might be able to invoke cl.exe without relying on hard-coded paths.

@Prabhatkumar59
Copy link
Contributor

Hi @bnoordhuis - Since we haven't heard back, we'll assume your issue is resolved and will close this issue for now. Feel free to reach out to us for any other queries. Thanks.


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

No branches or pull requests

3 participants