]> git.ipfire.org Git - thirdparty/openssl.git/blob - INSTALL.WIN
GH787: Fix ALPN
[thirdparty/openssl.git] / INSTALL.WIN
1
2 INSTALLATION ON WINDOWS PLATFORMS
3 ---------------------------------
4
5 [Instructions for building for Windows CE can be found in INSTALL.WCE]
6
7 Here are a few comments about building OpenSSL for Windows environments.
8
9 - you need Perl. Unless you will build on Cygwin, you will need
10 ActiveState Perl, available from http://www.activestate.com/ActivePerl.
11 You also need the perl module Text::Template, available on CPAN.
12 Please read README.PERL for more information.
13
14 - one of the following C compilers:
15
16 * Visual C++
17 * GNU C (Cygwin or MinGW)
18
19 - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us,
20 is required if you intend to utilize assembler modules. Note that NASM
21 is now the only supported assembler. Without this the "Configure" step below
22 must be done with the "no-asm" option. The Microsoft provided assembler is NOT
23 supported.
24
25 Visual C++
26 ----------
27
28 If you want to compile in the assembly language routines with Visual
29 C++, then you will need the Netwide Assembler binary, nasmw.exe or nasm.exe, to
30 be available on your %PATH%.
31
32 Firstly you should run Configure and generate the Makefiles. If you don't want
33 the assembly language files then add the "no-asm" option (without quotes) to
34 the Configure lines below.
35
36 For Win32:
37
38 > perl Configure VC-WIN32 --prefix=c:\some\openssl\dir
39 > ms\do_nasm
40
41 Note: replace the last line above with the following if not using the assembly
42 language files:
43
44 > ms\do_ms
45
46 For Win64/x64:
47
48 > perl Configure VC-WIN64A --prefix=c:\some\openssl\dir
49 > ms\do_win64a
50
51 For Win64/IA64:
52
53 > perl Configure VC-WIN64I --prefix=c:\some\openssl\dir
54 > ms\do_win64i
55
56 Where the prefix argument specifies where OpenSSL will be installed to.
57
58 Then from the VC++ environment at a prompt do the following. Note, your %PATH%
59 and other environment variables should be set up for 32-bit or 64-bit
60 development as appropriate.
61
62 > nmake -f ms\ntdll.mak
63
64 If all is well it should compile and you will have some DLLs and
65 executables in out32dll. If you want to try the tests then do:
66
67 > nmake -f ms\ntdll.mak test
68
69 To install OpenSSL to the specified location do:
70
71 > nmake -f ms\ntdll.mak install
72
73 Tweaks:
74
75 There are various changes you can make to the Windows compile
76 environment. By default the library is not compiled with debugging
77 symbols. If you add --debug to the Configure lines above then debugging symbols
78 will be compiled in.
79
80 By default in 1.1.0 OpenSSL will compile builtin ENGINES into separate shared
81 libraries. If you specify the "enable-static-engine" option on the command line
82 to Configure the shared library build (ms\ntdll.mak) will compile the engines
83 into libcrypto32.dll instead.
84
85 You can also build a static version of the library using the Makefile
86 ms\nt.mak
87
88 GNU C (Cygwin)
89 --------------
90
91 Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the
92 Windows subsystem and provides a bash shell and GNU tools environment.
93 Consequently, a make of OpenSSL with Cygwin is virtually identical to the
94 Unix procedure. It is also possible to create Windows binaries that only
95 use the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using
96 MinGW. MinGW can be used in the Cygwin development environment or in a
97 standalone setup as described in the following section.
98
99 To build OpenSSL using Cygwin:
100
101 * Install Cygwin (see http://cygwin.com/)
102
103 * Install Perl and ensure it is in the path. Both Cygwin perl
104 (5.6.1-2 or newer) and ActivePerl work.
105
106 * Run the Cygwin bash shell
107
108 * $ tar zxvf openssl-x.x.x.tar.gz
109 $ cd openssl-x.x.x
110
111 To build the Cygwin version of OpenSSL:
112
113 $ ./config
114 [...]
115 $ make
116 [...]
117 $ make test
118 $ make install
119
120 This will create a default install in /usr/local/ssl.
121
122 To build the MinGW version (native Windows) in Cygwin:
123
124 $ ./Configure mingw
125 [...]
126 $ make
127 [...]
128 $ make test
129 $ make install
130
131 Cygwin Notes:
132
133 "make test" and normal file operations may fail in directories
134 mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
135 stripping of carriage returns. To avoid this ensure that a binary
136 mount is used, e.g. mount -b c:\somewhere /home.
137
138 GNU C (MinGW/MSYS)
139 -------------
140
141 * Compiler and shell environment installation:
142
143 MinGW and MSYS are available from http://www.mingw.org/, both are
144 required. Run the installers and do whatever magic they say it takes
145 to start MSYS bash shell with GNU tools on its PATH.
146
147 * Compile OpenSSL:
148
149 $ ./config
150 [...]
151 $ make
152 [...]
153 $ make test
154
155 This will create the library and binaries in root source directory
156 and openssl.exe application in apps directory.
157
158 It is also possible to cross-compile it on Linux by configuring
159 with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'. Other
160 possible targets include x86_64-w64-mingw32- and i686-w64-mingw32-.
161
162 libcrypto.a and libssl.a are the static libraries. To use the DLLs,
163 link with libcrypto32.a and libssl32.a instead.
164
165 Linking your application
166 ------------------------
167
168 If you link with static OpenSSL libraries [those built with ms/nt.mak],
169 then you're expected to additionally link your application with
170 WS2_32.LIB, ADVAPI32.LIB, GDI32.LIB and USER32.LIB. Those developing
171 non-interactive service applications might feel concerned about linking
172 with the latter two, as they are justly associated with interactive
173 desktop, which is not available to service processes. The toolkit is
174 designed to detect in which context it's currently executed, GUI,
175 console app or service, and act accordingly, namely whether or not to
176 actually make GUI calls. Additionally those who wish to
177 /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and actually keep them
178 off service process should consider implementing and exporting from
179 .exe image in question own _OPENSSL_isservice not relying on USER32.DLL.
180 E.g., on Windows Vista and later you could:
181
182 __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
183 { DWORD sess;
184 if (ProcessIdToSessionId(GetCurrentProcessId(),&sess))
185 return sess==0;
186 return FALSE;
187 }
188
189 If you link with OpenSSL .DLLs, then you're expected to include into
190 your application code small "shim" snippet, which provides glue between
191 OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
192 manual page for further details.