Subject: Re: bug#28601: 26.0.50; configure: error: Emacs does not support 'x86_64-pc-msys' systems.

From: [email-masked] (Vincent Belaïche)
Date: Thu, 19 Oct 2017 10:25:52 +0200

Answers inserted below...

Le 16/10/2017 à 23:42, Noam Postavsky a écrit :
> On Mon, Oct 16, 2017 at 1:11 PM, Vincent Belaïche
> <[email-masked]> wrote:
>
>> I does not work for me if I don't change MSWindows PATH. But the text
>> needs revision anyway because it does not say what has to be
>> ensured.
>>
>> What happens for me is that c:\MSYS\INSTALL\DIR\msys64\mingw64\bin has
>> to be high enough in the path list, otherwise Emacs gets frozen on
>> start.
>>
>> I have not fully identified how high it has to be. It seems that if it
>> is not before c:\Perl64\site\bin then the freeze happens (to be
>> confirmed by more tests). c:\Perl64\site\bin is some ActiveState native
>> perl implementation which contains a gcc.exe executable but no DLL's.
>
> I tried installing ActiveState perl, it adds this directory to PATH,
> but the directory is empty (so of course there is no effect).

Yes, this directory gets filled when you launch cpan, and install some
module which I can't remember. Anyway, ActiveState is not to be blamed,
I was a bit too quick in speculating that. After some dichotomy on the
position of c:\msys64\mingw64\bin in the PATH I found that the conflict
is with some c:\...\gtk\bin directory the content of which is as
follows:

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
c:\Nos_Programmes\gtk\bin>dir
dir
 Le volume dans le lecteur C n’a pas de nom.
 Le numéro de série du volume est AC5E-0292

 Répertoire de c:\Nos_Programmes\gtk\bin

