actions / runner-images

GitHub Actions runner images
MIT License
10.19k stars 3.06k forks source link

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

Open bnoordhuis opened 3 weeks ago

bnoordhuis commented 3 weeks ago

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 https://github.com/quickjs-ng/quickjs/pull/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

Runner images affected

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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

Prabhatkumar59 commented 3 weeks ago

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

bnoordhuis commented 3 weeks ago

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 commented 2 weeks ago

Hi @bnoordhuis- Thanks for your reply! I will check and update you for "invoking cl.exe". You are referring this original report- https://github.com/actions/runner-images/issues/6205 correct?

bnoordhuis commented 2 weeks ago

Original report as in https://github.com/actions/runner-images/issues/10853#issue-2609660304

Prabhatkumar59 commented 2 weeks ago

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

Prabhatkumar59 commented 1 week ago

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:-

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