Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 1 | |
| 2 | NOTES FOR THE WINDOWS PLATFORMS |
| 3 | =============================== |
| 4 | |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 5 | Requirement details for native (Visual C++) builds |
| 6 | -------------------------------------------------- |
| 7 | |
Richard Levitte | 07930a7 | 2016-05-23 15:11:04 +0200 | [diff] [blame] | 8 | In addition to the requirements and instructions listed in INSTALL, |
| 9 | this are required as well: |
| 10 | |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 11 | - You need Perl. We recommend ActiveState Perl, available from |
Andy Polyakov | 3a80bd2 | 2017-03-14 21:29:24 +0100 | [diff] [blame] | 12 | https://www.activestate.com/ActivePerl. Another viable alternative |
| 13 | appears to be Strawberry Perl, http://strawberryperl.com. |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 14 | You also need the perl module Text::Template, available on CPAN. |
Richard Levitte | 07930a7 | 2016-05-23 15:11:04 +0200 | [diff] [blame] | 15 | Please read NOTES.PERL for more information. |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 16 | |
| 17 | - You need a C compiler. OpenSSL has been tested to build with these: |
| 18 | |
| 19 | * Visual C++ |
| 20 | |
| 21 | - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us, |
| 22 | is required if you intend to utilize assembler modules. Note that NASM |
| 23 | is the only supported assembler. The Microsoft provided assembler is NOT |
| 24 | supported. |
| 25 | |
| 26 | |
Richard Levitte | 8c16829 | 2016-03-17 10:08:25 +0100 | [diff] [blame] | 27 | Visual C++ (native Windows) |
| 28 | --------------------------- |
| 29 | |
| 30 | Installation directories |
| 31 | |
| 32 | The default installation directories are derived from environment |
| 33 | variables. |
| 34 | |
| 35 | For VC-WIN32, the following defaults are use: |
| 36 | |
| 37 | PREFIX: %ProgramFiles(86)%\OpenSSL |
| 38 | OPENSSLDIR: %CommonProgramFiles(86)%\SSL |
| 39 | |
Xiaoyin Liu | e7b6922 | 2016-09-25 21:28:02 -0400 | [diff] [blame] | 40 | For VC-WIN64, the following defaults are use: |
Richard Levitte | 8c16829 | 2016-03-17 10:08:25 +0100 | [diff] [blame] | 41 | |
| 42 | PREFIX: %ProgramW6432%\OpenSSL |
| 43 | OPENSSLDIR: %CommonProgramW6432%\SSL |
| 44 | |
| 45 | Should those environment variables not exist (on a pure Win32 |
| 46 | installation for examples), these fallbacks are used: |
| 47 | |
| 48 | PREFIX: %ProgramFiles%\OpenSSL |
| 49 | OPENSSLDIR: %CommonProgramFiles%\SSL |
| 50 | |
Richard Levitte | 1c7bfec | 2016-05-23 22:24:13 +0200 | [diff] [blame] | 51 | ALSO NOTE that those directories are usually write protected, even if |
| 52 | your account is in the Administrators group. To work around that, |
| 53 | start the command prompt by right-clicking on it and choosing "Run as |
| 54 | Administrator" before running 'nmake install'. The other solution |
| 55 | is, of course, to choose a different set of directories by using |
| 56 | --prefix and --openssldir when configuring. |
Richard Levitte | 8c16829 | 2016-03-17 10:08:25 +0100 | [diff] [blame] | 57 | |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 58 | GNU C (Cygwin) |
| 59 | -------------- |
| 60 | |
| 61 | Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the |
| 62 | Windows subsystem and provides a bash shell and GNU tools environment. |
| 63 | Consequently, a make of OpenSSL with Cygwin is virtually identical to the |
Andy Polyakov | ad83932 | 2016-03-14 18:04:21 +0100 | [diff] [blame] | 64 | Unix procedure. |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 65 | |
| 66 | To build OpenSSL using Cygwin, you need to: |
| 67 | |
Viktor Szakats | 497e986 | 2016-06-05 23:43:16 +0200 | [diff] [blame] | 68 | * Install Cygwin (see https://cygwin.com/) |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 69 | |
Andy Polyakov | ad83932 | 2016-03-14 18:04:21 +0100 | [diff] [blame] | 70 | * Install Cygwin Perl and ensure it is in the path. Recall that |
| 71 | as least 5.10.0 is required. |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 72 | |
| 73 | * Run the Cygwin bash shell |
| 74 | |
| 75 | Apart from that, follow the Unix instructions in INSTALL. |
| 76 | |
| 77 | NOTE: "make test" and normal file operations may fail in directories |
| 78 | mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin |
| 79 | stripping of carriage returns. To avoid this ensure that a binary |
| 80 | mount is used, e.g. mount -b c:\somewhere /home. |
| 81 | |
Andy Polyakov | ad83932 | 2016-03-14 18:04:21 +0100 | [diff] [blame] | 82 | It is also possible to create "conventional" Windows binaries that use |
| 83 | the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using MinGW |
| 84 | development add-on for Cygwin. MinGW is supported even as a standalone |
| 85 | setup as described in the following section. In the context you should |
| 86 | recognize that binaries targeting Cygwin itself are not interchangeable |
| 87 | with "conventional" Windows binaries you generate with/for MinGW. |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 88 | |
Richard Levitte | 3e67b33 | 2016-03-17 23:15:12 +0100 | [diff] [blame] | 89 | |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 90 | GNU C (MinGW/MSYS) |
Richard Levitte | 8c16829 | 2016-03-17 10:08:25 +0100 | [diff] [blame] | 91 | ------------------ |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 92 | |
| 93 | * Compiler and shell environment installation: |
| 94 | |
| 95 | MinGW and MSYS are available from http://www.mingw.org/, both are |
| 96 | required. Run the installers and do whatever magic they say it takes |
Andy Polyakov | ad83932 | 2016-03-14 18:04:21 +0100 | [diff] [blame] | 97 | to start MSYS bash shell with GNU tools and matching Perl on its PATH. |
| 98 | "Matching Perl" refers to chosen "shell environment", i.e. if built |
Matt Caswell | 8c4f803 | 2016-06-02 11:03:45 +0100 | [diff] [blame] | 99 | under MSYS, then Perl compiled for MSYS must be used. |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 100 | |
FdaSilvaYY | f430ba3 | 2016-06-19 19:39:01 +0200 | [diff] [blame] | 101 | Alternatively, one can use MSYS2 from https://msys2.github.io/, |
Richard Levitte | b32b896 | 2016-03-08 14:44:46 +0100 | [diff] [blame] | 102 | which includes MingW (32-bit and 64-bit). |
| 103 | |
| 104 | * It is also possible to cross-compile it on Linux by configuring |
| 105 | with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'. |
| 106 | Other possible cross compile prefixes include x86_64-w64-mingw32- |
| 107 | and i686-w64-mingw32-. |
| 108 | |
| 109 | |
Andy Polyakov | ad83932 | 2016-03-14 18:04:21 +0100 | [diff] [blame] | 110 | Linking your application |
| 111 | ------------------------ |
| 112 | |
| 113 | This section applies to non-Cygwin builds. |
| 114 | |
| 115 | If you link with static OpenSSL libraries then you're expected to |
Richard Levitte | 531e9dc | 2016-05-12 22:32:12 +0200 | [diff] [blame] | 116 | additionally link your application with WS2_32.LIB, GDI32.LIB, |
| 117 | ADVAPI32.LIB, CRYPT32.LIB and USER32.LIB. Those developing |
| 118 | non-interactive service applications might feel concerned about |
| 119 | linking with GDI32.LIB and USER32.LIB, as they are justly associated |
| 120 | with interactive desktop, which is not available to service |
| 121 | processes. The toolkit is designed to detect in which context it's |
| 122 | currently executed, GUI, console app or service, and act accordingly, |
| 123 | namely whether or not to actually make GUI calls. Additionally those |
| 124 | who wish to /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and |
| 125 | actually keep them off service process should consider implementing |
| 126 | and exporting from .exe image in question own _OPENSSL_isservice not |
| 127 | relying on USER32.DLL. E.g., on Windows Vista and later you could: |
Andy Polyakov | ad83932 | 2016-03-14 18:04:21 +0100 | [diff] [blame] | 128 | |
| 129 | __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void) |
| 130 | { DWORD sess; |
| 131 | if (ProcessIdToSessionId(GetCurrentProcessId(),&sess)) |
| 132 | return sess==0; |
| 133 | return FALSE; |
| 134 | } |
| 135 | |
| 136 | If you link with OpenSSL .DLLs, then you're expected to include into |
| 137 | your application code small "shim" snippet, which provides glue between |
| 138 | OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink |
| 139 | manual page for further details. |