18/05/2015  12:12    <DIR>          .
18/05/2015  12:12    <DIR>          ..
01/12/2013  14:25            24 525 autopoint
01/12/2013  14:38             1 538 croco-0.6-config
01/12/2013  14:25           143 837 envsubst.exe
01/12/2013  14:32            75 043 fc-cache.exe
01/12/2013  14:32            73 222 fc-cat.exe
01/12/2013  14:32            69 653 fc-list.exe
01/12/2013  14:32            71 841 fc-match.exe
01/12/2013  14:32            69 673 fc-pattern.exe
01/12/2013  14:32            68 340 fc-query.exe
01/12/2013  14:32            69 271 fc-scan.exe
01/12/2013  14:32             3 847 freetype-config
01/12/2013  14:31             1 380 gdbus-codegen
01/12/2013  14:31           105 157 gdbus.exe
01/12/2013  14:37            66 211 gdk-pixbuf-csource.exe
01/12/2013  14:37            64 161 gdk-pixbuf-pixdata.exe
01/12/2013  14:37            70 492 gdk-pixbuf-query-loaders.exe
01/12/2013  14:25           142 760 gettext.exe
01/12/2013  14:25             4 616 gettext.sh
01/12/2013  14:25            42 170 gettextize
01/12/2013  14:31            65 677 gio-querymodules.exe
01/12/2013  14:31           107 342 glib-compile-resources.exe
01/12/2013  14:31           118 257 glib-compile-schemas.exe
01/12/2013  14:31            90 048 glib-genmarshal.exe
01/12/2013  14:31             5 483 glib-gettextize
01/12/2013  14:31            17 968 glib-mkenums
01/12/2013  14:31            64 842 gobject-query.exe
01/12/2013  14:31            70 879 gresource.exe
01/12/2013  14:31            83 275 gsettings.exe
01/12/2013  14:31            66 125 gspawn-win64-helper-console.exe
01/12/2013  14:31            66 243 gspawn-win64-helper.exe
01/12/2013  15:05            68 226 gtk-query-immodules-3.0.exe
01/12/2013  15:05            99 034 gtk-update-icon-cache.exe
01/12/2013  15:05               585 gtk-update-icon-cache.exe.manifest
01/12/2013  15:05           192 548 gtk3-demo-application.exe
01/12/2013  15:05           516 715 gtk3-demo.exe
01/12/2013  15:05           145 457 gtk3-widget-factory.exe
01/12/2013  14:25            91 682 libasprintf-0.dll
01/12/2013  14:37           215 280 libatk-1.0-0.dll
01/12/2013  14:34           972 041 libcairo-2.dll
01/12/2013  14:34            73 310 libcairo-gobject-2.dll
01/12/2013  14:34           208 739 libcairo-script-interpreter-2.dll
01/12/2013  14:20            52 957 libcharset-1.dll
01/12/2013  14:38           338 000 libcroco-0.6-3.dll
01/12/2013  14:27            83 622 libffi-6.dll
01/12/2013  14:32           347 810 libfontconfig-1.dll
01/12/2013  14:32           752 539 libfreetype-6.dll
01/12/2013  15:05            93 389 libgailutil-3-0.dll
01/12/2013  15:05           870 852 libgdk-3-0.dll
01/12/2013  14:37           356 005 libgdk_pixbuf-2.0-0.dll
01/12/2013  14:25         1 401 627 libgettextlib-0-18-2.dll
01/12/2013  14:25           398 632 libgettextpo-0.dll
01/12/2013  14:25           320 913 libgettextsrc-0-18-2.dll
01/12/2013  14:31         1 789 609 libgio-2.0-0.dll
01/12/2013  14:31         1 513 572 libglib-2.0-0.dll
01/12/2013  14:31            64 399 libgmodule-2.0-0.dll
01/12/2013  14:31           403 969 libgobject-2.0-0.dll
01/12/2013  14:31            49 635 libgthread-2.0-0.dll
01/12/2013  15:05         6 317 774 libgtk-3-0.dll
01/12/2013  14:20         1 055 676 libiconv-2.dll
01/12/2013  14:25           154 337 libintl-8.dll
01/12/2013  14:35           449 890 libjasper-1.dll
01/12/2013  14:35           345 339 libjpeg-9.dll
01/12/2013  14:26           232 483 liblzma-5.dll
01/12/2013  14:35           439 347 libpango-1.0-0.dll
01/12/2013  14:35           142 951 libpangocairo-1.0-0.dll
01/12/2013  14:35         1 167 075 libpangoft2-1.0-0.dll
01/12/2013  14:35           147 550 libpangowin32-1.0-0.dll
01/12/2013  14:33         1 945 714 libpixman-1-0.dll
01/12/2013  14:32             2 348 libpng-config
01/12/2013  14:32           265 538 libpng15-15.dll
01/12/2013  14:32             2 348 libpng15-config
01/12/2013  15:07           362 691 librsvg-2-2.dll
01/12/2013  14:37           606 630 libtiff-5.dll
01/12/2013  14:27         1 740 678 libxml2-2.dll
01/12/2013  14:25           142 908 ngettext.exe
01/12/2013  14:35            72 342 pango-querymodules.exe
01/12/2013  14:35           121 526 pango-view.exe
01/12/2013  14:31           117 703 pkg-config.exe
01/12/2013  15:16            55 246 pthreadGC2.dll
01/12/2013  14:27             1 681 xml2-config
01/12/2013  14:27           145 311 xmllint.exe
01/12/2013  14:25            91 136 zlib1.dll
              82 fichier(s)       29 471 245 octets
               2 Rép(s)  101 430 677 504 octets libres

--8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----

I can't remember when and why I installed this, but this is what causes
the conflict, and placing c:\msys64\mingw64\bin just before it solves
it, and apparently did not change anything for the application which I
use on a regular basis.

I have not investigated further which DLL in this directory is the
conflict cause. What happens when PATH is incorrecly configured is that
at Emacs start-up the Emacs windows appears, it remains black and
everying is frozen (no keyboard events, no mouse event, to kill Emacs I
need to go to the MSWindows Task manager).

>
>>> Is there some reason you changed to a for loop?
>>>
>>
>> Yes, I had some packages already installed, and if I just type
>>
>> pacman -S msys/msys2-launcher-git \
>>           msys/m4 \
>>           msys/autoconf \
> [...]
>>
>> and I type ENTER for defaulting to « all » then it seems that pacman
>> does not really re-install anything. With a look thing are handled one
>> by one more cleanly, and it is easier for the user to discriminate.
>
> Yes, it seems that it hits an error trying to install
> mingw64/mingw-w64-x86_64-liblcms2, and then just quits. The error is
> somewhat lost in the noise:
>
> error: target not found: mingw-w64-x86_64-liblcms2
>
> It seems the name must be updated to mingw-w64-x86_64-lcms2.

I did that, and now it is fine w/o the loop.

>
> A drawback of the for loop method is that it is difficult to abort,
> even hitting Ctrl+C doesn't stop the loop, you have to hit it again
> for each package.

OK.

