unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22240: Build instructions for 64-bit Windows?
@ 2015-12-25 22:49 Brian Burns
  2015-12-26  8:30 ` Eli Zaretskii
  2015-12-26  8:58 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Burns @ 2015-12-25 22:49 UTC (permalink / raw)
  To: 22240

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

I noticed recently that Emacs didn't have any build instructions for 64-bit
Windows - I tried the instructions for the 32-bit build in nt/INSTALL last
year [1] but something went wrong at some point (I don't remember what,
exactly). I tried again recently using the instructions from the Emacs-w64
project [2] which uses MSYS2 and MinGW-w64 - it worked well and it was also
easier to get the necessary libraries, as it has a package manager, pacman.

So I thought I would try adapting those instructions to include with Emacs,
if
it would be helpful - the author Chris Zheng said he wouldn't mind, and I
could
post it here or the devlist for feedback - it could go in a separate
INSTALL64
document, if the existing one is too long.

Are there any issues with using MSYS2 over MSYS? I think you can build a
32-bit
Emacs with MSYS2 also, but I'm not sure - if so it would be possible to
cover
both with one document, which might be simpler, but I could start with the
64-bit instructions anyway.

Brian Burns

[1] https://github.com/emacs-mirror/emacs/blob/master/nt/INSTALL
[2]
http://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/

[-- Attachment #2: Type: text/html, Size: 1475 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#22240: Build instructions for 64-bit Windows?
  2015-12-25 22:49 bug#22240: Build instructions for 64-bit Windows? Brian Burns
@ 2015-12-26  8:30 ` Eli Zaretskii
  2015-12-29  7:12   ` Brian Burns
  2015-12-26  8:58 ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-26  8:30 UTC (permalink / raw)
  To: Brian Burns; +Cc: 22240






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#22240: Build instructions for 64-bit Windows?
  2015-12-25 22:49 bug#22240: Build instructions for 64-bit Windows? Brian Burns
  2015-12-26  8:30 ` Eli Zaretskii
@ 2015-12-26  8:58 ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-26  8:58 UTC (permalink / raw)
  To: Brian Burns; +Cc: 22240

> From: Brian Burns <bburns.km@gmail.com>
> Date: Fri, 25 Dec 2015 16:49:55 -0600
> 
> I noticed recently that Emacs didn't have any build instructions for 64-bit
> Windows - I tried the instructions for the 32-bit build in nt/INSTALL last
> year [1] but something went wrong at some point (I don't remember what,
> exactly). I tried again recently using the instructions from the Emacs-w64
> project [2] which uses MSYS2 and MinGW-w64 - it worked well and it was also
> easier to get the necessary libraries, as it has a package manager, pacman.
> 
> So I thought I would try adapting those instructions to include with Emacs, if
> it would be helpful - the author Chris Zheng said he wouldn't mind, and I could
> post it here or the devlist for feedback - it could go in a separate INSTALL64
> document, if the existing one is too long.

It's OK to have a separate file, but then nt/INSTALL should say right
at the beginning that instructions for a 64-bit build are in that
file.

Also, if we are going to install this, we will need the full name and
email address of Chris Zheng, to give him credit.  The instructions
are short enough to consider them a "tiny change", so no legal
paperwork is necessary in this case.

> Are there any issues with using MSYS2 over MSYS? I think you can build a 32-bit
> Emacs with MSYS2 also, but I'm not sure - if so it would be possible to cover
> both with one document, which might be simpler, but I could start with the
> 64-bit instructions anyway.

I'm okay with saying that MSYS2 instructions cover the 32-bit build as
well, but they require installing a different toolchain, so I think
the current instructions should stay, at least for those who prefer
mingw.org's tools and the optional libraries pointed to in INSTALL,
which were all compiled using mingw.org's tools (I have no idea
whether some subtle incompatibilities might exist between the binaries
produced by the two toolchains).

> [1] https://github.com/emacs-mirror/emacs/blob/master/nt/INSTALL
> [2]
> http://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/

