unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Brian Burns <bburns.km@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Chris Zheng <chriszheng99@gmail.com>, 22240@debbugs.gnu.org
Subject: bug#22240: Build instructions for 64-bit Windows?
Date: Wed, 30 Dec 2015 01:08:38 -0600	[thread overview]
Message-ID: <CA+XjW6yj=j8zTkWFBRyGandrvTvbE6XN51w65U=WcqHBz4hd3g@mail.gmail.com> (raw)
In-Reply-To: <83d1tpdusw.fsf@gnu.org>

[-- 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 --]

  reply	other threads:[~2015-12-30  7:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-12-31 17:01         ` Eli Zaretskii
2015-12-26  8:58 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+XjW6yj=j8zTkWFBRyGandrvTvbE6XN51w65U=WcqHBz4hd3g@mail.gmail.com' \
    --to=bburns.km@gmail.com \
    --cc=22240@debbugs.gnu.org \
    --cc=chriszheng99@gmail.com \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).