Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 1047 lines (812 sloc) 46.191 kB
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
1 How to Build Erlang/OTP on Windows
2 ==================================
3
4 Introduction
5 ------------
6
7 This file describes how to build the Erlang emulator and the OTP
8 libraries on Windows. The instructions apply to versions of Windows
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
9 supporting the Cygwin emulated gnuish environment for Windows or the
10 Msys ditto. We've built on the following platforms: Windows 2003
11 server, Windows XP Home/Professional, Windows Vista and Windows 7 (32
12 and 64 bit). You can probably build on Windows 2000, but you will not
13 be able to install the latest Microsoft SDK, so you have to go back to
14 some earlier compiler. Any Windows95'ish platform will surely get you
15 into trouble, what I'm not sure of, but it certainly will...
16
17 The procedure described uses either Cygwin or Msys as a build
18 environment, you run the bash shell in Cygwin/Msys and use gnu
19 make/configure/autoconf etc to do the build. The emulator C-source
20 code is, however, mostly compiled with Microsoft Visual C++™,
21 producing a native Windows binary. This is the same procedure as we
22 use to build the pre-built binaries. The fact that we use VC++ and not
23 gcc is explained further in the FAQ section.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
24
25 I describe the build procedure to make it possible for open source
26 customers to build the emulator, given that they have the needed
27 tools. The binary Windows releases is still a preferred alternative if
28 one does not have Microsoft's development tools and/or don't want to
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
29 install Cygwin or Msys.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
30
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
31 To use Cygwin/Msys, one needs basic experience from a Unix environment, if
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
32 one does not know how to set environment variables, run programs etc
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
33 in a Unix environment, one will be quite lost in the Cygwin os Msys
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
34 ditto. I can unfortunately not teach all the world how to use
35 Cygwin and bash, neither how to install Cygwin nor perform basic tasks
36 on a computer. Please refer to other documentation on the net for
37 help, or use the binary release instead if you have problems using the
38 tools.
39
40 However, if you feel comfortable with the environment and build
41 system, and have all the necessary tools, you have a great opportunity
42 to make the Erlang/OTP distribution for Windows better. Please submit
4c3aebe @rickard-green OTP-8457 Minor documentation fixes. Mainly anchor adjustments.
rickard-green authored
43 any suggestions and patches to the appropriate [mailing lists] [1] to let
44 them find their way into the next version of Erlang. If making changes
45 to the build system (like makefiles etc) please bear in mind that the
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
46 same makefiles are used on Unix/VxWorks, so that your changes
4c3aebe @rickard-green OTP-8457 Minor documentation fixes. Mainly anchor adjustments.
rickard-green authored
47 don't break other platforms. That of course goes for C-code too, system
48 specific code resides in the `$ERL_TOP/erts/emulator/sys/win32` and
49 `$ERL_TOP/erts/etc/win32` directories mostly. The
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
50 `$ERL_TOP/erts/emulator/beam` directory is for common code.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
51
52 Before the R9C release of Erlang/OTP, the Windows release was built
53 partly on a Unix (Solaris) box and partly on a Windows box, using Perl
54 hacks to communicate and sync between the two machines. R9C was the
55 first release ever built solely on Windows, where no Unix machine is
56 needed at all. Now we've used this build procedure for a couple of
57 releases, and it has worked fine for us. Still, there might be all
58 sorts of troubles on different machines and with different
59 setups. I'll try to give hints wherever I've encountered difficulties,
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
60 but please share your experiences by using the [erlang-questions] [1]
4c3aebe @rickard-green OTP-8457 Minor documentation fixes. Mainly anchor adjustments.
rickard-green authored
61 mailing list. I cannot of course help everyone with all
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
62 their problems, please try to solve the problems and submit
63 solutions/workarounds. Remember, it's all about sharing, not about
64 demanding...
65
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
66 Starting with R15B, our build system runs both on Cygwin and Msys
67 (MinGW's fork of an early cygwin version). Msys is a smaller package
68 to install and may on some machines run slightly faster. If Cygwin
69 gives you trouble, try Msys instead, and v.v. Beginning with R15B
70 there is also a native 64bit version of Erlang for 64bit Windows 7
71 (only). These instructions apply to both the 32bit VM and the 64bit
72 ditto.
73
74 Note that even if you build a 64bit VM, most of the directories and
75 files involved are still named win32. You can view the name win32 as
76 meaning any windows version not beeing 16bit. A few occurences of the
77 name Win64 are however present in the system, for example the
78 installation file for a 64 bit windows version of Erlang is by default
79 named `otp_win64_<version>.exe`.
80
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
81 Lets go then, I'll start with a little FAQ, based on in house questions
82 and misunderstandings.
83
84
85 Frequently Asked Questions
86 --------------------------
87
88 * Q: So, now I can build Erlang using GCC on Windows?
89
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
90 A: No, unfortunately not. You'll need Microsoft's Visual C++
91 still, a Bourne-shell script (cc.sh) wraps the Visual C++ compiler
92 and runs it from within the Cygwin environment. All other tools
93 needed to build Erlang are free-ware/open source, but not the C
94 compiler. The Windows SDK is however enough to build Erlang, you
95 do not need to buy Visual C++, just download the SDK (SDK version
96 7.1 == Visual studio 2010).
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
97
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
98 * Q: Why haven't you got rid of VC++ then, you \*\*\*\*\*\*?
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
99
100 A: Well, partly because it's a good compiler - really! Actually it's
101 been possible in late R11-releases to build using mingw instead of
102 visual C++ (you might see the remnants of that in some scripts and
103 directories). Unfortunately the development of the SMP version for
104 Windows broke the mingw build and we chose to focus on the VC++ build
105 as the performance has been much better in the VC++ versions. The
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
106 mingw build will possibly be back, but as long as VC++ gives better
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
107 performance, the commercial build will be a VC++ one.
108
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
109 * Q: OK, you need VC++, but now you've started to demand a very recent
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
110 (and expensive) version of Visual studio, not the old and stable VC++
111 6.0 that was used in earlier versions. Why?
112
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
113 A: Well, it's not expensive, it's free (as in free beer). Just
114 download and install the latest Windows SDK from Microsoft and all
115 the tools you need are there. The included debugger (WinDbg) is
116 also quite usable, it's what I used when porting Erlang to 64bit
117 Windows. Another reason to use the latest Microsoft compilers is
118 DLL compatibility. DLL's using a new version of the standard
119 library might not load if the VM is compiled with an old VC++
120 version, why we should aim to use the latest freely available SDK
121 and compiler.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
122
123 * Q: Can/will I build a Cygwin binary with the procedure you describe?
124
125 A: No, the result will be a pure Windows binary, and as far as I know,
126 it's not possible to make a Cygwin binary yet. That is of course
127 something desirable, but there are still some problems with the
128 dynamic linking (dynamic Erlang driver loading) as well as the TCP/IP
129 emulation in Cygwin, which, I'm sure of, will improve, but still has
130 some problems. Fixing those problems might be easy or might be hard.
131 I suggest you try yourself and share your experience. No one would be
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
132 happier if a simple `./configure && make` would produce a fully fledged
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
133 Cygwin binary. Ericsson does however not pay me to do a Cygwin port, so
134 such a port would have to happen in spare time, which is a limited
135 resource...
136
137 * Q: Hah, I saw you, you used GCC even though you said you didn't!
138
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
139 A: OK, I admit, one of the files is compiled using Cygwin's or
140 MinGW's GCC and the resulting object code is then converted to MS
141 VC++ compatible coff using a small C hack. It's because that
142 particular file, `beam_emu.c` benefits immensely from being able
143 to use the GCC labels-as-values extension, which boosts emulator
144 performance by up to 50%. That does unfortunately not (yet) mean
145 that all of OTP could be compiled using GCC, that particular
146 source code does not do anything system specific and actually is
147 adopted to the fact that GCC is used to compile it on Windows.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
148
149 * Q: So now there's a MS VC++ project file somewhere and I can build OTP
150 using the nifty VC++ GUI?
151
152 A: No, never. The hassle of keeping the project files up to date and
153 do all the steps that constitute an OTP build from within the VC++ GUI
154 is simply not worth it, maybe even impossible. A VC++ project
155 file for Erlang/OTP will never happen, at least I will never make
156 one. Clicking around in super-multi-tab'd dialogs to add a file or
157 compiler option when it's so much easier in a makefile is simply not
158 my style.
159
160 * Q: So how does it all work then?
161
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
162 A: Cygwin or Msys is the environment, which closely resembles the
163 environments found on any Unix machine. It's almost like you had a
164 virtual Unix machine inside Windows. Configure, given certain
165 parameters, then creates makefiles that are used by the
166 Cygwin/Msys gnu-make to built the system. Most of the actual
167 compilers etc are not, however, Cygwin/Msys tools, so I've written
168 a couple of wrappers (Bourne-shell scripts), which reside in
169 `$ERL_TOP/etc/win32/cygwin_tools` and
170 `$ERL_TOP/etc/win32/msys_tools`. They all do conversion of
171 parameters and switches common in the Unix environment to fit the
172 native Windows tools. Most notable is of course the paths, which
173 in Cygwin/Msys are Unix-like paths with "forward slashes" (/) and
174 no drive letters, the Cygwin specific command `cygpath` is used
175 for most of the path conversions in a Cygwin environment, other
176 tools are used (when needed) in the corresponding Msys
177 environment. Luckily most compilers accept forward slashes instead
178 of backslashes as path separators, but one still have to get the drive
179 letters etc right, though. The wrapper scripts are not general in
180 the sense that, for example, cc.sh would understand and translates
181 every possible gcc option and passes correct options to
182 cl.exe. The principle is that the scripts are powerful enough to
183 allow building of Erlang/OTP, no more, no less. They might need
184 extensions to cope with changes during the development of Erlang,
185 that's one of the reasons I made them into shell-scripts and not
186 Perl-scripts, I believe they are easier to understand and change
187 that way. I might be wrong though, cause another reason I didn't
188 write them in Perl is because I've never liked Perl and my Perl
189 code is no pleasant reading...
190
191 In `$ERL_TOP`, there is a script called `otp_build`. That script handles
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
192 the hassle of giving all the right parameters to `configure`/`make` and
193 also helps you set up the correct environment variables to work with
194 the Erlang source under Cygwin.
195
196 * Q: You use and need Cygwin, but then you haven't taken the time to
197 port Erlang to the Cygwin environment but instead focus on your
198 commercial release, is that really ethical?
199
200 A: No, not really, but see this as a step in the right direction. I'm
201 aiming at GCC compiled emulators and a Cygwin version, but I really
202 need to do other things as well... In time, but don't hold your
203 breath...
204
205 * Q: Can I build something that looks exactly as the commercial release?
206
207 A: Yes, we use the exactly same build procedure.
208
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
209 * Q: Which version of Cygwin/Msys and other tools do you use then?
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
210
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
211 A: For Cygwin and Msys alike, we try to use the latest releases
212 available when building. What versions you use shouldn't really
213 matter, I try to include workarounds for the bugs I've found in
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
214 different Cygwin/Msys releases, please help me add workarounds
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
215 for new Cygwin/Msys-related bugs as soon as you encounter
216 them. Also please do submit bug reports to the appropriate Cygwin
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
217 and/or Msys developers. The GCC we used for %OTP-REL% was version
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
218 4.7.0 (MinGW 64bit) and 4.3.4 (Cygwin 32bit). We used VC++ 10.0
219 (i.e. Visual studio 2010), Sun's JDK 1.5.0\_17 (32bit) and Sun's
220 JDK 1.7.0\_1 (64bit), NSIS 2.46, and Win32 OpenSSL 0.9.8r. Please
221 read the next section for details on what you need.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
222
223 * Q: Can you help me setup X in Cygwin?
224
225 A: No, unfortunately I haven't got time to help with Cygwin related
226 user problems, please read Cygwin related web sites, newsgroups and
227 mailing lists.
228
229 * Q: Why is the instruction so long? Is it really that complicated?
230
231 A: Partly it's long because I babble too much, partly because I've
232 described as much as I could about the installation of the needed
233 tools. Once the tools are installed, building is quite easy. I also
234 have tried to make this instruction understandable for people with
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
235 limited Unix experience. Cygwin/Msys is a whole new environment to some
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
236 Windows users, why careful explanation of environment variables etc
237 seemed to be in place. The short story, for the experienced and
238 impatient is:
239
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
240 * Get and install complete Cygwin (latest) or complete MinGW with msys
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
241
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
242 * Install Microsofts Windows SDK 7.1 (and .Net 4)
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
243
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
244 * Get and install Sun's JDK 1.5.0 or higher
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
245
8e8061c @dch Doc update to latest dependencies & how to compile with free VS2008 E…
dch authored
246 * Get and install NSIS 2.01 or higher (up to 2.46 tried and working)
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
247
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
248 * Get, build and install OpenSSL 0.9.8r or higher (up to 1.0.0a
249 tried & working) with static libs.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
250
251 * Get the Erlang source distribution (from
252 <http://www.erlang.org/download.html>) and unpack with Cygwin's `tar`.
253
254 * Set `ERL_TOP` to where you unpacked the source distribution
255
256 * `$ cd $ERL_TOP`
257
258 * Get (from <http://www.erlang.org/download/tcltk85_win32_bin.tar.gz>)
259 and unpack the prebuilt TCL/TK binaries for windows with cygwin tar,
260 standing in `$ERL_TOP`
261
262 * Modify PATH and other environment variables so that all these tools
263 are runnable from a bash shell. Still standing in `$ERL_TOP`, issue
264 the following commands:
265
266 $ eval `./otp_build env_win32`
267 $ ./otp_build autoconf
268 $ ./otp_build configure
269 $ ./otp_build boot -a
270 $ ./otp_build release -a
271 $ ./otp_build installer_win32
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
272 $ release/win32/otp_win32_%OTP-REL% /S
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
273
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
274 Voila! `Start->Programs->Erlang OTP %OTP-REL%->Erlang` starts the Erlang
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
275 Windows shell.
276
277
278 Tools you Need and Their Environment
279 ------------------------------------
280
281 You need some tools to be able to build Erlang/OTP on Windows. Most
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
282 notably you'll need Cygwin or Msys and Microsofts Windows SDK, but
283 you also might want a Java compiler, the NSIS install system and
284 OpenSSL. Well' here's the list:
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
285
286 * Cygwin, the very latest is usually best. Get all the development
287 tools and of course all the basic ditto. In fact getting the complete
288 package might be a good idea, as you'll start to love Cygwin after a
289 while if you're accustomed to Unix. Make sure to get jar and also make
290 sure *not* to install a Cygwin'ish Java... The Cygwin jar command is
291 used but Sun's Java compiler and virtual machine...
292
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
293 If you are going to build a 64bit Windows version, you should make
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
294 sure to get MinGW's 64bit gcc installed with cygwin. It's in one of
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
295 the development packages.
296
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
297 URL: <http://www.cygwin.com>
298
299 Get the installer from the web site and use that to install
300 Cygwin. Be sure to have fair privileges. If you're on a NT domain you
301 should consider running `mkpasswd -d` and `mkgroup -d` after the
302 installation to get the user databases correct. See their respective
303 manual pages.
304
305 When you start you first bash shell, you will get an awful prompt. You
306 might also have a `PATH` environment variable that contains backslashes
307 and such. Edit `$HOME/.profile` and `$HOME/.bashrc` to set fair prompts
308 and set a correct PATH. Also do a `export SHELL` in `.profile`. For some
309 non-obvious reason the environment variable `$SHELL` is not exported in
310 bash. Also note that `.profile` is run at login time and `.bashrc` when
311 sub shells are created. You'll need to explicitly source `.bashrc` from
312 `.profile` if you want the commands there to be run at login time (like
313 setting up aliases, shell functions and the like). I personally
314 usually do like this at the end of `.profile`:
315
316 ENV=$HOME/.bashrc
317 export ENV
318 . $ENV
319
320 You might also, if you're a hard core type of person at least, want to
321 setup X-windows (XFree86), that might be as easy as running startx
322 from the command prompt and it might be much harder. Use Google to
323 find help...
324
325 If you don't use X-windows, you might want to setup the Windows
326 console window by selecting properties in the console system menu
327 (upper left corner of the window, the Cygwin icon in the title
328 bar). Especially setting a larger screen buffer size (lines) is useful
329 as it gets you a scrollbar so you can see whatever error messages
330 that might appear...
331
332 If you want to use (t)csh instead of bash you're on your own, I
333 haven't tried and know of no one that has. I expect
334 that you use bash in all shell examples.
335
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
336 * Alternatively you download MinGW and Msys. You'll find the latest
337 installer at:
338
339 URL: <http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/>
340
341 Make sure to install everything they've got.
342
343 To be able to build the 64bit VM, you will also need the 64bit
344 MinGW compiler from:
345
346 URL: <http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/>
347
348 The latest version should do it. Make sure you download the
349 `mingw-w64-bin_i686-mingw_<something>.zip`, not a linux
350 version. You unzip the package on top of your MinGW installation
351 (`c:\MinGW`) and that's it.
352
353 Setting up your environment in Msys is similar to setting it up in
354 Cygwin.
355
356 * Microsofts Windows SDK version 7.1 (corresponding to VC++ 10.0 and
357 Visual Studio 2010). You'll find it here:
358
359 URL: <http://www.microsoft.com/download/en/details.aspx?id=8279>
360
361 but before you install that, you need to have .Net 4 installed,
362 you'll find that here:
363
364 URL: <http://www.microsoft.com/download/en/details.aspx?id=17851>
365
366 Use the web installer for the SDK, at least when I tried
367 downloading the whole package as an image, I got SDK 7.0 instead,
368 which is not what you want...
369
370 There will be a Windows command file in `%PROGRAMFILES%\Mirosoft
371 SDKs\Windows\v7.1\Bin\SetEnv.cmd` that set's the appropriate
372 environment for a Windows command prompt. This is not appropriate
373 for bash, so you'll need to convert it to bash-style environments
374 by editing your `.bash_profile`. In my case, where the SDK is
375 installed in the default directory and `%PROGRAMFILES%` is
376 `C:\Program Files`, the commands for setting up a 32bit build
377 environment (on a 64bit or 32bit machine) look like this (in cygwin):
378
379 # Some common paths
380 C_DRV=/cygdrive/c
381 PRG_FLS=$C_DRV/Program\ Files
382
383 # nsis
384 NSIS_BIN=$PRG_FLS/NSIS
385 # java
386 JAVA_BIN=$PRG_FLS/Java/jdk1.6.0_16/bin
387
388 ##
389 ## MS SDK
390 ##
391
392 CYGWIN=nowinsymlinks
393 MVS10="$PRG_FILES/Microsoft Visual Studio 10.0"
394 WIN_MVS10="C:\\Program Files\\Microsoft Visual Studio 10.0"
395 SDK10="$PRG_FILES/Microsoft SDKs/Windows/v7.1"
396 WIN_SDK10="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1"
397
398 PATH="$NSIS_BIN:\
399 $MVS10/Common7/IDE:\
400 $MVS10/Common7/Tools:\
401 $MVS10/VC/Bin:\
402 $MVS10/VC/Bin/VCPackages:\
403 $SDK10/Bin/NETFX 4.0 Tools:\
404 $SDK10/Bin:\
405 /usr/local/bin:/usr/bin:/bin:\
406 /cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:\
407 /cygdrive/c/WINDOWS/system32/Wbem:\
408 $JAVA_BIN"
409
410 LIBPATH="$WIN_MVS10\\VC\\LIB"
411
412 LIB="$WIN_MVS10\\VC\\LIB;$WIN_SDK10\\LIB"
413
414 INCLUDE="$WIN_MVS10\\VC\\INCLUDE;$WIN_SDK10\\INCLUDE;$WIN_SDK10\\INCLUDE\\gl"
415
416 export CYGWIN PATH LIBPATH LIB INCLUDE
417
418 If you're using Msys instead, the only thing you need to change is
419 the `C_DRV` setting, which would read:
420
421 C_DRV=/c
422
423 And of course you might need to change `C:\Program Files` etc if
424 you're using a non-english version of Windows (XP). Note that in
425 later versions of Windows, the national adoptions of the program
426 files directories etc are not on the file system but only in the
427 explorer, so even if explorer says that your programs reside in
428 e.g. `C:\Program`, they might still reside in `C:\Program Files`
429 in reality...
430
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
431 If you are building a 64 bit version of Erlang, you should set up
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
432 PATHs etc a little differently. I use the following script to
433 make things work in both Cygwin and Msys:
434
435 make_winpath()
436 {
437 P=$1
438 if [ "$IN_CYGWIN" = "true" ]; then
439 cygpath -d "$P"
440 else
441 (cd "$P" && /bin/cmd //C "for %i in (".") do @echo %~fsi")
442 fi
443 }
444
445 make_upath()
446 {
447 P=$1
448 if [ "$IN_CYGWIN" = "true" ]; then
449 cygpath "$P"
450 else
451 echo "$P" | /bin/sed 's,^\([a-zA-Z]\):\\,/\L\1/,;s,\\,/,g'
452 fi
453 }
454
455 # Some common paths
456 if [ -x /usr/bin/msysinfo ]; then
457 # Without this the path conversion won't work
458 COMSPEC='C:\Windows\SysWOW64\cmd.exe'
459 MSYSTEM=MINGW32
460 export MSYSTEM COMSPEC
461 IN_CYGWIN=false
462 else
463 CYGWIN=nowinsymlinks
464 export CYGWIN
465 IN_CYGWIN=true
466 fi
467
468 if [ "$IN_CYGWIN" = "true" ]; then
469 PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:\
470 /cygdrive/c/windows/system32:/cygdrive/c/windows:/cygdrive/c/windows/system32/Wbem
471 else
472 PATH=/usr/local/bin:/mingw/bin:/bin:/c/Windows/system32:/c/Windows:\
473 /c/Windows/System32/Wbem
474 fi
475
476 if [ "$IN_CYGWIN" = "true" ]; then
477 C_DRV=/cygdrive/c
478 else
479 C_DRV=/c
480 fi
481
482 PRG_FLS64=$C_DRV/Program\ Files
483 PRG_FLS32=$C_DRV/Program\ Files\ \(x86\)
484 VISUAL_STUDIO_ROOT32=$PRG_FLS32/Microsoft\ Visual\ Studio\ 10.0
485 MS_SDK_ROOT64=$PRG_FLS64/Microsoft\ SDKs/Windows/v7.1
486
487 # Okay, now mangle the paths and get rid of spaces by using short names
488 WIN_VCROOT32=`make_winpath "$VISUAL_STUDIO_ROOT32"`
489 VCROOT32=`make_upath $WIN_VCROOT32`
490 WIN_SDKROOT64=`make_winpath "$MS_SDK_ROOT64"`
491 SDKROOT64=`make_upath $WIN_SDKROOT64`
492 WIN_PROGRAMFILES32=`make_winpath "$PRG_FLS32"`
493 PROGRAMFILES32=`make_upath $WIN_PROGRAMFILES32`
494
495 WIN_PROGRAMFILES64=`make_winpath "$PRG_FLS64"`
496 PROGRAMFILES64=`make_upath $WIN_PROGRAMFILES64`
497
498 # nsis
499 NSIS_BIN=$PROGRAMFILES32/NSIS
500 # java
501 JAVA_BIN=$PROGRAMFILES64/Java/jdk1.7.0_01/bin
502
503 ## The PATH variable should be Unix'ish
504 VCPATH=$VCROOT32/Common7/IDE:$VCROOT32/VC/BIN/amd64:$VCROOT32/Common7/Tools:\
505 $VCROOT32/VC/VCPackages:$SDKROOT64/bin/NETFX4~1.0TO/x64:$SDKROOT64/bin/x64:\
506 $SDKROOT64/bin
507
508 ## Microsoft SDK libs
509
510 LIBPATH=$WIN_VCROOT32\\VC\\LIB\\amd64
511 LIB=$WIN_VCROOT32\\VC\\LIB\\amd64\;$WIN_SDKROOT64\\LIB\\X64
512 INCLUDE=$WIN_VCROOT32\\VC\\INCLUDE\;$WIN_SDKROOT64\\include\;\
513 $WIN_SDKROOT64\\include\\gl
514
515 # Put nsis, c compiler and java in path
516 PATH=$NSIS_BIN:$VCPATH:$PATH:$JAVA_BIN
517
518 # Make sure LIB and INCLUDE is available for others
519 export PATH LIBPATH LIB INCLUDE
520
521 All this is derived from the SetEnv.cmd command file mentioned
522 earlier. The bottom line is to set the PATH so that NSIS and
523 Microsoft SDK is found before the Msys/Cygwin tools and that Java
524 is last in the PATH.
525
526 Make a simple hello world (maybe one that prints out
527 `sizeof(void *)`) and try to compile it with the `cl` command from within
528 bash. If that does not work, your environment needs fixing. Also
529 remember to fix up the PATH environment, especially old Erlang
530 installations might have inserted quoted paths that Cygwin/Msys
531 does not understand. Remove or correct such paths. There should be
532 no backslashes in your path environment variable in Cygwin bash,
533 but LIB and INCLUDE should contain Windows style paths with
534 semicolon, drive letters and backslashes.
8e8061c @dch Doc update to latest dependencies & how to compile with free VS2008 E…
dch authored
535
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
536 * Sun's Java JDK 1.5.0 or higher. Our Java code (jinterface, ic) is
537 written for JDK 1.5.0. Get it for Windows and install it, the JRE is
538 not enough. If you don't care about Java, you can skip this step, the
539 result will be that jinterface is not built.
540
541 URL: <http://java.sun.com>
542
543 Add javac *LAST* to your path environment in bash, in my case this means:
544
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
545 `PATH="$PATH:/cygdrive/c/Program Files/Java/jdk1.5.0_17/bin"`
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
546
547 No `CLASSPATH` or anything is needed. Type `javac` at the bash prompt
548 and you should get a list of available Java options. Make sure by
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
549 typing `type java` that you use the Java you installed. Note however that
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
550 Cygwin's `jar.exe` is used, that's why the JDK bin-directory should be
551 added last in the `PATH`.
552
553 * Nullsoft NSIS installer system. You need this to build the self
554 installing package. It's a free open source installer that's much
555 nicer to use than the commercial Wise and Install shield
556 installers. This is the installer we use for commercial releases as
557 well from R9C an on.
558
559 URL: <http://www.nullsoft.com/free/nsis>
560
561 Install the lot, especially the modern user interface components, as
562 it's definitely needed. Put `makensis` in your path, in my case:
563
564 PATH=/cygdrive/c/Program\ Files/NSIS:$PATH
565
566 type makensis at the bash prompt and you should get a list of options
567 if everything is OK.
568
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
569 * OpenSSL. This is if you want the SSL and crypto applications to
570 compile (and run). There are prebuilt binaries available, but I
571 strongly recommend building this yourself. It's quite easy.
572
573 First get the source from
574
575 URL: <http://openssl.org/source/>
576
577 I would recommend using 0.9.8r.
578
579 Download the tar file and unpack it (using your bash prompt) into
580 a directory of your choise.
581
582 You will need a Windowish Perl for the build. ActiveState has one:
583
584 URL: <http://www.activestate.com/activeperl/downloads>
585
586 Download and install that. Disable options to associate it with
587 the .pl suffix and/or adding things to PATH, they are not needed.
588
589 Now fire up the Microsoft Windows SDK command prompt in RELEASE
590 mode for the architecture you are going to build. The easiest is
591 to copy the shortcut from the SDKs start menu item and edit the
592 command line in the shortcut (Right click->Properties) to end with
593 `/Release`. Make sure the banner when you double click your
594 shortcut (the text in the resulting command window) says
595 `Targeting Windows XP x64 Release` if you are going to do a 64 bit
596 build and `Targeting Windows XP x86 Release` if you are building a
597 32 bit version.
598
599 Now cd to where you unpacked the OpenSSL source using your Release
600 Windows command prompt (it should be on the same drive as where
601 you are going to install it if everything is to work smothly).
602
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
603 C:\> cd <some dir>
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
604
605 Add ActiveState (or some other windows perl, not cygwins) to your PATH:
606
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
607 C:\...\> set PATH=C:\Perl\bin;%PATH%
608
609 Or if you installed the 64bit perl:
610
611 C:\...\> set PATH=C:\Perl64\bin;%PATH%
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
612
613 Configure OpenSSL for 32 bit:
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
614
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
615 C:\...\> perl Configure VC-WIN32 --prefix=/OpenSSL
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
616
617 Or for 64 bit:
618
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
619 C:\...\> perl Configure VC-WIN64A --prefix=/OpenSSL-Win64
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
620
621 Do some setup (for 32 bit):
622
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
623 C:\...\> ms\do_ms
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
624
625 The same for 64 bit:
626
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
627 C:\...\> ms\do_win64a
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
628
629 Then build static libraries and install:
630
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
631 C:\...\> nmake -f ms\nt.mak
632 C:\...\> nmake -f ms\nt.mak install
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
633
634 That's it - you now have your perfectly consistent static build of
635 openssl. If you want to get rid of any possibly patented
636 algorithms in the lib, just read up on the OpenSSL FAQ and follow
637 the instructions.
638
639 The installation locations chosen are where configure will look
640 for OpenSSL, so try to keep them as is.
641
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
642 * Building with wxWidgets. Download wxWidgets-2.8.9 or higher patch
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
643 release (2.9.\* is a developer release which currently does not work
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
644 with wxErlang).
645
8e8061c @dch Doc update to latest dependencies & how to compile with free VS2008 E…
dch authored
646 Install or unpack it to `DRIVE:/PATH/cygwin/opt/local/pgm`.
647
42da126 @bufflig Make whole of OTP build and release on Win64
bufflig authored
648 edit: `C:\cygwin\opt\local\pgm\wxMSW-2.8.11\include\wx\msw\setup.h`
649 enable `wxUSE_GLCANVAS`, `wxUSE_POSTSCRIPT` and `wxUSE_GRAPHICS_CONTEXT`
8e8061c @dch Doc update to latest dependencies & how to compile with free VS2008 E…
dch authored
650
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
651 build: From a command prompt with the VC tools available (See the
652 instructions for OpenSSL build above for help on starting the
653 proper command prompt in RELEASE mode):
42da126 @bufflig Make whole of OTP build and release on Win64
bufflig authored
654
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
655 C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw
656 C:\...\> nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc
657 C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc
658 C:\...\> nmake BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc
42da126 @bufflig Make whole of OTP build and release on Win64
bufflig authored
659
660 Or - if building a 64bit version:
0d530cb @bufflig Correct build instruction for 32bit OpenSSL
bufflig authored
661
662 C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\build\msw
663 C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc
664 C:\...\> cd C:\cygwin\opt\local\pgm\wxMSW-2.8.11\contrib\build\stc
665 C:\...\> nmake TARGET_CPU=amd64 BUILD=release SHARED=0 UNICODE=1 USE_OPENGL=1 USE_GDIPLUS=1 DIR_SUFFIX_CPU= -f makefile.vc
42da126 @bufflig Make whole of OTP build and release on Win64
bufflig authored
666
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
667 * The Erlang source distribution (from <http://www.erlang.org/download.html>).
668 The same as for Unix platforms. Preferably use tar from within Cygwin to
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
669 unpack the source tar.gz (`tar zxf otp_src_%OTP-REL%.tar.gz`).
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
670
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
671 set the environment `ERL_TOP` to point to the root directory of the
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
672 source distribution. Let's say I stood in `$HOME/src` and unpacked
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
673 `otp_src_%OTP-REL%.tar.gz`, I then add the following to `.profile`:
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
674
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
675 ERL_TOP=$HOME/src/otp_src_%OTP-REL%
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
676 export $ERL_TOP
677
678 * The TCL/TK binaries. You could compile Tcl/Tk for windows yourself,
679 but you can get a stripped down version from our website which is
680 suitable to include in the final binary package. If you want to supply
681 tcl/tk yourself, read the instructions about how the tcl/tk tar file
682 used in the build is constructed under `$ERL_TOP/lib/gs/tcl`. The easy
683 way is to download <http://www.erlang.org/download/tcltk85_win32_bin.tar.gz>
684 and unpack it standing in the `$ERL_TOP` directory. This will create the
685 file `win32.tar.gz` in `$ERL_TOP/lib/gs/tcl/binaries`.
686
687 One last alternative is to create a file named `SKIP` in the
688 `$ERL_TOP/lib/gs/` after configure is run, but that will give you an
689 erlang system without gs (which might be okay as you probably will use
690 wx anyway).
691
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
692 Note that there is no special 64bit version of TCL/TK needed, you
693 can use the 32bit program even for a 64bit build.
694
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
695 The Shell Environment
696 ---------------------
697
698 So, if you have followed the instructions above, when you start a bash
699 shell, you should have an INCLUDE environment with a Windows style
700 path, a LIB environment variable also in Windows style, and finally a
701 PATH that let's you reach cl, makensis, javac etc from the
702 command prompt (use `which cl` etc to verify from bash).
703
704 You should also have an `ERL_TOP` environment variable that is *Cygwin
705 style*, and points to a directory containing, among other files, the
706 script `otp_build`.
707
708 A final massage of the environment is needed, and that is done by
709 the script `$ERL_TOP/otp_build`. Start bash and do the following, note
710 the "back-ticks" (\`), can be quite hard to get on some keyboards, but
711 pressing the back-tick key followed by the space bar might do it...
712
713 $ cd $ERL_TOP
714 $ eval `./otp_build env_win32`
715
716 If you're unable to produce back-ticks on your keyboard, you can use
717 the ksh variant:
718
719 $ cd $ERL_TOP
720 $ eval $(./otp_build env_win32)
721
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
722 If you are building a 64 bit version, you supply `otp_build` with an architecture parameter:
723
724 $ cd $ERL_TOP
725 $ eval `./otp_build env_win32 x64`
726
727
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
728 This should do the final touch to the environment and building should
729 be easy after this. You could run `./otp_build env_win32` without
730 `eval` just to see what it does, and to see that the environment it
731 sets seems OK. The path is cleaned of spaces if possible (using DOS
732 style short names instead), the variables `OVERRIDE_TARGET`, `CC`, `CXX`,
733 `AR` and `RANLIB` are set to their respective wrappers and the directories
734 `$ERL_TOP/erts/etc/win32/cygwin_tools/vc` and
735 `$ERL_TOP/erts/etc/win32/cygwin_tool` are added first in the PATH.
736
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
737 Try now a `type erlc`. That should result in the erlc wrapper script
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
738 (which does not have the .sh extension, for reasons best kept
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
739 untold...). It should reside in `$ERL_TOP/erts/etc/win32/cygwin_tools`
740 or `$ERL_TOP/erts/etc/win32/msys_tools`. You could also try `which
741 cc.sh`, which `ar.sh` etc.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
742
743 Now you're ready to build...
744
745
746 Building and Installing
747 -----------------------
748
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
749 Now it's assumed that you have executed `` eval `./otp_build env_win32` `` or
750 `` eval `./otp_build env_win32 x64` `` for this particular shell...
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
751
752 Building is easiest using the `otp_build` script. That script takes care
753 of running configure, bootstrapping etc on Windows in a simple
754 way. The `otp_build` script is the utility we use ourselves to build on
755 different platforms and it therefore contains code for all sorts of
756 platforms. The principle is, however, that for non-Unix platforms, one
757 uses `./otp_build env_<target>` to set up environment and then the
758 script knows how to build on the platform "by itself". You've already
759 run `./otp_build env_win32` in the step above, so now it's mostly like
760 we build on any platform. OK, here are then steps; Assuming you will
761 want to build a full installation executable with NSIS, you can omit
762 `<installation directory>` and the release will be copied to
763 `$ERL_TOP/release/win32`: and there is where the packed self installing
764 executable will reside too.
765
766 $ ./otp_build autoconf # Ignore the warning blob about versions of autoconf
767 $ ./otp_build configure <optional configure options>
768 $ ./otp_build boot -a
769 $ ./otp_build release -a <installation directory>
770 $ ./otp_build installer_win32 <installation directory> # optional
771
772 Now you will have a file called `otp_win32_R12B.exe` in the
773 `<installation directory>`, i.e. `$ERL_TOP/release/win32`.
774
775 Lets get into more detail:
776
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
777 1. `$ ./otp_build autoconf` - This step rebuilds the configure scripts
778 to work correctly in the cygwin environment. In an ideal world, this
779 would not be needed, but alas, we have encountered several
780 incompatibilities between our distributed configure scripts (generated
781 on a Linux platform) and the cygwin environment over the
782 years. Running autoconf on cygwin ensures that the configure scripts
783 are generated in a cygwin-compatible way and that they will work well
784 in the next step.
785
786 2. `$ ./otp_build configure` - This runs the newly generated configure
787 scripts with options making configure behave nicely. The target machine
788 type is plainly `win32`, so a lot of the configure-scripts recognize
789 this awkward target name and behave accordingly. The CC variable also
790 makes the compiler be `cc.sh`, which wraps MSVC++, so all configure
791 tests regarding the C compiler gets to run the right compiler. A lot of
792 the tests are not needed on Windows, but I thought it best to run the
793 whole configure anyway. The only configure option you might want to
794 supply is `--with-ssl`, which might be needed if you have built your
795 own OpenSSL distribution. The Shining Lights distribution should be
796 found automatically by `configure`, if that fails, add a
797 `--with-ssl=<dir>` that specifies the root directory of your OpenSSL
798 installation.
799
800 3. `$ ./otp_build boot -a` - This uses the bootstrap directory (shipped
801 with the source, `$ERL_TOP/bootstrap`) to build a complete OTP
802 system. It first builds an emulator and sets up a minimal OTP system
803 under `$ERL_TOP/bootstrap`, then starts to compile the different OTP
804 compilers to make the `$ERL_TOP/bootstrap` system potent enough to be
805 able to compile all Erlang code in OTP. Then, all Erlang and C code
806 under `$ERL_TOP/lib` is built using the bootstrap system, giving a
807 complete OTP system (although not installed). When this is done, one
808 can run Erlang from within the source tree, just type `$ERL_TOP/bin/erl`
809 and you should have a prompt. If you omit the -a flag, you'll get a
810 smaller system, that might be useful during development. Now
811 exit from Erlang and start making a release of the thing:
812
813 4. `$ ./otp_build release -a` - Builds a commercial release tree from the
814 source tree, default is to put it in `$ERL_TOP/release/win32`, you can
815 give any directory as parameter (Cygwin style), but it doesn't really
816 matter if you're going to build a self extracting installer too. You
817 could of course build release to the final directory and then run
818 `./Install.exe` standing in the directory where the release was put,
819 that will create a fully functional OTP installation. But let's make
820 the nifty installer:
821
822 5. `$ ./otp_build installer_win32` - Create the self extracting installer
823 executable. The executable `otp_win32_%OTP-REL%.exe` will be placed
824 in the top directory of the release created in the previous step. If
825 no release directory is specified, the release is expected to have
826 been built to `$ERL_TOP/release/win32`, which also will be the place
827 where the installer executable will be placed. If you specified some
828 other directory for the release (i.e. `./otp_build release -a
829 /tmp/erl_release`), you're expected to give the same parameter here,
830 (i.e. `./otp_build installer_win32 /tmp/erl_release`). You need to have
831 a full NSIS installation and `makensis.exe` in your path for this to
832 work of course. Once you have created the installer, you can run it to
833 install Erlang/OTP in the regular way, just run the executable and
834 follow the steps in the installation wizard. To get all default settings
835 in the installation without any questions asked, you run the executable
836 with the parameter `/S` (capital S) like in:
837
838 $ cd $ERL_TOP
839 $ release/win32/otp_win32_%OTP-REL% /S
840 ...
841
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
842 or
843
844 $ cd $ERL_TOP
845 $ release/win32/otp_win64_%OTP-REL% /S
846 ...
847
848
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
849 and after a while Erlang/OTP-%OTP-REL% will have been installed in
850 `C:\Program Files\erl%ERTS-VSN%\`, with shortcuts in the menu etc.
851
852 The necessary setup of an Erlang installation is actually done by the
853 program `Install.exe`, which resides in the release top. That program
854 creates `.ini`-files and copies the correct boot scripts. If one has
855 the correct directory tree (like after a `./otp_build release -a`), only
856 the running of `Install.exe` is necessary to get a fully functional
857 OTP. What the self extracting installer adds is (of course) the
858 possibility to distribute the binary easily, together with adding
859 shortcuts to the Windows start menu. There is also some adding of
860 entries in the registry, to associate `.erl` and `.beam` files with
861 Erlang and get nifty icons, but that's not something you'll really need
862 to run Erlang. The registry is also used to store uninstall information,
863 but if one has not used the self extracting installer, one cannot
864 (need not) do any uninstall, one just scratches the release directory
865 and everything is gone. Erlang/OTP does not *need* to put anything
866 in the Windows registry at all, and does not if you don't use the self
867 extracting installer. In other words the installer is pure cosmetics.
868
869 > *NOTE*: Beginning with R9C, the Windows installer does *not* add Erlang
870 > to the system wide path. If one wants to have Erlang in the path, one
871 > has to add it by hand.
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
872
873 Development
874 -----------
875
876 Once the system is built, you might want to change it. Having a test
877 release in some nice directory might be useful, but you also can run
878 Erlang from within the source tree. The target `local_setup`, makes
879 the program `$ERL_TOP/bin/erl.exe` usable and it also uses all the OTP
880 libraries in the source tree.
881
882 If you hack the emulator, you can then build the emulator executable
883 by standing in `$ERL_TOP/erts/emulator` and do a simple
884
885 $ make opt
886
887 Note that you need to have run ``(cd $ERL_TOP && eval `./otp_build env_win32`)``
888 in the particular shell before building anything on Windows. After
889 doing a make opt you can test your result by running `$ERL_TOP/bin/erl`.
890 If you want to copy the result to a release directory (say
891 `/tmp/erl_release`), you do this (still in `$ERL_TOP/erts/emulator`)
892
893 $ make TESTROOT=/tmp/erl_release release
894
895 That will copy the emulator executables.
896
897 To make a debug build of the emulator, you need to recompile both
898 `beam.dll` (the actual runtime system) and `erlexec.dll`. Do like this
899
900 $ cd $ERL_TOP
901 $ rm bin/win32/erlexec.dll
902 $ cd erts/emulator
903 $ make debug
904 $ cd ../etc
905 $ make debug
906
907 and sometimes
908
909 $ cd $ERL_TOP
910 $ make local_setup
911
912 So now when you run `$ERL_TOP/erl.exe`, you should have a debug compiled
913 emulator, which you will see if you do a:
914
915 1> erlang:system_info(system_version).
916
917 in the erlang shell. If the returned string contains `[debug]`, you
918 got a debug compiled emulator.
919
920 To hack the erlang libraries, you simply do a `make opt` in the
921 specific "applications" directory, like:
922
923 $ cd $ERL_TOP/lib/stdlib
924 $ make opt
925
926 or even in the source directory...
927
928 $ cd $ERL_TOP/lib/stdlib/src
929 $ make opt
930
931 Note that you're expected o have a fresh Erlang in your path when
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
932 doing this, preferably the plain %OTP-REL% you have built in the previous
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
933 steps. You could also add `$ERL_TOP/bootstrap/bin` to your `PATH` before
934 rebuilding specific libraries, that would give you a good enough
935 Erlang system to compile any OTP erlang code. Setting up the path
936 correctly is a little bit tricky, you still need to have
937 `$ERL_TOP/erts/etc/win32/cygwin_tools/vc` and
938 `$ERL_TOP/erts/etc/win32/cygwin_tools` *before* the actual emulator
939 in the path. A typical setting of the path for using the bootstrap
940 compiler would be:
941
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
942 $ export PATH=$ERL_TOP/erts/etc/win32/cygwin_tools/vc\
943 :$ERL_TOP/erts/etc/win32/cygwin_tools:$ERL_TOP/bootstrap/bin:$PATH
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
944
945 That should make it possible to rebuild any library without hassle...
946
947 If you want to copy a library (an application) newly built, to a
948 release area, you do like with the emulator:
949
950 $ cd $ERL_TOP/lib/stdlib
951 $ make TESTROOT=/tmp/erlang_release release
952
953 Remember that:
954
955 * Windows specific C-code goes in the `$ERL_TOP/erts/emulator/sys/win32`,
956 `$ERL_TOP/erts/emulator/drivers/win32` or `$ERL_TOP/erts/etc/win32`.
957
958 * Windows specific erlang code should be used conditionally and the
959 host OS tested in *runtime*, the exactly same beam files should be
960 distributed for every platform! So write code like:
961
962 case os:type() of
963 {win32,_} ->
964 do_windows_specific();
965 Other ->
966 do_fallback_or_exit()
967 end,
968
969 That's basically all you need to get going.
970
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
971 Using GIT
972 ---------
973
974 You might want to check out versions of the source code from GitHUB. That is possible directly in cygwin, but not in Msys. There is a project MsysGIT:
975
976 URL:<http://code.google.com/p/msysgit/>
977
978 that makes a nice Git port. The msys prompt you get from MsysGIT is
979 however not compatible with the full version from MinGW, so you will
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
980 need to check out files using MsysGIT's command prompt and then switch
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
981 to a common Msys command prompt for building. Also all test suites
982 cannot be built as MsysGIT/Msys does not handle symbolic links. To
983 build test suites on Windows, you will need Cygwin for now. Hopefully
984 all symbolic links will disappear from our repository soon and this
985 issue will disappear.
986
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
987 Final Words
988 -----------
989 My hope is that the possibility to build the whole system on Windows
990 will open up for free development on this platform too. There are many
991 things one might want to do better in the Windows version, like the
992 window-style command prompt as well as pure Cygwin porting. Although i
993 realize it's a much larger step to start building on Windows (with all
994 the software you need) than for instance on Linux, I sincerely hope
995 that some of you will make the effort and start submitting Windows
996 friendly patches.
997
998 The first build system for Erlang using Cygwin on Windows was created
999 by Per Bergkvist. I haven't used his build system, but it's rumored to
1000 be good. The idea to do this came from his work, so credit is well
1001 deserved.
1002
1003 Of course this would have been completely impossible without the
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
1004 excellent Cygwin. The guys at Cygnus solutions and
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
1005 Redhat deserve a huge THANKS! as well as all the other people in the
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
1006 free software community who have helped in creating the magnificent
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
1007 software that constitutes Cygwin.
1008
7cdb7fe @tuncer Fix typos in INSTALL-WIN32.md
tuncer authored
1009 Also the people developing the alternative command prompt Msys and
e3b1ff5 @bufflig Update INSTALL-WIN32.md to reflect changes in R15B
bufflig authored
1010 the MinGW compiler are worth huge THANKS! The 64bit port would have
1011 been impossible without the 64bit MinGW compiler.
1012
7aa2cb2 @rickard-green OTP-8449 Documentation improvements.
rickard-green authored
1013 Good luck and Happy Hacking,
1014 Patrik, OTP
1015
1016 Copyright and License
1017 ---------------------
1018
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
1019 %CopyrightBegin%
1020
ce4431b @psyeugenic Update copyright years
psyeugenic authored
1021 Copyright Ericsson AB 2003-2012. All Rights Reserved.
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
1022
1023 The contents of this file are subject to the Erlang Public License,
1024 Version 1.1, (the "License"); you may not use this file except in
1025 compliance with the License. You should have received a copy of the
1026 Erlang Public License along with this software. If not, it can be
1027 retrieved online at http://www.erlang.org/.
1028
1029 Software distributed under the License is distributed on an "AS IS"
1030 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
1031 the License for the specific language governing rights and limitations
1032 under the License.
1033
1034 %CopyrightEnd%
1035
1036 Modifying This Document
1037 -----------------------
1038
1039 Before modifying this document you need to have a look at the
1040 `$ERL_TOP/README.md.txt` document.
1041
4c3aebe @rickard-green OTP-8457 Minor documentation fixes. Mainly anchor adjustments.
rickard-green authored
1042
1043
1044 [1]: http://www.erlang.org/faq.html "mailing lists"
d041cab @rickard-green OTP-8512 Add Erlangish MarkDown to Erlangish XML support
rickard-green authored
1045
1046 [?TOC]: true
Something went wrong with that request. Please try again.