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