INSTALL.WIN 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. INSTALLATION ON WINDOWS PLATFORMS
  2. ---------------------------------
  3. [Instructions for building for Windows CE can be found in INSTALL.WCE]
  4. Here are a few comments about building OpenSSL for Windows environments.
  5. - you need Perl. Unless you will build on Cygwin, you will need
  6. ActiveState Perl, available from http://www.activestate.com/ActivePerl.
  7. You also need the perl module Text::Template, available on CPAN.
  8. Please read README.PERL for more information.
  9. - one of the following C compilers:
  10. * Visual C++
  11. * GNU C (Cygwin or MinGW)
  12. - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us,
  13. is required if you intend to utilize assembler modules. Note that NASM
  14. is now the only supported assembler. Without this the "Configure" step below
  15. must be done with the "no-asm" option. The Microsoft provided assembler is NOT
  16. supported.
  17. Visual C++
  18. ----------
  19. If you want to compile in the assembly language routines with Visual
  20. C++, then you will need the Netwide Assembler binary, nasmw.exe or nasm.exe, to
  21. be available on your %PATH%.
  22. Firstly you should run Configure and generate the Makefiles. If you don't want
  23. the assembly language files then add the "no-asm" option (without quotes) to
  24. the Configure lines below.
  25. For Win32:
  26. > perl Configure VC-WIN32 --prefix=c:\some\openssl\dir
  27. > ms\do_nasm
  28. Note: replace the last line above with the following if not using the assembly
  29. language files:
  30. > ms\do_ms
  31. For Win64/x64:
  32. > perl Configure VC-WIN64A --prefix=c:\some\openssl\dir
  33. > ms\do_win64a
  34. For Win64/IA64:
  35. > perl Configure VC-WIN64I --prefix=c:\some\openssl\dir
  36. > ms\do_win64i
  37. Where the prefix argument specifies where OpenSSL will be installed to.
  38. Then from the VC++ environment at a prompt do the following. Note, your %PATH%
  39. and other environment variables should be set up for 32-bit or 64-bit
  40. development as appropriate.
  41. > nmake -f ms\ntdll.mak
  42. If all is well it should compile and you will have some DLLs and
  43. executables in out32dll. If you want to try the tests then do:
  44. > nmake -f ms\ntdll.mak test
  45. To install OpenSSL to the specified location do:
  46. > nmake -f ms\ntdll.mak install
  47. Tweaks:
  48. There are various changes you can make to the Windows compile
  49. environment. By default the library is not compiled with debugging
  50. symbols. If you add --debug to the Configure lines above then debugging symbols
  51. will be compiled in.
  52. By default in 1.1.0 OpenSSL will compile builtin ENGINES into separate shared
  53. libraries. If you specify the "enable-static-engine" option on the command line
  54. to Configure the shared library build (ms\ntdll.mak) will compile the engines
  55. into libeay32.dll instead.
  56. You can also build a static version of the library using the Makefile
  57. ms\nt.mak
  58. GNU C (Cygwin)
  59. --------------
  60. Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the
  61. Windows subsystem and provides a bash shell and GNU tools environment.
  62. Consequently, a make of OpenSSL with Cygwin is virtually identical to the
  63. Unix procedure. It is also possible to create Windows binaries that only
  64. use the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using
  65. MinGW. MinGW can be used in the Cygwin development environment or in a
  66. standalone setup as described in the following section.
  67. To build OpenSSL using Cygwin:
  68. * Install Cygwin (see http://cygwin.com/)
  69. * Install Perl and ensure it is in the path. Both Cygwin perl
  70. (5.6.1-2 or newer) and ActivePerl work.
  71. * Run the Cygwin bash shell
  72. * $ tar zxvf openssl-x.x.x.tar.gz
  73. $ cd openssl-x.x.x
  74. To build the Cygwin version of OpenSSL:
  75. $ ./config
  76. [...]
  77. $ make
  78. [...]
  79. $ make test
  80. $ make install
  81. This will create a default install in /usr/local/ssl.
  82. To build the MinGW version (native Windows) in Cygwin:
  83. $ ./Configure mingw
  84. [...]
  85. $ make
  86. [...]
  87. $ make test
  88. $ make install
  89. Cygwin Notes:
  90. "make test" and normal file operations may fail in directories
  91. mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
  92. stripping of carriage returns. To avoid this ensure that a binary
  93. mount is used, e.g. mount -b c:\somewhere /home.
  94. GNU C (MinGW/MSYS)
  95. -------------
  96. * Compiler and shell environment installation:
  97. MinGW and MSYS are available from http://www.mingw.org/, both are
  98. required. Run the installers and do whatever magic they say it takes
  99. to start MSYS bash shell with GNU tools on its PATH.
  100. * Compile OpenSSL:
  101. $ ./config
  102. [...]
  103. $ make
  104. [...]
  105. $ make test
  106. This will create the library and binaries in root source directory
  107. and openssl.exe application in apps directory.
  108. It is also possible to cross-compile it on Linux by configuring
  109. with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'. Other
  110. possible targets include x86_64-w64-mingw32- and i686-w64-mingw32-.
  111. libcrypto.a and libssl.a are the static libraries. To use the DLLs,
  112. link with libeay32.a and libssl32.a instead.
  113. Linking your application
  114. ------------------------
  115. If you link with static OpenSSL libraries [those built with ms/nt.mak],
  116. then you're expected to additionally link your application with
  117. WS2_32.LIB, ADVAPI32.LIB, GDI32.LIB and USER32.LIB. Those developing
  118. non-interactive service applications might feel concerned about linking
  119. with the latter two, as they are justly associated with interactive
  120. desktop, which is not available to service processes. The toolkit is
  121. designed to detect in which context it's currently executed, GUI,
  122. console app or service, and act accordingly, namely whether or not to
  123. actually make GUI calls. Additionally those who wish to
  124. /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL and actually keep them
  125. off service process should consider implementing and exporting from
  126. .exe image in question own _OPENSSL_isservice not relying on USER32.DLL.
  127. E.g., on Windows Vista and later you could:
  128. __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
  129. { DWORD sess;
  130. if (ProcessIdToSessionId(GetCurrentProcessId(),&sess))
  131. return sess==0;
  132. return FALSE;
  133. }
  134. If you link with OpenSSL .DLLs, then you're expected to include into
  135. your application code small "shim" snippet, which provides glue between
  136. OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
  137. manual page for further details.