windows-build.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. ######################################################################################
  2. # #
  3. # Native WIN32 setup and build instructions (on mingw32/Windows): #
  4. # #
  5. ######################################################################################
  6. (See bottom of file for steps to cross-build for Win32 from Linux.)
  7. **************************************************************************************
  8. * Introduction *
  9. **************************************************************************************
  10. The following instructions have been tested on both Windows 7 and Windows XP.
  11. Most of what is described below (copying files, downloading files, etc.) can be done
  12. directly in the MinGW MSYS shell; these instructions do not do so because package
  13. versions and links change over time. The best way is to use your browser, go to the
  14. links directly, and see for yourself which versions you want to install.
  15. Winrar was used to do the extracting of archive files in the making of this guide.
  16. If you think that this documentation was helpful and you wish to donate, you can
  17. do so at the following address. 12KaKtrK52iQjPdtsJq7fJ7smC32tXWbWr
  18. **************************************************************************************
  19. * A tip that might help you along the way *
  20. **************************************************************************************
  21. Enable "QuickEdit Mode" in your Command Prompt Window or MinGW Command Prompt
  22. Window (No need to go into the context menu to choose edit-mark/copy/paste):
  23. Right-click on the title bar and click Properties. Under the Options tab, check
  24. the box for "QuickEdit Mode". Alternately, if you want this change to be
  25. permanent on all of your Command Prompt Windows; you can click Defaults instead
  26. of Properties as described above. Now you can drag and select text you want to
  27. copy, right-click to copy the text to the clipboard and right-click once again to
  28. paste it at the desired location. You could for example, copy some text from this
  29. document to the clipboard and right click in your Command Prompt Window to paste
  30. what you copied.
  31. **************************************************************************************
  32. * Install mingw32 *
  33. **************************************************************************************
  34. Go to this url ==> http://www.mingw.org/wiki/Getting_Started
  35. Click the link that says "Download and run the latest mingw-get-inst version."
  36. Download and run the latest file. Install MinGW in the default directory.
  37. (I downloaded the one labeled "mingw-get-inst-20120426" - note that this could
  38. be a different version later.)
  39. Make sure to check the option for "Download latest repository catalogs".
  40. I just selected all the check boxes (excluding "Fortran Compiler") so that everything
  41. was installed.
  42. **************************************************************************************
  43. * Run the MSYS shell for the first time to create your user directory *
  44. **************************************************************************************
  45. (Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell).
  46. This will create your user directory for you.
  47. **************************************************************************************
  48. * Install libpdcurses *
  49. **************************************************************************************
  50. Type the lines below to install libpdcurses.
  51. mingw-get install mingw32-libpdcurses
  52. mingw-get install mingw32-pdcurses
  53. Ctrl-D or typing "logout" and pressing the enter key should get you out of the
  54. window.
  55. **************************************************************************************
  56. * Copy CGMiner source to your MSYS working directory *
  57. **************************************************************************************
  58. Copy CGMiner source code directory into:
  59. \MinGW\msys\1.0\home\(folder with your user name)
  60. **************************************************************************************
  61. * Install AMD APP SDK, latest version (only if you want GPU mining) *
  62. **************************************************************************************
  63. Note: You do not need to install the AMD APP SDK if you are only using Nvidia GPU's
  64. Go to this url for the latest AMD APP SDK:
  65. http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/
  66. Go to this url for legacy AMD APP SDK's:
  67. http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/download-archive/
  68. Download and install whichever version you like best.
  69. Copy the folders in \Program Files (x86)\AMD APP\include to \MinGW\include
  70. Copy \Program Files (x86)\AMD APP\lib\x86\libOpenCL.a to \MinGW\lib
  71. Note: If you are on a 32 bit version of windows "Program Files (x86)" will be
  72. "Program Files".
  73. Note2: If you update your APP SDK later you might want to recopy the above files
  74. **************************************************************************************
  75. * Install AMD ADL SDK, latest version (only if you want GPU monitoring) *
  76. **************************************************************************************
  77. Note: You do not need to install the AMD ADL SDK if you are only using Nvidia GPU's
  78. Go to this url ==> http://developer.amd.com/tools/graphics-development/display-library-adl-sdk/
  79. Download and unzip the file you downloaded.
  80. Pull adl_defines.h, adl_sdk.h, and adl_structures.h out of the include folder
  81. Put those files into the ADL_SDK folder in your source tree as shown below.
  82. \MinGW\msys\1.0\home\(folder with your user name)\cgminer-x.x.x\ADL_SDK
  83. **************************************************************************************
  84. * Install GTK-WIN, required for Pkg-config in the next step *
  85. **************************************************************************************
  86. Go to this url ==> http://sourceforge.net/projects/gtk-win/
  87. Download the file.
  88. After you have downloaded the file Double click/run it and this will install GTK+
  89. I chose all the selection boxes when I installed.
  90. Copy libglib-2.0-0.dll and intl.dll from \Program Files (x86)\gtk2-runtime\bin to
  91. \MinGW\bin
  92. Note: If you are on a 32 bit version of windows "Program Files (x86)" will be
  93. "Program Files".
  94. **************************************************************************************
  95. * Install pkg-config *
  96. **************************************************************************************
  97. Go to this url ==> http://www.gtk.org/download/win32.php
  98. Scroll down to where it shows pkg-cfg.
  99. Download the file from the tool link. Extract "pkg-config.exe" from bin and place in
  100. your \MinGW\bin directory.
  101. Download the file from the "Dev" link. Extract "pkg.m4" from share\aclocal and place
  102. in your \MingW\share\aclocal directory.
  103. **************************************************************************************
  104. * Install libcurl *
  105. **************************************************************************************
  106. Go to this url ==> http://curl.haxx.se/download.html#Win32
  107. At the section where it says "Win32 - Generic", Click on the link that indicates
  108. Win32 2000.XP 7.27.0 libcurl SSL and download it.
  109. The one I downloaded may not be current for you. Choose the latest.
  110. Extract the files that are in the zip (bin, include, and lib) to their respective
  111. locations in MinGW (\MinGW\bin, \MinGW\include, and \MinGW\lib).
  112. Edit the file \MinGW\lib\pkgconfig\libcurl.pc and change "-lcurl" to
  113. "-lcurl -lcurldll".
  114. Ref. http://old.nabble.com/gcc-working-with-libcurl-td20506927.html
  115. **************************************************************************************
  116. * Build cgminer.exe *
  117. **************************************************************************************
  118. Run the MinGW MSYS shell
  119. (Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell).
  120. Change the working directory to your CGMiner project folder.
  121. Example: cd cgminer-2.1.2 [Enter Key] if you are unsure then type "ls -la"
  122. Another way is to type "cd cg" and then press the tab key; It will auto fill.
  123. Type the lines below one at a time. Look for problems after each one before going on
  124. to the next.
  125. adl.sh (optional - see below)
  126. autoreconf -fvi
  127. CFLAGS="-O2 -msse2" ./configure (additional config options, see below)
  128. make
  129. strip cgminer.exe <== only do this if you are not compiling for debugging
  130. **************************************************************************************
  131. * Copy files to a build directory/folder *
  132. **************************************************************************************
  133. Make a directory and copy the following files into it. This will be your CGMiner
  134. Folder that you use for mining. Remember the .cl filenames could change on later
  135. releases. If you installed a different version of libcurl then some of those dll's
  136. may be different as well.
  137. cgminer.exe from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x
  138. *.cl from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x
  139. README from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x
  140. libcurl.dll from \MinGW\bin
  141. libidn-11.dll from \MinGW\bin
  142. libeay32.dll from \MinGW\bin
  143. ssleay32.dll from \MinGW\bin
  144. libpdcurses.dll from \MinGW\bin
  145. pthreadGC2.dll from \MinGW\bin
  146. **************************************************************************************
  147. * Optional - Install Git into MinGW/MSYS *
  148. **************************************************************************************
  149. Go to this url ==> http://code.google.com/p/msysgit/
  150. Click on the Downloads tab.
  151. Download the latest "Portable" git archive.
  152. Extract the git*.exe files from the bin folder and put them into \MinGW\bin.
  153. Extract the share\git-core folder and place it into \MinGW\share.
  154. After the previous step you should have a folder called \MinGW\share\git-core.
  155. To test if it is working, open a MinGW shell and type the following:
  156. git config -–global core.autocrlf false (note: one time run only)
  157. git clone git://github.com/ckolivas/cgminer.git
  158. If you simply just want to update the source after you have already cloned, type:
  159. git pull
  160. "git pull" did not work for me. Try the following which does the same thing:
  161. git fetch && git merge FETCH_HEAD
  162. Now you can get the latest source directly from github.
  163. **************************************************************************************
  164. * Optional - Make a .sh file to automate copying over ADL files *
  165. **************************************************************************************
  166. Make a folder/directory in your home folder and name it ADL_SDK.
  167. (ref: \MinGW\msys\1.0\home\(folder with your user name)\ADL_SDK)
  168. Copy the ADL .h files into that folder/directory.
  169. Open your favorite text editor and type the following into it.
  170. cp -av ../ADL_SDK/*.h ADL_SDK
  171. Save the file as "adl.sh" and then place the file into "\MinGW\msys\1.0\bin".
  172. From now on when your current working directory is the cgminer source directory
  173. You can simply type "adl.sh" and it will place the ADL header files into place
  174. For you. Make sure you never remove the ADL_SDK folder from your home folder.
  175. **************************************************************************************
  176. * Optional - Install libusb if you need auto USB device detection; required for Ztex *
  177. **************************************************************************************
  178. Go to this url ==> http://git.libusb.org/?p=libusb.git;a=snapshot;h=master;sf=zip
  179. save the file to your local storage. Open the file and copy the libusb* folder to
  180. \MinGW\msys\1.0\home\(your user directory/folder).
  181. Or if you do not want to download the file directly and would like to use git then
  182. Type the following from the MSYS shell in your home folder.
  183. git clone git://git.libusb.org/libusb.git
  184. Run the MinGW MSYS shell
  185. (Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell).
  186. Change the working directory to your libusb project folder.
  187. Example: cd libusb-something [Enter Key] if you are unsure then type "ls -la"
  188. Another way is to type "cd libusb" and then press the tab key; It will auto fill.
  189. Type the lines below one at a time. Look for problems after each one before going on
  190. to the next.
  191. ./autogen.sh --disable-debug-log --prefix=/MinGW
  192. make
  193. make install
  194. You may now exit the MSYS shell.
  195. Ctrl-D or typing "logout" and pressing the enter key should get you out of the
  196. window.
  197. You will have to copy "libusb-1.0.dll" to your working cgminer binary directory.
  198. You will find "libusb-1.0.dll" in the \MinGW\bin directory/folder.
  199. Use this method if libusb does not work for you on Ztex. Once someone lets us know
  200. Libusb works instead of libusbx then we will remove the section below this line.
  201. Run the MSYS shell and change into the libusb folder as above.
  202. Type ==> make uninstall
  203. Go to this url ==> http://libusbx.org/
  204. Click on the "Downloads" tab.
  205. Click on "releases".
  206. Click on the latest version. I downloaded 1.0.14; yours may be newer.
  207. Do not download from the link that says "Looking for the latest version?".
  208. Click on "Windows"
  209. Click on the file and download it. I downloaded libusbx-1.0.12-win.7z.
  210. Extract the the following from the file and place in where directed.
  211. Copy libusb.h from include\libusbx-1.0 to \MinGW\include\libusb-1.0\libusb.h
  212. Copy contents of MinGW32\static \MinGW\lib
  213. Copy contents of MinGW32\dll to \MinGW\lib
  214. You will have to copy "libusb-1.0.dll" to your working cgminer binary directory.
  215. **************************************************************************************
  216. * Some ./configure options *
  217. **************************************************************************************
  218. --enable-cpumining Build with cpu mining support(default disabled)
  219. --disable-opencl Override detection and disable building with opencl
  220. --disable-adl Override detection and disable building with adl
  221. --enable-bitforce Compile support for BitForce FPGAs(default disabled)
  222. --enable-icarus Compile support for Icarus Board(default disabled)
  223. --enable-modminer Compile support for ModMiner FPGAs(default disabled)
  224. --enable-ztex Compile support for Ztex Board(default disabled)
  225. --enable-scrypt Compile support for scrypt litecoin mining (default disabled)
  226. --without-curses Compile support for curses TUI (default enabled)
  227. --without-libudev Autodetect FPGAs using libudev (default enabled)
  228. ######################################################################################
  229. # #
  230. # Cross-compiling for Windows from Linux #
  231. # #
  232. ######################################################################################
  233. It is possible to cross-compile Windows binaries from Linux. The
  234. process is a bit different to the native steps shown above (it is also
  235. possible to use wine and the native steps, but this is more messing
  236. around, very slow, and not advisable.)
  237. ** Install mingw cross compiler
  238. On Ubuntu/Debian:
  239. sudo apt-get install mingw32
  240. ** create a directory to hold our cross-library dependencies
  241. We'll create a directory outside the source tree to hold non-system
  242. libraries we depend on. We could put these in
  243. /usr/i586-mingw32msvc/lib or anywhere else, instead (though keeping it
  244. outside /usr means we can set it up without root privileges.)
  245. IMPORTANT: If you put this directory inside your cgminer directory,
  246. remember 'make distclean' may delete it!
  247. mkdir -p ../cgminer-win32-deps/lib
  248. cd ../cgminer-win32-deps
  249. mkdir include
  250. mkdir bin
  251. NB: All following steps assume you are in the "cgminer-win32-deps" directory. Adjust as necessary.
  252. ** pdcurses
  253. wget http://internode.dl.sourceforge.net/project/pdcurses/pdcurses/3.4/pdc34dllw.zip
  254. unzip /home/gus/Downloads/pdc34dllw.zip
  255. mv *.h include/
  256. mv pdcurses.lib lib/
  257. mv pdcurses.dll bin/
  258. ** pthreads-w32
  259. (NB: I found pthreads-w32 2.9.1 doesn't seem to work properly, transfers time out early due to sem_timedwait exiting immediately(?))
  260. wget -O lib/libpthread.a ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/lib/libpthreadGC2.a
  261. wget -O include/pthread.h ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/include/pthread.h
  262. wget -O include/sched.h ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/include/sched.h
  263. wget -O include/semaphore.h ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/include/semaphore.h
  264. wget -O lib/libpthread.a ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/lib/libpthreadGC2.a
  265. wget -O bin/pthreadGC2.dll ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-8-0-release/lib/pthreadGC2.dll
  266. ** libcurl
  267. wget http://curl.haxx.se/gknw.net/7.33.0/dist-w32/curl-7.33.0-devel-mingw32.zip
  268. unzip curl-7.33.0-devel-mingw32.zip
  269. mv curl-7.33.0-devel-mingw32/include/* include/
  270. mv curl-7.33.0-devel-mingw32/lib/* lib/
  271. mv curl-7.33.0-devel-mingw32/bin/* bin/
  272. rm -rf curl-7.33.0-devel-mingw32
  273. ** clean up
  274. rm *.zip
  275. ** Building cgminer
  276. Below assumes you're building in a "build-win32" or similar directory
  277. inside the cgminer directory. Fix up the -I and -L paths appropriately
  278. if you're building in-tree or someplace else.
  279. Configure command:
  280. CPPFLAGS="-I`pwd`/../../cgminer-win32-deps/include" LDFLAGS="-L`pwd`/../../cgminer-win32-deps/lib -lcurldll" ../autogen.sh --prefix=/usr/local/i586-mingw32 --host=i586-mingw32msvc --build=i686-linux
  281. ^^^ Plus whatever configure arguments you want to add. Note the paths
  282. to cgminer-win32-deps that you may need to change.
  283. And make:
  284. make
  285. After cgminer builds, the next steps are the same as for native
  286. building as given under "Copy files to a build directory/folder"
  287. (DLLs can all be found in the cgminer-win32-deps/bin directory.)