<div dir="ltr"><div>Hi Simon, Andrey</div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
<span><br>
> 3. After this step, starting a shell failed altogether with "c:/msys64/mingw64_shell.bat is<br>
> not recognised as an internal or external command". And sure enough, there is no such file.<br>
> Presumably it existed in step 1.  So perhaps step 2 deleted it?<br>
</span>> [...]<br>
<span>> 4. As you mention, I then tried msys2_shell.cmd.  It worked -- with a noticeable delay of 5<br>
> seconds or so.<br>
<br>
</span>I've also just got a new Win10 laptop and had the same issue with missing mingw64_shell.bat during msys2 install. I solved it by creating mingw64.bat with the following contents:<br>
<br>
msys2_shell.cmd -mingw64 -mintty<br>
<br>
I deleted all old shortcuts and use this script instead. Everything seems to work fine -- can build GHC.<br>
<br>
</blockquote></div><div><br></div><div>Yes this is correct, the msys2 team has decided to "streamline" all their different batch files to launch msys from 4 to 1, hence the only remaining one is msys2_shell.cmd which accepts arguments of which shell to open and using which console host.</div><div><br></div><div>Unfortunately this is done via their upgrade-core script and doesn't know how to remove the installer shortcuts, so you end up with dead shortcuts. </div><div><br></div><div>> 1.  I just left the machine for 10-15 mins and lo! the shell windows opened up. It just took a loooong time.<br>><br> > At this point, starting a new shell no longer took a long time.  It all seemed to be working.</div><div><br></div><div>First launch should be finishing setting up the environment so will take slightly longer, but shouldn't have taken that long. Could this be AV related?</div><div>I always add an exception to the AV (or the build in windows defender) for the msys2 folder to prevent it from scanning files continuously. Especially</div><div>building GHC this can slow things down considerably depending on the AV.</div><div><br></div><div><br></div><div>> 2.  I then ran pacman -Syuu as instructed on the installation page: <a href="https://sourceforge.net/p/msys2/wiki/MSYS2%20installation/" target="_blank" rel="noreferrer">https://sourceforge.net/p/msys2/wiki/MSYS2%20installation/</a><br>><br> > The log of what happened is below.  There are numerous failures involving Cygwin, which I do not have installed, at least not so far as I know.   I do not know if these failures matter.</div><div><br></div><div>These instructions are basically telling it to upgrade the world. They are however a bit wrong, <a href="https://github.com/Alexpux/MSYS2-packages/issues/373">https://github.com/Alexpux/MSYS2-packages/issues/373</a></div><div><br></div><div>msys2 is derived from Cygwin so it inherits much of the problems of Cygwin. The msys2 runtime is the Cygwin runtime with patches added which is why the errors mention Cygwin.</div><div><br></div><div>The issue is that the msys2-runtime has been upgraded by "pacman -Syuu" at which point a new "Cygwin" dll has been downloaded. However all Cygwin/msys2 runtimes share the same</div><div>address space and thus you can't have multiple versions of the same runtime loaded at once. This is why subsequent calls to anything relying on the msys2 runtime will fail with a weird</div><div>fork error. The solution is to just close all open msys2 window and re-open.</div><div><br></div><div>Our own instructions page <a href="https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows">https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows</a> breaks this down in a few steps to avoid this issue. 1) first update the packages and 2) only after that update the msys-core files.</div><div>But you will still need to restart the shell.</div><div><br></div><div>

<p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">> * should I worry about all those install errs</font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3"><br></font></p><p style="margin:0in 0in 0pt">No they're perfectly fine and expected. I would however re-run the pacman -Syu to make sure all packages were updated, now that the runtime has been updated already it shouldn't be updated again</p><p style="margin:0in 0in 0pt">and you shouldn't see any fork errors.</p><p style="margin:0in 0in 0pt"><br></p>

<p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">> * how can I debug what's happening with </font></p>

<p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">>  that long delay</font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3"><br></font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3">If it's only startup and not executing of other commands or bash completion then my bet would be AV software. If bash completion is slow or commands like ls as well</font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3">you may be hitting a long standing issue some computers have in which the domain controller is being hit for every invocation of commands, causing a slowdown <a href="https://github.com/Alexpux/MSYS2-packages/issues/138">https://github.com/Alexpux/MSYS2-packages/issues/138</a> , Solution 2 from <a href="https://gist.github.com/k-takata/9b8d143f0f3fef5abdab">https://gist.github.com/k-takata/9b8d143f0f3fef5abdab</a> seems to fix it for most people.</font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3"><br></font></p>

<p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">* Should I nuke the start menu shortcuts that</font></p>

<p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">  the msys64 installer
so carefully installed</font></p>

<p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">  in favour of
msys2_shell.cmd?</font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3"><br></font></p><p style="margin:0in 0in 0pt"><font color="rgb(0,0,0)" face="Calibri" size="3">Yes, these are now dead. you need to use msys2_shell.cmd but also pass it <font color="#222222" face="Arial">-mingw64 so it knows what shell to start. mintty is supposed to be the default, but in case that changes you can also pass it <font size="2">-mintty as well to be sure it doesn't change.</font></font></font></p><p style="margin:0in 0in 0pt"><br></p><p style="margin:0in 0in 0pt"><br></p><p style="margin:0in 0in 0pt">I am working on a script to automate this setup, hopefully that would make it easier next time!</p><p style="margin:0in 0in 0pt"><br></p><p style="margin:0in 0in 0pt">Cheers,</p><p style="margin:0in 0in 0pt">Tamar</p>

<font size="3"></font><br><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div class="gmail_extra"><br></div></div>