Finally, I have some comments on the MSYS2 instructions, if they are
to be added to the repository:

  . The "Get the source code" section should be rewritten to cater
    both to those who build from the Git repository (and it's better
    to refer those to the corresponding Savannah page, like nt/INSTALL
    does, than to repeat the URL, which might become outdated, in the
    file), and those who build from a source tarball of an official
    release.

  . The "configure; make; make install" section should avoid showing
    non-essential switches to configure, except as an example: users
    should decide by themselves what switches to use.  Specifically:

    . the --host, --target, and --build switches should not be needed
      at all, ever
    . the --with-wide-int switch is a no-op in a 64-bit build
    . the --with-png and other similar switches should not be used at
      all, since configure will detect whatever libraries are
      available by default (only the corresponding --without-FOO
      switches should ever be used to _disable_ a package that would
      otherwise be detected)
    . the --prefix should be on the configure command, and it should
      NOT advise any particular location (there's a discussion in
      nt/INSTALL where PREFIX should be, and I suggest to either
      repeat it or point to it, because I believe the same
      considerations are valid for a MinGW64 build; if MinGW64 has a
      popular location of the root of its tree, the preferred PREFIX
      should use it)
    . the 'cp' commands I don't understand at all: if PREFIX is chosen
      correctly, the Emacs's bin/ directory and the MinGW64's bin/
      directory should be the same, so there's no need to copy; and
      even if these two bin/ directories are different, the directory
      with DLLs should be on PATH.  this sounds like some workaround
      for some misconfiguration, so we had better not repeated that.

  . The "Run" section doesn't belong in installation instructions.

I invite people who use MinGW64 to build Emacs to please send their
comments and observations about the build, so that they could be
reflected in what we install, if needed.

Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#22240: Build instructions for 64-bit Windows?
  2015-12-26  8:30 ` Eli Zaretskii
@ 2015-12-29  7:12   ` Brian Burns
  2015-12-29 17:33     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Burns @ 2015-12-29  7:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Chris Zheng, 22240