I attached a revised patch. I did not yet changed the section « **
Configure your MSYS2 PATH variable for application running from an
mingw64 console ». I will do a further edit about that. This section
will be renamed to « ** Check your MSYS2 PATH variable » and describe
just the checking, and the bulk of the section about editing ~/.bashrc
will be pushed to some « Trouble shooting » section, because, as I had
written, the real problem was my improrer hacking of /msys2_sell.cmd &
~/.bashrc scripts.

BTW, I have made one more comment to MSYS2 issue tracker with a revised
MSYS2 launcher MSDos script fixing this PATH initialization issue caused
by my previous hack:
https://github.com/msys2/msys2/issues/71#issuecomment-337727083

I don't know whether MSYS2 people will buy that, now there is the
launcher module. Yes, I still find that the MSDos script is useful for
getting finer control/understanding about the launch.

VBR,
	Vincent.

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64
index 4a93dc0..070ad34 100644
--- a/nt/INSTALL.W64
+++ b/nt/INSTALL.W64
@@ -29,24 +29,32 @@ build tools for MinGW-w64 -- see http://msys2.github.io/.
 You can download the x86_64 version of MSYS2 (i.e. msys2-x86_64-<date>.exe)
 from
 
-  https://sourceforge.net/projects/msys2/files/Base/x86_64
+	https://sourceforge.net/projects/msys2/files/Base/x86_64
 
 Run this file to install MSYS2 in your preferred directory, e.g. the default
 C:\msys64 -- this will install MinGW-w64 also.  Note that directory names
 containing spaces may cause problems.
 
+* Configure your MSWindows PATH variable
+
 Then you'll need to add the following directories to your Windows PATH
 environment variable:
 
   c:\msys64\usr\bin;c:\msys64\mingw64\bin
 
-you can do this through Control Panel / System and Security / System /
+where c:\msys64 depends on your MSYS2 installation, and is c:\msys64 by
+default.
+
+You can do this through Control Panel / System and Security / System /
 Advanced system settings / Environment Variables / Edit path.
 
 Adding these directories to your PATH tells Emacs where to find the DLLs it
 needs to run, and some optional commands like grep and find.  These commands
 will also be available at the Windows console.
 
+Concerning the find command see also the last step about configuring
+your init file to get an MSWindows find port.
+
 ** Download and install the necessary packages
 
 Run msys2_shell.bat in your MSYS2 directory and you will see a BASH window
@@ -55,25 +63,85 @@ opened.
 In the BASH prompt, use the following command to install the necessary
 packages (you can copy and paste it into the shell with Shift + Insert):
 
-  pacman -S base-devel \
-  mingw-w64-x86_64-toolchain \
-  mingw-w64-x86_64-xpm-nox \
-  mingw-w64-x86_64-libtiff \
-  mingw-w64-x86_64-giflib \
-  mingw-w64-x86_64-libpng \
-  mingw-w64-x86_64-libjpeg-turbo \
-  mingw-w64-x86_64-librsvg \
-  mingw-w64-x86_64-liblcms2 \
-  mingw-w64-x86_64-libxml2 \
-  mingw-w64-x86_64-gnutls \
-  mingw-w64-x86_64-zlib
+	pacman -S msys/msys2-launcher-git \
+	  msys/m4 \
+	  msys/autoconf \
+	  msys/grep \
+	  msys/findutils \
+	  mingw64/mingw-w64-x86_64-pkg-config \
+	  mingw64/mingw-w64-x86_64-make \
+	  mingw64/mingw-w64-x86_64-toolchain \
+	  mingw64/mingw-w64-x86_64-xpm-nox \
+	  mingw64/mingw-w64-x86_64-libtiff \
+	  mingw64/mingw-w64-x86_64-giflib \
+	  mingw64/mingw-w64-x86_64-libpng \
+	  mingw64/mingw-w64-x86_64-libjpeg-turbo \
+	  mingw64/mingw-w64-x86_64-librsvg \
+	  mingw64/mingw-w64-x86_64-lcms2 \
+	  mingw64/mingw-w64-x86_64-libxml2 \
+	  mingw64/mingw-w64-x86_64-gnutls \
+	  mingw64/mingw-w64-x86_64-zlib
+
+Answer Y (for yes) to all questions when the package is not up to date, and n
+(for no) otherwise.
 
 The packages include the base developer tools (autoconf, grep, make, etc.),
 the compiler toolchain (gcc, gdb, etc.), several image libraries, an XML
 library, the GnuTLS (transport layer security) library, and zlib for
