NOTES.WIN 5.7 KB

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