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