-decompressing text.  Only the first three packages are required (base-devel,
-toolchain, xpm-nox); the rest are optional.  You can select only part of the
-libraries if you don't need them all.
+decompressing text.  Only the packages up to xpm-nox are required; the rest
+are optional.  You can select only part of the libraries if you don't need
+them all.
+
+** Check your MSYS2 fstab file
+
+Assuming that MSYS2 is installed in c:\msys64, make sure that your fstab file
+(c:\msys64\etc\fstab) file contains the following lines (starting a column 0
+in the fstab file):
+
+	c:/msys64/mingw64/bin /mingw64/bin ntfs binary,noacl 0 0
+	c:/msys64/mingw32/bin /mingw32/bin ntfs binary,noacl 0 0
+
+Please note that only the first line is needed for 64bit compilation, the
+second one is for a complete fstab file w.r.t. 32bit compilation.
+
+If there is a space in the diectory where MSYS2 is installed, it shall be
+replaced by \040. For instance, if MSYS is installed under "C:\Program
+Files\msys64" there must be this line:
+
+
+	C:/Program\040Files/msys64/mingw64/bin /mingw64/bin ntfs binary,noacl 0 0
+
+Anyway, avoiding to have any space in the path is preferable.
+
+** Configure your MSYS2 PATH variable for application running from an mingw64 console
+
+When you launch the mingw64.exe console from the c:\msys64, and type
+
+	echo "$PATH"
+
+You must have /mingw64/bin and /usr/bin in the paths list in this order.
+
+Otherwise, it means that for some reason your ~/.bashrc file has been edited
+to set the PATH from scratch, which is not the standard MSYS configuration.
+You will need to exit the MINGW64 console and edit your ~/.bashrc file, where
+~ denote c:\msys64\home\%USERNAME%, to have the correct PATH variable from
+any of MSYS/MINGW32/MINGW64 consoles, for instance, please make sure that
+~/.bashrc contains some statement like this:
+
+	case x$MSYSTEM in
+	    xMINGW64)
+		PATH="/mingw64/bin:/usr/bin:$PATH"
+	    ;;
+	    xMINGW32)
+		PATH="/mingw32/bin:/usr/bin:$PATH"
+	    ;;
+	    xMSYS)
+		PATH="/usr/bin:$PATH"
+	    ;;
+	esac
+
+Actually, for the Emacs build only the MINGW64 is useful. There could other
+cases for MSYSTEM envvar equal to MSYS or to MINGW32.
 
 You now have a complete build environment for Emacs.
 
@@ -126,8 +194,8 @@ Now you're ready to build and install Emacs with autogen, configure, make,
 and make install.
 
 First we need to switch to the MinGW-w64 environment.  Exit the MSYS2 BASH
-console and run mingw64_shell.bat in the C:\msys64 folder, then cd back to
-your Emacs source directory, e.g.:
+console and run mingw64.exe in the C:\msys64 folder, then cd back to your
+Emacs source directory, e.g.:
 
   cd /c/emacs/emacs-26
 
@@ -202,6 +270,39 @@ You can set any command line options by right clicking on the resulting
 shortcut, select Properties, then add any options to the Target command,
 e.g. --debug-init.
 
+* Configure your init file for Emacs to get a findutils windows port
+
+As far as find is concerned, at this stage you have configured the
+MSWindows PATH envvar to have c:\msys64\usr\bin in
+it.
+
+You should have done that in a way that c:\msys64\usr\bin is after
+C:\Windows\System32 in the PATH, otherwise the MSYS2 find.exe will be used
+instead of the MSWindows find.exe by other MSWindows application and this may
+cause some problem in your MSWindows environment --- although nobody has ever
+reported such a trouble.
+
+As far as Emacs is concerned, the lasy way is to use the MSYS2 find utility
+despit the PATH envvar by setting in your init file the following (where
+c:/msys64 has to be replaced with the directory where MSYS2 is installed):
+
+	(setq find-program "c:/msys64/usr/bin/find.exe")
+
+Actually, it is better to work a little bit more and use a MSWindows port
+rather than the MSYS find. See why here
+https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27393
+
+For instance this port can be used.
+
+https://sourceforge.net/projects/ezwinports/files/findutils-4.2.30-5-w64-bin.zip/download
+
+Then add to your init file lines like these :
+
+	(setq find-program "c:/PATH/TO/FIND/PORT/find.exe")
+
+where "c:/PATH/TO/FIND/PORT/" is the place where you have installed this find
+MSWindows port.
+
 * Credits
 
 Thanks to Chris Zheng for the original build outline as used by the