blob: a2e91201ab3e3bd29f0c1d23a40b3f133be55ab2 [file] [log] [blame]
Richard Levitteb32b8962016-03-08 14:44:46 +01001
2 NOTES FOR THE WINDOWS PLATFORMS
3 ===============================
4
Richard Levitteb32b8962016-03-08 14:44:46 +01005 Requirement details for native (Visual C++) builds
6 --------------------------------------------------
7
Richard Levitte07930a72016-05-23 15:11:04 +02008 In addition to the requirements and instructions listed in INSTALL,
9 this are required as well:
10
Richard Levitteb32b8962016-03-08 14:44:46 +010011 - You need Perl. We recommend ActiveState Perl, available from
12 http://www.activestate.com/ActivePerl.
13 You also need the perl module Text::Template, available on CPAN.
Richard Levitte07930a72016-05-23 15:11:04 +020014 Please read NOTES.PERL for more information.
Richard Levitteb32b8962016-03-08 14:44:46 +010015
16 - You need a C compiler. OpenSSL has been tested to build with these:
17
18 * Visual C++
19
20 - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us,
21 is required if you intend to utilize assembler modules. Note that NASM
22 is the only supported assembler. The Microsoft provided assembler is NOT
23 supported.
24
25
Richard Levitte8c168292016-03-17 10:08:25 +010026 Visual C++ (native Windows)
27 ---------------------------
28
29 Installation directories
30
31 The default installation directories are derived from environment
32 variables.
33
34 For VC-WIN32, the following defaults are use:
35
36 PREFIX: %ProgramFiles(86)%\OpenSSL
37 OPENSSLDIR: %CommonProgramFiles(86)%\SSL
38
39 For VC-WIN32, the following defaults are use:
40
41 PREFIX: %ProgramW6432%\OpenSSL
42 OPENSSLDIR: %CommonProgramW6432%\SSL
43
44 Should those environment variables not exist (on a pure Win32
45 installation for examples), these fallbacks are used:
46
47 PREFIX: %ProgramFiles%\OpenSSL
48 OPENSSLDIR: %CommonProgramFiles%\SSL
49
50
Richard Levitteb32b8962016-03-08 14:44:46 +010051 GNU C (Cygwin)
52 --------------
53
54 Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the
55 Windows subsystem and provides a bash shell and GNU tools environment.
56 Consequently, a make of OpenSSL with Cygwin is virtually identical to the
Andy Polyakovad839322016-03-14 18:04:21 +010057 Unix procedure.
Richard Levitteb32b8962016-03-08 14:44:46 +010058
59 To build OpenSSL using Cygwin, you need to:
60
61 * Install Cygwin (see http://cygwin.com/)
62
Andy Polyakovad839322016-03-14 18:04:21 +010063 * Install Cygwin Perl and ensure it is in the path. Recall that
64 as least 5.10.0 is required.
Richard Levitteb32b8962016-03-08 14:44:46 +010065
66 * Run the Cygwin bash shell
67
68 Apart from that, follow the Unix instructions in INSTALL.
69
70 NOTE: "make test" and normal file operations may fail in directories
71 mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
72 stripping of carriage returns. To avoid this ensure that a binary
73 mount is used, e.g. mount -b c:\somewhere /home.
74
Andy Polyakovad839322016-03-14 18:04:21 +010075 It is also possible to create "conventional" Windows binaries that use
76 the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using MinGW
77 development add-on for Cygwin. MinGW is supported even as a standalone
78 setup as described in the following section. In the context you should
79 recognize that binaries targeting Cygwin itself are not interchangeable
80 with "conventional" Windows binaries you generate with/for MinGW.
Richard Levitteb32b8962016-03-08 14:44:46 +010081
Richard Levitte3e67b332016-03-17 23:15:12 +010082
Richard Levitteb32b8962016-03-08 14:44:46 +010083 GNU C (MinGW/MSYS)
Richard Levitte8c168292016-03-17 10:08:25 +010084 ------------------
Richard Levitteb32b8962016-03-08 14:44:46 +010085
86 * Compiler and shell environment installation:
87
88 MinGW and MSYS are available from http://www.mingw.org/, both are
89 required. Run the installers and do whatever magic they say it takes
Andy Polyakovad839322016-03-14 18:04:21 +010090 to start MSYS bash shell with GNU tools and matching Perl on its PATH.
91 "Matching Perl" refers to chosen "shell environment", i.e. if built
92 under MSYS, then Perl compiled for MSYS is highly recommended.
Richard Levitteb32b8962016-03-08 14:44:46 +010093
94 Alternativelly, one can use MSYS2 from http://msys2.github.io/,
95 which includes MingW (32-bit and 64-bit).
96
97 * It is also possible to cross-compile it on Linux by configuring
98 with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'.
99 Other possible cross compile prefixes include x86_64-w64-mingw32-
100 and i686-w64-mingw32-.
101
102
Andy Polyakovad839322016-03-14 18:04:21 +0100103 Linking your application
104 ------------------------
105
106 This section applies to non-Cygwin builds.
107
108 If you link with static OpenSSL libraries then you're expected to
Richard Levitte531e9dc2016-05-12 22:32:12 +0200109 additionally link your application with WS2_32.LIB, GDI32.LIB,
110 ADVAPI32.LIB, CRYPT32.LIB and USER32.LIB. Those developing
111 non-interactive service applications might feel concerned about
112 linking with GDI32.LIB and USER32.LIB, as they are justly associated
113 with interactive desktop, which is not available to service
114 processes. The toolkit is designed to detect in which context it's
115 currently executed, GUI, console app or service, and act accordingly,
116 namely whether or not to actually make GUI calls. Additionally those
117 who wish to /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and
118 actually keep them off service process should consider implementing
119 and exporting from .exe image in question own _OPENSSL_isservice not
120 relying on USER32.DLL. E.g., on Windows Vista and later you could:
Andy Polyakovad839322016-03-14 18:04:21 +0100121
122 __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
123 { DWORD sess;
124 if (ProcessIdToSessionId(GetCurrentProcessId(),&sess))
125 return sess==0;
126 return FALSE;
127 }
128
129 If you link with OpenSSL .DLLs, then you're expected to include into
130 your application code small "shim" snippet, which provides glue between
131 OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
132 manual page for further details.