[-- Attachment #1: Type: text/plain, Size: 11472 bytes --]

Okay thanks, here's a rough draft for the instructions - it's also in a
Gist at
https://gist.github.com/bburns/43c9f170361aecee3b71 if anyone wants to make
any
changes that way.

I did wind up writing more than I thought I would, but I sent in my signed
paperwork last week in case I needed it.

> The "configure; make; make install" section should avoid showing
> non-essential switches to configure, except as an example: users
> should decide by themselves what switches to use.

Okay, I made it more clear that they were examples.

> the --host, --target, and --build switches should not be needed

I tried running configure without the '--host=x86_64-w64-mingw32' etc
switches
but got an error:

    configure: error: Emacs does not support 'x86_64-pc-msys' systems.
    If you think it should, please send a report to bug-gnu-emacs@gnu.org.
    Check 'etc/MACHINES' for recognized configuration names.

but the MACHINES file says to see the nt/INSTALL document, which doesn't
cover
the 64-bit options. So I left them in for the moment - I can file a bug
report
for that also if needed.

> . the --with-wide-int switch is a no-op in a 64-bit build
> . the --with-png and other similar switches should not be used at
> all, since configure will detect whatever libraries are
> available by default (only the corresponding --without-FOO
> switches should ever be used to _disable_ a package that would
> otherwise be detected)

Okay, removed those.

> the --prefix should be on the configure command, and it should
> NOT advise any particular location (there's a discussion in
> nt/INSTALL where PREFIX should be, and I suggest to either
> repeat it or point to it, because I believe the same
> considerations are valid for a MinGW64 build; if MinGW64 has a
> popular location of the root of its tree, the preferred PREFIX
> should use it)

Okay, I put the --prefix on the configure command, but I think it would be
good
if the instructions included a simple example, and refer the user to the
INSTALL
instructions for more options - part of the reason I think my earlier
attempts
at building Emacs failed were because the instructions in INSTALL didn't
have an
example to follow, and coming from Windows I'm not very familiar with
building
from source, so having the example in Chris's instructions to follow were
very
helpful.

> the 'cp' commands I don't understand at all: if PREFIX is chosen
> correctly, the Emacs's bin/ directory and the MinGW64's bin/
> directory should be the same, so there's no need to copy; and
> even if these two bin/ directories are different, the directory
> with DLLs should be on PATH.  this sounds like some workaround
> for some misconfiguration, so we had better not repeated that.

I think this was in part because MSYS2 doesn't add its folders to the PATH,
and
if you use the PATH variable there might be both 32-bit and 64-bit DLLs on
it,
so in that case it's better to have the DLLs in the directory with the
executable - they're only about 32MB. But I removed this section and just
said
to add the folders to the PATH, and if there's a conflict to copy the DLLs
to
the bin folder.

> The "Run" section doesn't belong in installation instructions.

I think it might be good to include a simple Test section that just says to
run emacs with

      ./bin/runemacs.exe -Q

to check that it works - mainly because a Windows user might tend to launch
Emacs from a shortcut on the desktop and might be unused to launching it
from the console, so a simple line like that might be helpful.

Any corrections or additions are welcome - I'm a novice at building things
like this so am not sure what a more advanced user might want to see.

Brian

---------------------


               Building and Installing Emacs on 64-bit MS-Windows
                           using MSYS2 and MinGW-w64

               Copyright (c) 2015 Free Software Foundation, Inc.
                See the end of the file for license conditions.

This document describes how to compile a 64-bit GNU Emacs using MSYS2 and
MinGW-w64.  For more detailed information on the build process, and
instructions
for building a 32-bit Emacs using MSYS and MinGW, see the INSTALL document
in
this directory.

Do not use this recipe with Cygwin.  For building on Cygwin, use the normal
installation instructions in ../INSTALL.


* Requirements

  The total time to download all tools and build Emacs is approximately 90
  minutes on an Intel i3 processor, and 3GB of free space is required
(1.8GB for
  MSYS2 / MinGW-w64 and 1.2GB for Emacs with the full repository).

  Approximate times for the first pass through each step are given - to time
  them yourself you can precede any BASH command with 'time'.


* Set up the MinGW-w64 / MSYS2 build environment                       [25
mins]

  MinGW-w64 provides a complete runtime for projects built with gcc for
64-bit
  Windows - it's located at https://sourceforge.net/projects/mingw-w64/.

  MSYS2 is a Cygwin-derived software distribution for Windows which provides
  build tools for MinGW-w64 - see https://sourceforge.net/projects/msys2/.


** Download and install MinGW-w64 and MSYS2                             [5
mins]

  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

  Run this file to install MSYS2 in your preferred directory, e.g. the
default
  C:\msys64 - this will install MinGW-w64 also.  Note that a path containing
  spaces may cause problems.

  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 the usual Control Panel / System and Security /
  System / Advanced system settings / Environment Variables / Edit path.

  Note: If you've already installed a 32-bit MinGW and have it on your path
  you might need to either remove it from the path, or after building the
  Emacs executable, copy the MinGW-w64 DLLs in /mingw64/bin/ to the new
  Emacs bin folder - they're about 32MB.


** Download and install the necessary packages                         [20
mins]

  Run msys2_shell.bat in your MSYS2 directory and you will see a BASH window
  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-libxml2 \
      mingw-w64-x86_64-gnutls

  The packages include the base developer tools (autoconf, automake, grep,
make,
  etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries,
an
  xml library, and the GnuTLS (transport layer security) library.

  You now have a complete build environment for Emacs.


* Install git (optional) and disable autocrlf                           [2
mins]

  If you don't already have git on your system, you can install it in your
MSYS2
  environment with:

      pacman -S git

  The autocrlf feature of Git may interfere with the configure file, so it
is
  best to disable this feature by running the command:

      git config core.autocrlf false


* Get the Emacs source code                                            [15
mins]

  Now you can either get an existing release version of the Emacs source
code
  from the GNU ftp site, or get the more current version and history from
the
  git repository.

  You can always find the most recent information on these sources from the
GNU
  Savannah Emacs site, https://savannah.gnu.org/projects/emacs.


** From the FTP site                                                     [1
min]

  The Emacs ftp site is located at http://ftp.gnu.org/gnu/emacs/ - download
the
  version you want to build and put the file into a location like C:\emacs\,
  then uncompress it with tar and cd into the folder. This will put the
Emacs
  source into a folder like C:\emacs\emacs-24.5:

      cd /c/emacs
      tar xf emacs-24.5.tar.xz
      cd emacs-24.5


** From the git repository                                             [15
mins]

  To download the git repository, do something like the following - this
will
  put the Emacs source into C:\emacs\emacs-25:

      mkdir /c/emacs
      cd /c/emacs
      git clone git://git.sv.gnu.org/emacs.git emacs-25
      cd emacs-25


* Build Emacs                                                          [45
mins]

  Now you're ready to build and install Emacs with autogen, configure,
make,
  and make install.


** Run autogen                                                           [1
min]

  Run autogen to generate the configure script (note: this step is not
necessary
  if you are using a release source tarball, as the configure file is
included):

      ./autogen.sh


** Run configure                                                        [4
mins]

  Now you can run configure, which will build the various Makefiles.  The
  following is a simple example for some configure options - see the INSTALL
  file in this directory for more information on the options available.

  Note that the --prefix option specifies a location for the resulting
binary
  files, which 'make install' will use - if a prefix is not specified the
files
  will be put in the standard MinGW-w64 directories.

  Note also that we need to disable Imagemagick because Emacs does not yet
  support it in Windows.

      PKG_CONFIG_PATH=/mingw64/lib/pkgconfig \
      ./configure \
      --prefix=/c/emacs/emacs-25 \
      --host=x86_64-w64-mingw32 \
      --target=x86_64-w64-mingw32 \
      --build=x86_64-w64-mingw32 \
      --without-imagemagick


** Run make                                                            [30
mins]

  This will compile Emacs and build the executables, putting them in the src
  directory:

      make


** Run make install                                                     [6
mins]

  Now you can run make install, which will copy the executable and other
files
  to the location specified in the configure step:

      make install


* Test Emacs

  To test it out, run

      ./bin/runemacs.exe -Q

  and if all went well, you will have a new 64-bit version of Emacs.


* Credits

  Thanks to Chris Zheng <chriszheng99@gmail.com> for the original build
outline
  as used by the emacsbinw64 project, located at:


https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/


* License

  This file is part of GNU Emacs.

  GNU Emacs is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GNU Emacs is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.


* Emacs settings

Local Variables:
mode: org
sentence-end-double-space: t
End:





On Sat, Dec 26, 2015 at 2:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:

>

[-- Attachment #2: Type: text/html, Size: 14502 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#22240: Build instructions for 64-bit Windows?
  2015-12-29  7:12   ` Brian Burns
@ 2015-12-29 17:33     ` Eli Zaretskii
  2015-12-30  7:08       ` Brian Burns
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-29 17:33 UTC (permalink / raw)
  To: Brian Burns; +Cc: chriszheng99, 22240

> From: Brian Burns <bburns.km@gmail.com>
> Date: Tue, 29 Dec 2015 01:12:51 -0600
> Cc: 22240@debbugs.gnu.org, Chris Zheng <chriszheng99@gmail.com>
> 
> Okay thanks, here's a rough draft for the instructions

Thanks.  Allow me a few comments.

> > the --host, --target, and --build switches should not be needed
> 
> I tried running configure without the '--host=x86_64-w64-mingw32' etc switches
> but got an error:
> 
> configure: error: Emacs does not support 'x86_64-pc-msys' systems.
> If you think it should, please send a report to bug-gnu-emacs@gnu.org.
> Check 'etc/MACHINES' for recognized configuration names.
> 
> but the MACHINES file says to see the nt/INSTALL document, which doesn't cover
> the 64-bit options. So I left them in for the moment - I can file a bug report
> for that also if needed.

Please do file a bug report.  Users shouldn't need to specify the host
for supported systems.

It's also worthwhile to report this to MSYS2 developers, I think: that
string is not the canonical host description for MinGW64, it's for
building an MSYS program, which is not what is going on here.

> Okay, I put the --prefix on the configure command, but I think it would be good
> if the instructions included a simple example, and refer the user to the
> INSTALL
> instructions for more options

Sorry, I don't understand: this _is_ INSTALL, isn't it?  And the
current INSTALL does include a couple of examples.  What am I missing?

> > the 'cp' commands I don't understand at all: if PREFIX is chosen
> > correctly, the Emacs's bin/ directory and the MinGW64's bin/
> > directory should be the same, so there's no need to copy; and
> > even if these two bin/ directories are different, the directory
> > with DLLs should be on PATH. this sounds like some workaround
> > for some misconfiguration, so we had better not repeated that.
> 
> I think this was in part because MSYS2 doesn't add its folders to the PATH, and
> if you use the PATH variable there might be both 32-bit and 64-bit DLLs on it,

But that's a problem MSYS2 and MinGW64 should have solved already,
right?  IOW, it's not something specific to Emacs.

> > The "Run" section doesn't belong in installation instructions.
> 
> I think it might be good to include a simple Test section that just says to 
> run emacs with
> 
> ./bin/runemacs.exe -Q
> 
> to check that it works - mainly because a Windows user might tend to launch 
> Emacs from a shortcut on the desktop and might be unused to launching it
> from the console, so a simple line like that might be helpful.

I indeed think that the instructions should tell how to create a
desktop shortcut for running Emacs.

> Any corrections or additions are welcome - I'm a novice at building things 
> like this so am not sure what a more advanced user might want to see. 

See below for some more.

> * Requirements
> 
> The total time to download all tools and build Emacs is approximately 90
> minutes on an Intel i3 processor, and 3GB of free space is required (1.8GB for
> MSYS2 / MinGW-w64 and 1.2GB for Emacs with the full repository).
> 
> Approximate times for the first pass through each step are given - to time
> them yourself you can precede any BASH command with 'time'.

I would suggest removing this time information: it is very
system-dependent, and can also change radically depending on your
network access speed.  nt/INSTALL doesn't have such information, and I
don't recall anyone ever complaining.

> Run this file to install MSYS2 in your preferred directory, e.g. the default
> C:\msys64 - this will install MinGW-w64 also. Note that a path containing
> spaces may cause problems.

GNU Coding Standards frown upon using "path" for anything except
PATH-style lists of directories.  Please use "file names" or
"directory name" instead.

Also, please keep 2 spaces between sentences, as we use the US English
conventions in GNU documentation.

> 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-libxml2 \
> mingw-w64-x86_64-gnutls
> 
> The packages include the base developer tools (autoconf, automake, grep, make,
> etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries, an
> xml library, and the GnuTLS (transport layer security) library.

Here I would say that the user can omit some or all of the optional
libraries (all but the first 3), if they so wish.

> * Install git (optional) and disable autocrlf [2 mins]

This section should say that Git is only needed if the user wants to
build the development version.

> Note that the --prefix option specifies a location for the resulting binary
> files, which 'make install' will use - if a prefix is not specified the files
> will be put in the standard MinGW-w64 directories.

No, if --prefix is not specified, the files will be installed in the
standard _Unix_ directories, not standard MinGW-w64 directories.

> ** Run make [30 mins]

This takes 4 min on my system, for the full bootstrap (building a
release tarball is much faster).  I guess you didn't use "make -j8" or
some such.  See, this is why these times are not such a good idea.

> ** Run make install [6 mins]

Takes something like 2 min here.

> Now you can run make install, which will copy the executable and other files 
> to the location specified in the configure step:
> 
> make install

One can also say

  make install prefix=/wherever

to install in a different place.

> * Emacs settings
> 
> Local Variables:
> mode: org
> sentence-end-double-space: t
> End:

This should be preceded by a Ctrl-L character, since Emacs looks for
the file-local variables in the last page of the file.

Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#22240: Build instructions for 64-bit Windows?
  2015-12-29 17:33     ` Eli Zaretskii
@ 2015-12-30  7:08       ` Brian Burns
  2015-12-31 17:01         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Burns @ 2015-12-30  7:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Chris Zheng, 22240

[-- Attachment #1: Type: text/plain, Size: 16232 bytes --]

Thanks for the feedback - the updated file is included at the end and at
https://gist.github.com/bburns/43c9f170361aecee3b71 - Chris added a
few comments there.

>> I tried running configure without the '--host=x86_64-w64-mingw32' etc
switches
>> but got an error:
>> configure: error: Emacs does not support 'x86_64-pc-msys' systems.

This turned out to be due to not being in the right environment - I added
the
step to switch to the MinGW-w64 environment and now it works without
specifying
the --host, etc.

> Sorry, I don't understand: this _is_ INSTALL, isn't it?  And the
> current INSTALL does include a couple of examples.  What am I missing?

At the moment, this is a separate file - e.g. it could be nt/INSTALL64,
though
if we wanted we could merge them.

When I tried using the nt/INSTALL instructions last year I was mostly
confused
about the --prefix option - I didn't understand what was meant by build
inside
or outside the source tree, and the example given, /d/usr, was a bit
foreign to
me as a place to store programs, so Chris's example was easier to follow. I
tried to keep these instructions simple also, but referred the user to the
nt/INSTALL file for more information in a couple of places.

>> I think this was in part because MSYS2 doesn't add its folders to the
PATH, and
>> if you use the PATH variable there might be both 32-bit and 64-bit DLLs
on it,
> But that's a problem MSYS2 and MinGW64 should have solved already,
> right?  IOW, it's not something specific to Emacs.

Okay, straightened that out a bit, now it says

  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.

> I indeed think that the instructions should tell how to create a
> desktop shortcut for running Emacs.
> I would suggest removing this time information

Okay, added a section for making a shortcut, and removed the time info.

> I guess you didn't use "make -j8" or some such.

That's a good option to include - I added it to the make section.

Thanks again for your help -

Brian

------------

               Building and Installing Emacs on 64-bit MS-Windows
                           using MSYS2 and MinGW-w64

               Copyright (c) 2015 Free Software Foundation, Inc.
                See the end of the file for license conditions.

This document describes how to compile a 64-bit GNU Emacs using MSYS2 and
MinGW-w64.  For more detailed information on the build process, and
instructions
for building a 32-bit Emacs using MSYS and MinGW, see the INSTALL document
in
this directory.

Do not use this recipe with Cygwin.  For building on Cygwin, use the normal
installation instructions in ../INSTALL.


* Requirements

  The total space required is 3GB: 1.8GB for MSYS2 / MinGW-w64 and 1.2GB for
  Emacs with the full repository, or less if you're using a release tarball.


* Set up the MinGW-w64 / MSYS2 build environment

  MinGW-w64 provides a complete runtime for projects built with gcc for
64-bit
  Windows - it's located at http://mingw-w64.org/.

  MSYS2 is a Cygwin-derived software distribution for Windows which provides
  build tools for MinGW-w64 - see http://msys2.github.io/.


** Download and install MinGW-w64 and MSYS2

  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

  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.

  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 /
  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.


** Download and install the necessary packages

  Run msys2_shell.bat in your MSYS2 directory and you will see a BASH window
  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-libxml2 \
      mingw-w64-x86_64-gnutls

  The packages include the base developer tools (autoconf, automake, grep,
make,
  etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries,
an
  xml library, and the GnuTLS (transport layer security) library.  Only the
  first three packages are required (base-devel, toolchain, xpm-nox) - the
rest
  are optional.

  You now have a complete build environment for Emacs.


* Install git (optional) and disable autocrlf

  If you're going to be building the development version of Emacs from the
git
  repository, and you don't already have git on your system, you can
install it
  in your MSYS2 environment with:

      pacman -S git

  The autocrlf feature of Git may interfere with the configure file, so it
is
  best to disable this feature by running the command:

      git config core.autocrlf false


* Get the Emacs source code

  Now you can either get an existing release version of the Emacs source
code
  from the GNU ftp site, or get the more current version and history from
the
  git repository.

  You can always find the most recent information on these sources from the
GNU
  Savannah Emacs site, https://savannah.gnu.org/projects/emacs.


** From the FTP site

  The Emacs ftp site is located at http://ftp.gnu.org/gnu/emacs/ - download
the
  version you want to build and put the file into a location like C:\emacs\,
  then uncompress it with tar. This will put the Emacs source into a folder
like
  C:\emacs\emacs-24.5:

      cd /c/emacs
      tar xf emacs-24.5.tar.xz


** From the git repository

  To download the git repository, do something like the following - this
will
  put the Emacs source into C:\emacs\emacs-25:

      mkdir /c/emacs
      cd /c/emacs
      git clone git://git.sv.gnu.org/emacs.git emacs-25


* Build Emacs

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

      cd /c/emacs/emacs-25


** Run autogen

  Run autogen to generate the configure script (note: this step is not
necessary
  if you are using a release source tarball, as the configure file is
included):

      ./autogen.sh


** Run configure

  Now you can run configure, which will build the various Makefiles - note
that
  the example given here is just a simple one - for more information on the
  options available please see the nt/INSTALL file.

  The --prefix option specifies a location for the resulting binary files,
which
  'make install' will use - in this example we set it to C:\emacs\emacs-25.
If a
  prefix is not specified the files will be put in the standard Unix
directories
  located in your C:\msys64 directory, but this is not recommended.

  Note also that we need to disable Imagemagick because Emacs does not yet
  support it on Windows.

      PKG_CONFIG_PATH=/mingw64/lib/pkgconfig \
      ./configure \
      --prefix=/c/emacs/emacs-25 \
      --without-imagemagick


** Run make

  This will compile Emacs and build the executables, putting them in the src
  directory:

      make

  To speed up the process, you can try running

      make -jN

  where N is the number of cores in your system - if your MSYS2 make
supports
  parallel execution it will run significantly faster.


** Run make install

  Now you can run make install, which will copy the executable and other
files
  to the location specified in the configure step.  This will create the
bin,
  libexec, share, and var directories:

      make install

  You can also say

      make install prefix=/c/somewhere

  to install them somewhere else.


* Test Emacs

  To test it out, run

      ./bin/runemacs.exe -Q

  and if all went well, you will have a new 64-bit version of Emacs.


* Make a shortcut

  To make a shortcut to run the new Emacs, right click on the location
where you
  want to put it, e.g. the Desktop, select New / Shortcut, then select
  runemacs.exe in the bin folder of the new Emacs, and give it a name.

  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.


* Credits

  Thanks to Chris Zheng for the original build outline as used by the
  emacsbinw64 project, located at:


https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/


* License

  This file is part of GNU Emacs.

  GNU Emacs is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GNU Emacs is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.



On Tue, Dec 29, 2015 at 11:33 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Brian Burns <bburns.km@gmail.com>
> > Date: Tue, 29 Dec 2015 01:12:51 -0600
> > Cc: 22240@debbugs.gnu.org, Chris Zheng <chriszheng99@gmail.com>
> >
> > Okay thanks, here's a rough draft for the instructions
>
> Thanks.  Allow me a few comments.
>
> > > the --host, --target, and --build switches should not be needed
> >
> > I tried running configure without the '--host=x86_64-w64-mingw32' etc
> switches
> > but got an error:
> >
> > configure: error: Emacs does not support 'x86_64-pc-msys' systems.
> > If you think it should, please send a report to bug-gnu-emacs@gnu.org.
> > Check 'etc/MACHINES' for recognized configuration names.
> >
> > but the MACHINES file says to see the nt/INSTALL document, which doesn't
> cover
> > the 64-bit options. So I left them in for the moment - I can file a bug
> report
> > for that also if needed.
>
> Please do file a bug report.  Users shouldn't need to specify the host
> for supported systems.
>
> It's also worthwhile to report this to MSYS2 developers, I think: that
> string is not the canonical host description for MinGW64, it's for
> building an MSYS program, which is not what is going on here.
>
> > Okay, I put the --prefix on the configure command, but I think it would
> be good
> > if the instructions included a simple example, and refer the user to the
> > INSTALL
> > instructions for more options
>
> Sorry, I don't understand: this _is_ INSTALL, isn't it?  And the
> current INSTALL does include a couple of examples.  What am I missing?
>
> > > the 'cp' commands I don't understand at all: if PREFIX is chosen
> > > correctly, the Emacs's bin/ directory and the MinGW64's bin/
> > > directory should be the same, so there's no need to copy; and
> > > even if these two bin/ directories are different, the directory
> > > with DLLs should be on PATH. this sounds like some workaround
> > > for some misconfiguration, so we had better not repeated that.
> >
> > I think this was in part because MSYS2 doesn't add its folders to the
> PATH, and
> > if you use the PATH variable there might be both 32-bit and 64-bit DLLs
> on it,
>
> But that's a problem MSYS2 and MinGW64 should have solved already,
> right?  IOW, it's not something specific to Emacs.
>
> > > The "Run" section doesn't belong in installation instructions.
> >
> > I think it might be good to include a simple Test section that just says
> to
> > run emacs with
> >
> > ./bin/runemacs.exe -Q
> >
> > to check that it works - mainly because a Windows user might tend to
> launch
> > Emacs from a shortcut on the desktop and might be unused to launching it
> > from the console, so a simple line like that might be helpful.
>
> I indeed think that the instructions should tell how to create a
> desktop shortcut for running Emacs.
>
> > Any corrections or additions are welcome - I'm a novice at building
> things
> > like this so am not sure what a more advanced user might want to see.
>
> See below for some more.
>
> > * Requirements
> >
> > The total time to download all tools and build Emacs is approximately 90
> > minutes on an Intel i3 processor, and 3GB of free space is required
> (1.8GB for
> > MSYS2 / MinGW-w64 and 1.2GB for Emacs with the full repository).
> >
> > Approximate times for the first pass through each step are given - to
> time
> > them yourself you can precede any BASH command with 'time'.
>
> I would suggest removing this time information: it is very
> system-dependent, and can also change radically depending on your
> network access speed.  nt/INSTALL doesn't have such information, and I
> don't recall anyone ever complaining.
>
> > Run this file to install MSYS2 in your preferred directory, e.g. the
> default
> > C:\msys64 - this will install MinGW-w64 also. Note that a path containing
> > spaces may cause problems.
>
> GNU Coding Standards frown upon using "path" for anything except
> PATH-style lists of directories.  Please use "file names" or
> "directory name" instead.
>
> Also, please keep 2 spaces between sentences, as we use the US English
> conventions in GNU documentation.
>
> > 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-libxml2 \
> > mingw-w64-x86_64-gnutls
> >
> > The packages include the base developer tools (autoconf, automake, grep,
> make,
> > etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries,
> an
> > xml library, and the GnuTLS (transport layer security) library.
>
> Here I would say that the user can omit some or all of the optional
> libraries (all but the first 3), if they so wish.
>
> > * Install git (optional) and disable autocrlf [2 mins]
>
> This section should say that Git is only needed if the user wants to
> build the development version.
>
> > Note that the --prefix option specifies a location for the resulting
> binary
> > files, which 'make install' will use - if a prefix is not specified the
> files
> > will be put in the standard MinGW-w64 directories.
>
> No, if --prefix is not specified, the files will be installed in the
> standard _Unix_ directories, not standard MinGW-w64 directories.
>
> > ** Run make [30 mins]
>
> This takes 4 min on my system, for the full bootstrap (building a
> release tarball is much faster).  I guess you didn't use "make -j8" or
> some such.  See, this is why these times are not such a good idea.
>
> > ** Run make install [6 mins]
>
> Takes something like 2 min here.
>
> > Now you can run make install, which will copy the executable and other
> files
> > to the location specified in the configure step:
> >
> > make install
>
> One can also say
>
>   make install prefix=/wherever
>
> to install in a different place.
>
> > * Emacs settings
> >
> > Local Variables:
> > mode: org
> > sentence-end-double-space: t
> > End:
>
> This should be preceded by a Ctrl-L character, since Emacs looks for
> the file-local variables in the last page of the file.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 19545 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#22240: Build instructions for 64-bit Windows?
  2015-12-30  7:08       ` Brian Burns
@ 2015-12-31 17:01         ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-31 17:01 UTC (permalink / raw)
  To: Brian Burns; +Cc: chriszheng99, 22240-done

> From: Brian Burns <bburns.km@gmail.com>
> Date: Wed, 30 Dec 2015 01:08:38 -0600
> Cc: 22240@debbugs.gnu.org, Chris Zheng <chriszheng99@gmail.com>
> 
> Thanks for the feedback - the updated file is included at the end and at
> https://gist.github.com/bburns/43c9f170361aecee3b71 - Chris added a 
> few comments there. 

Thanks, pushed to the emacs-25 branch.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-31 17:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-25 22:49 bug#22240: Build instructions for 64-bit Windows? Brian Burns
2015-12-26  8:30 ` Eli Zaretskii
2015-12-29  7:12   ` Brian Burns
2015-12-29 17:33     ` Eli Zaretskii
2015-12-30  7:08       ` Brian Burns
2015-12-31 17:01         ` Eli Zaretskii
2015-12-26  8:58 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).