Merge pull request #22 from magnumripper/typo
[hashcat.git] / docs / BUILD.md
1 oclHashcat build documentation
2 =
3 # Revision:
4 * 1.0
5
6 # Authors:
7 * Gabriele Gristina <<matrix@hashcat.net>>
8 * Christoph Heuwieser <<dropdead@hashcat.net>>
9
10 # Dependencies
11
12 To compile **oclHashcat** the following third party libraries are required:
13
14     ADL_SDK v8.0 - http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk/
15     cuda v7.5 - https://developer.nvidia.com/cuda-downloads
16     GDK v352_55 - https://developer.nvidia.com/gpu-deployment-kit
17     NVIDIA Driver v352.21 - https://www.nvidia.com/download/driverResults.aspx/86390/en-us
18     NVAPI R352 - https://developer.nvidia.com/nvapi
19     AMD-APP-SDK v3.0 - http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/
20     
21 To be able to compile the ocl binaries, it is required to have the latest stable driver from AMD installed.
22 (fglxr must be installed and initialized)
23
24     http://support.amd.com/
25
26 The next thing to do is download all the third party libraries listed above and put these files into the *deps/tmp* directory.
27
28 The following files are needed inside the *deps/tmp* directory:
29     
30     ADL_SDK8.zip
31     R352-developer.zip
32     cuda_7.5.18_linux.run
33     NVIDIA-Linux-x86_64-352.21.run
34     gdk_linux_amd64_352_55_release.run
35     AMD-APP-SDKInstaller-v3.0.130.135-GA-linux64.tar.bz2
36
37 Now just execute the following script to complete the installation of dependencies (check for an updated version in **tools/deps.sh**):
38
39     #!/bin/bash
40     # Author: Gabriele Gristina <matrix@hashcat.net>
41     # Revision: 1.02
42     
43     ## global vars
44     DEPS="make gcc g++ gcc-multilib g++-multilib libc6-dev-i386 mingw-w64 build-essential unzip"
45     DOWNLOAD_DEPS="ADL_SDK8.zip R352-developer.zip cuda_7.5.18_linux.run NVIDIA-Linux-x86_64-352.21.run gdk_linux_amd64_352_55_release.run AMD-APP-SDKInstaller-v3.0.130.135-GA-linux64.tar.bz2"
46     
47     ## enter the deps directory
48     cur_directory=$(dirname ${0})
49     script_directory=$(cd ${cur_directory} && pwd -P)
50     deps_dir=${script_directory}/../deps
51     
52     mkdir -p ${deps_dir} # but it should already exist (is part of the repository)
53     cd ${deps_dir}
54     
55     ## cleanup the directories under the 'deps' folder
56     rm -rf {adl-sdk,cuda-7.5,NVIDIA-Linux-x86_64-352.21,nvidia-gdk,amd-app-sdk} && \
57     mkdir -p {tmp,adl-sdk,cuda-7.5,NVIDIA-Linux-x86_64-352.21,nvidia-gdk,amd-app-sdk} && \
58     cd tmp/
59     
60     if [ $? -ne 0 ]; then
61       echo "! Cannot create deps directories."
62       exit 1
63     fi
64     
65     ## check dependencies
66     i=0
67     for d in ${DOWNLOAD_DEPS}; do
68       if [ ! -f "${d}" ]; then
69         echo "! ${d} not found."
70         ((i++))
71       fi
72     done
73     
74     if [ ${i} -gt 0 ]; then
75       echo "! Please manually download all the above dependencies to the deps/tmp/ directory"
76       exit 1
77     fi
78     
79     ## installing needed packages
80     for pkg in ${DEPS}; do
81     
82       # check if the package is already installed
83       dpkg -s ${pkg} &>/dev/null
84       if [ $? -ne 0 ]; then
85         ## root check
86         if [ $(id -u) -ne 0 ]; then
87           echo "! Must be root to install the required package '${pkg}' with apt-get"
88           exit 1
89         fi
90     
91         apt-get -y install ${pkg}
92         if [ $? -ne 0 ]; then
93           echo "! failed to install ${pkg}"
94           exit 1
95         fi
96       fi
97     done
98     
99     ## extract ADL SDK
100     unzip ADL_SDK8.zip -d ${deps_dir}/adl-sdk-8
101     ret=$?
102     
103     if [[ ${ret} -ne 0 ]] && [[ ${ret} -ne 1 ]]; then
104       echo "! failed to extract ADL SDK"
105       exit 1
106     fi
107     
108     rm -rf ${deps_dir}/adl-sdk && ln -s ${deps_dir}/adl-sdk-8 ${deps_dir}/adl-sdk
109     
110     if [ $? -ne 0 ]; then
111       echo "! failed to setup ADL SDK link"
112       exit 1
113     fi
114     
115     ## extract NVAPI
116     unzip R352-developer.zip -d ${deps_dir}
117     ret=$?
118     
119     if [[ ${ret} -ne 0 ]] && [[ ${ret} -ne 1 ]]; then
120       echo "! failed to extract NVAPI"
121       exit 1
122     fi
123     
124     ## install CUDA SDK
125     chmod +x cuda_7.5.18_linux.run && \
126     ./cuda_7.5.18_linux.run -toolkit -silent -override --toolkitpath=${deps_dir}/cuda-7.5
127     
128     if [ $? -ne 0 ]; then
129       echo "! failed to install CUDA SDK"
130       exit 1
131     fi
132     
133     ## install NVIDIA Driver
134     chmod +x NVIDIA-Linux-x86_64-352.21.run && \
135     ./NVIDIA-Linux-x86_64-352.21.run -x && \
136     mv NVIDIA-Linux-x86_64-352.21 ${deps_dir}/ && \
137     cd ${deps_dir}/NVIDIA-Linux-x86_64-352.21 && \
138     ln -s libnvidia-ml.so.352.21 libnvidia-ml.so && \
139     ln -s libcuda.so.352.21 libcuda.so && \
140     cd 32 && \
141     ln -s libnvidia-ml.so.352.21 libnvidia-ml.so && \
142     ln -s libcuda.so.352.21 libcuda.so && \
143     cd ${deps_dir}/tmp
144     
145     if [ $? -ne 0 ]; then
146       echo "! failed to install NVIDIA Driver"
147       exit 1
148     fi
149     
150     ## install NVIDIA GPU Deployment Kit
151     chmod +x gdk_linux_amd64_352_55_release.run && \
152     ./gdk_linux_amd64_352_55_release.run --silent --installdir=${deps_dir}/nvidia-gdk
153     
154     if [ $? -ne 0 ]; then
155       echo "! failed to install NVIDIA GPU Deployment Kit"
156       exit 1
157     fi
158     
159     ## extract AMD APP SDK
160     tar xjf AMD-APP-SDKInstaller-v3.0.130.135-GA-linux64.tar.bz2 && \
161     ./AMD-APP-SDK-v3.0.130.135-GA-linux64.sh --noexec --target ${deps_dir}/amd-app-sdk-v3.0.130.135
162     
163     if [ $? -ne 0 ]; then
164       echo "! failed to extract AMD APP SDK"
165       exit 1
166     fi
167     
168     rm -rf ${deps_dir}/amd-app-sdk && ln -s ${deps_dir}/amd-app-sdk-v3.0.130.135 ${deps_dir}/amd-app-sdk
169     
170     if [ $? -ne 0 ]; then
171       echo "! failed to setup ADL SDK link"
172       exit 1
173     fi
174     
175     echo "> oclHashcat dependencies have been resolved."
176     
177 # Building oclHashcat
178 First get a copy of **oclHashcat** repository
179
180 ```sh
181 $ git clone https://github.com/hashcat/oclHashcat.git
182 ```
183
184 Now simply jump in and type "make all"
185
186 ```sh
187 $ cd oclHashcat
188 $ make all
189 ```
190
191 Useful tricks:
192 - build only *Linux* binaries
193 ```sh
194 $ make linux
195 ```
196 - build only *Windows* binaries
197 ```sh
198 $ make windows
199 ```
200 - build only *AMD kernel* binaries
201 ```sh
202 $ make amd_all
203 ```
204 - build only *NVIDIA kernel* binaries
205 ```sh
206 $ make nv_all
207 ```
208
209 =
210 Enjoy your fresh **oclHashcat** binaries ;)