compnerd / gha-setup-swift

Setup Swift (on Windows) on GitHub Actions Builders
BSD 3-Clause "New" or "Revised" License
31 stars 11 forks source link

Moving from 0.2.1 to 0.2.3 caused editbin.exe to be unfindable #36

Open dabrahams opened 5 months ago

dabrahams commented 5 months ago

See https://github.com/hylo-lang/hylo/actions/runs/9357322028/job/26052808446#step:12:315

Possibly relevant: we setup-vsdevenv before setting up Swift; that used to be necessary but might now be obsolete?

dabrahams commented 5 months ago

Update: prior setup-vsdevenv is still needed; otherwise we pick up the wrong link.exe.

dabrahams commented 5 months ago

Update: the problem was introduced between 0.2.2 and 0.2.3; upgrading to 0.2.2 is no problem for us. Apparently it has something to do with changes to "vs2002 compatibility setup"

compnerd commented 5 months ago

CC: @kendalharland

kendalharland commented 5 months ago

Hi @dabrahams sorry for the breakage. This is likely because in the latest version I've removed an internal, implicit call to gha-setup-vsdevenv which happens on Windows after the Swift installation. IIRC the reason I skipped this action's internal call to gha-setup-vsdevenv is because it doesn't pass any inputs to gha-setup-vsdevenv, and so that internal call may overwrite values in the environment which were set by a prior call to gha-setup-vsdevenv. In particular the default values for gha-setup-vsdevenv's inputs arch (amd64) and host_arch (amd64) can be problematic, for example if building for or on an arm64 machine.

Does the problem go away if you add an additional, explicit call to gha-setup-vsdevenv with the default arguments, to replace the implicit call that was removed?

If that does not fix the issue, we may need to think about adding the call back, and accepting the same set of inputs as gha-setup-vsdevenv in this action so that the caller may pass them in to handle the case where the defaults differ from their preferred inputs. Another alternative is to expect callers that need something other than the default arguments to explicitly call gha-setup-vsdevenv a third time, after this action runs to override the defaults. Perhaps @compnerd has opinions on how to handle this.

dabrahams commented 5 months ago

Does the problem go away if you add an additional, explicit call to gha-setup-vsdevenv with the default arguments, to replace the implicit call that was removed?

I could try that… but I already need an explicit call to setup-vsdevenv before I set up Swift, or link.exe isn't found. So the whole magillah starts to look like a giant ball of hacks.

kendalharland commented 5 months ago

I understand the sentiment, but I think in this particular case, the cost of that one extra line to run gha-setup-vsdevenv again explicitly is a net improvement given that it clarifies what is happening after swift is installed.

compnerd commented 5 months ago

@dabrahams does adding -use-ld=lld to the Swift help remove the initial use of setup-vsdevenv? That would change the linker and avoid the dependency on link.exe, which is what the default behaviour is for SPM as well.