Ticket #13081: building-tor-windows3.txt

File building-tor-windows3.txt, 4.1 KB (added by NewEraCracker, 5 years ago)

Tutorial as of Sept 11th

Line 
1Building Tor with MSVC.
2=======================
3
4NOTE: This is not the preferred method for building Tor on windows: we use
5mingw for our packages.
6
7Last updated 11 September 2014.
8
9
10Requirements:
11-------------
12
13 * Visual Studio 2010
14    http://go.microsoft.com/fwlink/?LinkId=323467
15 * CMake 2.8.12.2
16    http://www.cmake.org/download/
17 * Perl 5.16
18    http://www.activestate.com/activeperl/downloads
19 * Latest stable OpenSSL tarball
20    https://www.openssl.org/source/
21 * Latest stable zlib tarball
22    http://zlib.net/
23 * Latest stable libevent tarball
24    https://github.com/libevent/libevent/releases
25
26Make sure you check signatures for all these packages.
27
28Steps:
29------
30
31Building OpenSSL from source as a shared library:
32
33 cd <openssl source dir>
34 perl Configure VC-WIN32
35 perl util\mkfiles.pl >MINFO
36 perl util\mk1mf.pl no-asm dll VC-WIN32 >32dll.mak
37 perl util\mkdef.pl 32 libeay > ms\libeay32.def
38 perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
39 nmake -f 32dll.mak
40
41Making OpenSSL final package:
42
43 Create <openssl final package dir>, I'd recommend using a name like <openssl source dir>-vc10.
44
45 Copy the following directories and files to their respective locations
46  <openssl source dir>\inc32\openssl => <openssl final package dir>\include\openssl
47  <openssl source dir>\out32dll\libeay32.lib => <openssl final package dir>\lib\libeay32.lib
48  <openssl source dir>\out32dll\ssleay32.lib => <openssl final package dir>\lib\ssleay32.lib
49  <openssl source dir>\out32dll\libeay32.dll => <openssl final package dir>\bin\libeay32.dll
50  <openssl source dir>\out32dll\openssl.exe => <openssl final package dir>\bin\openssl.exe
51  <openssl source dir>\out32dll\ssleay32.dll => <openssl final package dir>\bin\ssleay32.dll
52
53Building Zlib from source:
54
55 cd <zlib source dir>
56 nmake -f win32\Makefile.msc
57
58Building libevent:
59
60 cd <libevent source dir>
61 mkdir build && cd build
62 SET OPENSSL_ROOT_DIR=<openssl final package dir>
63 cmake -G "NMake Makefiles" .. -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MD /Zi /O2 /Ob1 /D NDEBUG" -DZLIB_LIBRARY:FILEPATH="<zlib source dir>\zdll.lib" -DZLIB_INCLUDE_DIR:PATH="<zlib source dir>"
64 nmake event
65
66Building Tor:
67
68 Create a dir above tor source dir named build-alpha and two subdirs include and lib.
69
70 Your build tree should now be similar to this one:
71  * build-alpha
72    - include
73    - lib
74  * <libevent source dir>
75    - build
76    - cmake
77    - ...
78  * <openssl source dir>
79    - ...
80    - ms
81    - util
82    - ...
83  * <openssl final package dir>
84    - bin
85    - include
86    - lib
87  * <tor source dir>
88    - ...
89    - src
90    - ...
91  * <zlib source dir>
92    - ...
93    - win32
94    - ...
95
96 Copy the following dirs and files to the following locations:
97  <openssl final package dir>\include\openssl => build-alpha\include\openssl
98  <libevent source dir>\include => build-alpha\include
99  <libevent source dir>\WIN32-Code\nmake\event2 => build-alpha\include\event2
100  <zlib source dir>\z*.h => build-alpha\include\z*.h
101
102 Now copy the following files to the following locations:
103
104  <libevent source dir>\build\lib\event.lib => build-alpha\lib\event.lib
105  <openssl final package dir>\lib\libeay32.lib => build-alpha\lib\libeay32.lib
106  <openssl final package dir>\lib\ssleay32.lib => build-alpha\lib\ssleay32.lib
107  <zlib source dir>\zdll.lib => build-alpha\lib\zdll.lib
108
109 And we are now ready for the build process:
110
111  cd <tor source dir>
112  NMAKE /f "Makefile.nmake" all CFG="Release"
113
114Some final notes:
115
116 After build process is completed there should be a tor.exe in <tor source dir>\src\or
117
118 You will need to copy tor.exe to desired location.
119
120 The following DLLs are also required to be in the same location as tor.exe:
121  libeay32.dll
122  ssleay32.dll
123  zlib1.dll
124
125 To install this is another computer you will also need Visual C++ 2010 Redistributable Package installed or this two DLLs in application folder:
126  msvcp100.dll
127  msvcr100.dll
128
129 The above DLLs can be copied from redist directory from your Visual Studio distribution, normally:
130  C:\Program Files\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT