Repository navigation
wasm: find emcc by the name the platform actually installs - #2629
Merged
Merged
Conversation
DoRun builds the shell invocation for .ShellCommand, setting cmd.exe and '/s /c "<exe> <args>"', and then the args file block below it overwrites the arguments with '@tempfile'. cmd.exe is left with no '/c', so it opens an interactive prompt and the build waits on it forever. The two have never been combinable; nothing set .ShellCommand until now, so nothing hit it. The substitution now happens first, into 'effArgs', and the shell and batch wrappings consume that, giving 'cmd /s /c "<exe> @tempfile"'. Behaviour without .ShellCommand or .BatchCommand is unchanged: the same arguments are set from the same inputs, just earlier. Also deletes the previous mTempFileName in the batch branch before replacing it, which the args file branch already did and which leaked otherwise.
The emsdk that fetch_wasm.bat unpacks has an emcc.exe, and the link path and
the $(EmccPath) macro were both written against it. An emsdk installed from
upstream ships emcc.bat, emcc.ps1 and emcc.py on Windows and no .exe at all, so
pointing Beef at one made the link fail its existence check before it started:
Emscripten compiler not found at '...\upstream\emscripten\emcc.exe'
which is the configuration beefytech#2523 added support for. Naming emcc.bat is not
enough on its own either, since a .bat cannot be spawned directly; the queued
run has to go through a shell, which ExecutionQueueCmd could already express
through mRunFlags but nothing set.
Both sites now go through GetEmccPath, which takes the emsdk root and reports
what is there: emcc.exe, else emcc.bat with 'needs a shell', else a plain emcc
off Windows. The link passes .ShellCommand when told to; $(EmccPath) needs no
flag, as ExecuteRaw already shells anything not ending in .exe.
$(EmccPath) also had no platform guard, so it named an emcc.exe that cannot
exist when the wasm32 config is built from a POSIX host.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The wasm link step and the
$(EmccPath)macro both expectedupstream/emscripten/emcc.exe. That's what the emsdk fromfetch_wasm.bathas, but an emsdk installed from upstream ships onlyemcc.bat,emcc.ps1andemcc.pyon Windows. Pointing Beef at one (which #2523 added support for) failed before linking:$(EmccPath)also hardcoded.exeon every platform.Both now go through
BuildContext.GetEmccPath, which takesemcc.exe, or elseemcc.batand reports that it needs a shell, on Windows, and a plainemccelsewhere. A.batcan't be spawned directly, so the link step sets.ShellCommandwhen needed.Depends on #2533. A shell-wrapped run with an args file left
cmd.exeat an interactive prompt, and this is the first change that sets.ShellCommand. This branch includes #2533's commit until that merges.