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