Commit | Line | Data |
---|---|---|
a4a9692d | 1 | Building and Installing Emacs |
6d76a603 | 2 | on Windows NT/2000 and Windows 95/98/ME |
a4a9692d | 3 | |
4b994b84 AI |
4 | Copyright (c) 2001 Free Software Foundation, Inc. |
5 | See the end of the file for copying permissions. | |
6 | ||
12d70bbb EZ |
7 | If you used WinZip to unpack the distribution, we suggest to |
8 | remove the files and unpack again with a different program! | |
9 | WinZip is known to create some subtle and hard to debug problems, | |
10 | such as converting files to DOS CR-LF format, not creating empty | |
11 | directories, etc. We suggest to use djtarnt.exe from the GNU FTP | |
12 | site. | |
13 | ||
da179dd0 | 14 | To compile Emacs, you will need either Microsoft Visual C++ 2.0 or |
263f7134 JR |
15 | later and nmake, or a Windows port of GCC 2.95 or later with Mingw |
16 | and W32 API support and a port of GNU make. You can use the Cygwin | |
17 | ports of GCC, but Emacs requires the Mingw headers and libraries to | |
8481e41e EZ |
18 | build (latest versions of the Cygwin toolkit, at least since v1.3.3, |
19 | include the MinGW headers and libraries as an integral part). | |
da179dd0 | 20 | |
4bcec9a2 | 21 | If you build Emacs on Windows 9X or ME, not on Windows 2000 or |
6d76a603 | 22 | Windows NT, we suggest to install the Cygwin port of Bash. |
4bcec9a2 | 23 | |
da179dd0 | 24 | Please see http://www.mingw.org for pointers to GCC/Mingw binaries. |
a4a9692d | 25 | |
4bcec9a2 EZ |
26 | For reference, here is a list of which builds of GNU make are known |
27 | to work or not, and whether they work in the presence and/or absence | |
fc813ef6 JR |
28 | of sh.exe, the Cygwin port of Bash. Note that any version of make |
29 | that is compiled with Cygwin will only work with Cygwin tools, due to | |
30 | the use of cygwin style paths. This means Cygwin make is unsuitable | |
31 | for building parts of Emacs that need to invoke Emacs itself (leim and | |
32 | "make bootstrap", for example). Also see the Trouble-shooting section | |
33 | below if you decide to go ahead and use Cygwin make. | |
4bcec9a2 EZ |
34 | |
35 | sh exists no sh | |
36 | ||
fc813ef6 | 37 | cygwin b20.1 make (3.75): fails[1, 5] fails[2, 5] |
4bcec9a2 EZ |
38 | MSVC compiled gmake 3.77: okay okay |
39 | MSVC compiled gmake 3.78.1: okay okay | |
40 | MSVC compiled gmake 3.79.1: okay okay | |
bf95665f | 41 | mingw32/gcc-2.92.2 make (3.77): okay okay[4] |
fc813ef6 JR |
42 | cygwin compiled gmake 3.77: fails[1, 5] fails[2, 5] |
43 | cygwin compiled make 3.78.1: fails[5] fails[2, 5] | |
44 | cygwin compiled make 3.79.1: fails[3, 5] fails[2?, 5] | |
45 | mingw32 compiled make 3.79.1: okay okay | |
4bcec9a2 EZ |
46 | |
47 | Notes: | |
48 | ||
49 | [1] doesn't cope with makefiles with DOS line endings, so must mount | |
50 | emacs source with text!=binary. | |
51 | [2] fails when needs to invoke shell commands; okay invoking gcc etc. | |
fc813ef6 JR |
52 | [3] requires LC_MESSAGES support to build; cannot build with early |
53 | versions of cygwin. | |
4bcec9a2 | 54 | [4] may fail on Windows 9X and Windows ME; if so, install Bash. |
fc813ef6 JR |
55 | [5] fails when building leim due to the use of cygwin style paths. |
56 | May work if building emacs without leim. | |
4bcec9a2 | 57 | |
6d76a603 | 58 | * Configuring |
a4a9692d | 59 | |
da179dd0 AI |
60 | Configuration of Emacs is now handled by running configure.bat in the |
61 | nt subdirectory. It will detect which compiler you have available, | |
62 | and generate makefiles accordingly. You can override the compiler | |
63 | detection, and control optimization and debug settings, by specifying | |
64 | options on the command line when invoking configure. | |
a4a9692d | 65 | |
da179dd0 AI |
66 | To configure Emacs to build with GCC or MSVC, whichever is available, |
67 | simply change to the nt subdirectory and run `configure' with no | |
68 | options. To see what options are available, run `configure --help'. | |
a4a9692d | 69 | |
17d4e22c AI |
70 | N.B. It is normal to see a few error messages output while configure |
71 | is running, when gcc support is being tested. These cannot be | |
72 | surpressed because of limitations in the Windows 9x command.com shell. | |
73 | ||
6d76a603 | 74 | * Building |
a4a9692d | 75 | |
da179dd0 AI |
76 | After running configure, simply run the appropriate `make' program for |
77 | your compiler to build Emacs. For MSVC, this is nmake; for GCC, it is | |
78 | GNU make. | |
a4a9692d | 79 | |
da179dd0 AI |
80 | As the files are compiled, you will see some warning messages |
81 | declaring that some functions don't return a value, or that some data | |
82 | conversions will be lossy, etc. You can safely ignore these messages. | |
83 | The warnings may be fixed in the main FSF source at some point, but | |
84 | until then we will just live with them. | |
a4a9692d | 85 | |
6d76a603 | 86 | * Installing |
a4a9692d | 87 | |
0fc7be80 EZ |
88 | To install Emacs after it has compiled, simply run `nmake install' |
89 | or `make install', depending on which version of the Make utility | |
90 | do you have. | |
a4a9692d | 91 | |
da179dd0 AI |
92 | By default, Emacs will be installed in the location where it was |
93 | built, but a different location can be specified either using the | |
94 | --prefix option to configure, or by setting INSTALL_DIR when running | |
95 | make, like so: | |
a4a9692d | 96 | |
da179dd0 | 97 | make install INSTALL_DIR=D:/emacs |
a4a9692d | 98 | |
0fc7be80 EZ |
99 | (for `nmake', type "nmake install INSTALL_DIR=D:/emacs" instead). |
100 | ||
da179dd0 AI |
101 | The install process will run addpm to setup the registry entries, and |
102 | to create a Start menu icon for Emacs. | |
a4a9692d | 103 | |
6d76a603 | 104 | * Trouble-shooting |
a4a9692d | 105 | |
da179dd0 AI |
106 | The main problems that are likely to be encountered when building |
107 | Emacs stem from using an old version of GCC, or old Mingw or W32 API | |
108 | headers. Additionally, cygwin ports of GNU make may require the Emacs | |
109 | source tree to be mounted with text!=binary, because the makefiles | |
110 | generated by configure.bat necessarily use DOS line endings. Also, | |
111 | cygwin ports of make must run in UNIX mode, either by specifying | |
112 | --unix on the command line, or MAKE_MODE=UNIX in the environment. | |
a4a9692d | 113 | |
da179dd0 AI |
114 | When configure runs, it attempts to detect when GCC itself, or the |
115 | headers it is using, are not suitable for building Emacs. GCC version | |
116 | 2.95 or later is needed, because that is when the Windows port gained | |
117 | sufficient support for anonymous structs and unions to cope with some | |
118 | definitions from winnt.h that are used by addsection.c. The W32 API | |
119 | headers that come with Cygwin b20.1 are incomplete, and do not include | |
120 | some definitions required by addsection.c, for instance. Also, older | |
121 | releases of the W32 API headers from Anders Norlander contain a typo | |
122 | in the definition of IMAGE_FIRST_SECTION in winnt.h, which | |
123 | addsection.c relies on. Versions of w32api-xxx.zip from at least | |
124 | 1999-11-18 onwards are okay. | |
a4a9692d | 125 | |
4bcec9a2 EZ |
126 | If configure succeeds, but make fails, install the Cygwin port of |
127 | Bash, even if the table above indicates that Emacs should be able to | |
128 | build without sh.exe. (Some versions of Windows shells are too dumb | |
129 | for Makefile's used by Emacs.) | |
130 | ||
8481e41e | 131 | If you are using certain Cygwin builds of GCC, such as Cygwin version |
6d76a603 AI |
132 | 1.1.8, you may need to specify some extra compiler flags like so: |
133 | ||
134 | configure --with-gcc --cflags -mwin32 --cflags -D__MSVCRT__ | |
315746cc | 135 | --ldflags -mwin32 |
6d76a603 | 136 | |
8481e41e EZ |
137 | However, the latest Cygwin versions, such as 1.3.3, don't need those |
138 | switches; you can simply use "configure --with-gcc". | |
139 | ||
6d76a603 AI |
140 | We will attempt to auto-detect the need for these flags in a future |
141 | release. | |
142 | ||
143 | * Debugging | |
a4a9692d | 144 | |
da179dd0 AI |
145 | You should be able to debug Emacs using the debugger that is |
146 | appropriate for the compiler you used, namely DevStudio or Windbg if | |
147 | compiled with MSVC, or gdb if compiled with gcc. | |
148 | ||
149 | Emacs functions implemented in C use a naming convention that reflects | |
150 | their names in lisp. The names of the C routines are the lisp names | |
151 | prefixed with 'F', and with dashes converted to underscores. For | |
152 | example, the function call-process is implemented in C by | |
153 | Fcall_process. Similarly, lisp variables are prefixed with 'V', again | |
154 | with dashes converted to underscores. These conventions enable you to | |
155 | easily set breakpoints or examine familiar lisp variables by name. | |
156 | ||
157 | Since Emacs data is often in the form of a lisp object, and the | |
158 | Lisp_Object type is difficult to examine manually in the MSVC | |
159 | debugger, Emacs provides a helper routine called debug_print that | |
160 | prints out a readable representation of a Lisp_Object. (If you are | |
161 | using gdb, there is a .gdbinit file in the src directory which | |
162 | provides definitions that are useful for examining lisp objects. The | |
163 | following tips are mainly of interest when using MSVC.) The output | |
164 | from debug_print is sent to stderr, and to the debugger via the | |
165 | OutputDebugString routine. The output sent to stderr should be | |
166 | displayed in the console window that was opened when the emacs.exe | |
167 | executable was started. The output sent to the debugger should be | |
168 | displayed in its "Debug" output window. | |
169 | ||
170 | When you are in the process of debugging Emacs and you would like to | |
171 | examine the contents of a Lisp_Object variable, popup the QuickWatch | |
172 | window (QuickWatch has an eyeglass symbol on its button in the | |
173 | toolbar). In the text field at the top of the window, enter | |
174 | debug_print(<variable>) and hit return. For example, start and run | |
175 | Emacs in the debugger until it is waiting for user input. Then click | |
176 | on the Break button in the debugger to halt execution. Emacs should | |
177 | halt in ZwUserGetMessage waiting for an input event. Use the Call | |
178 | Stack window to select the procedure w32_msp_pump up the call stack | |
179 | (see below for why you have to do this). Open the QuickWatch window | |
180 | and enter debug_print(Vexec_path). Evaluating this expression will | |
181 | then print out the contents of the lisp variable exec-path. | |
182 | ||
183 | If QuickWatch reports that the symbol is unknown, then check the call | |
184 | stack in the Call Stack window. If the selected frame in the call | |
185 | stack is not an Emacs procedure, then the debugger won't recognize | |
186 | Emacs symbols. Instead, select a frame that is inside an Emacs | |
187 | procedure and try using debug_print again. | |
188 | ||
189 | If QuickWatch invokes debug_print but nothing happens, then check the | |
190 | thread that is selected in the debugger. If the selected thread is | |
191 | not the last thread to run (the "current" thread), then it cannot be | |
192 | used to execute debug_print. Use the Debug menu to select the current | |
193 | thread and try using debug_print again. Note that the debugger halts | |
194 | execution (e.g., due to a breakpoint) in the context of the current | |
195 | thread, so this should only be a problem if you've explicitly switched | |
196 | threads. | |
4b994b84 AI |
197 | |
198 | COPYING PERMISSIONS | |
199 | ||
200 | Permission is granted to anyone to make or distribute verbatim copies | |
201 | of this document as received, in any medium, provided that the | |
202 | copyright notice and permission notice are preserved, | |
203 | and that the distributor grants the recipient permission | |
204 | for further redistribution as permitted by this notice. | |
205 | ||
206 | Permission is granted to distribute modified versions | |
207 | of this document, or of portions of it, | |
208 | under the above conditions, provided also that they | |
209 | carry prominent notices stating who last changed them, | |
210 | and that any new or changed statements about the activities | |
211 | of the Free Software Foundation are approved by the Foundation. |