INSTALL.devcpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. DevCpp-Mingw Install & Compilation Sept 2005
  2. ==================================
  3. Reference Emails available at curl@haxx.se:
  4. Libcurl Install and Use Issues
  5. Awaiting an Answer for Win 32 Install
  6. res = curl_easy_perform(curl); Error
  7. Makefile Issues
  8. Having previously done a thorough review of what was available that met my
  9. requirements under GPL, I settled for Libcurl as the software of choice for
  10. many reasons not the least of which was the support.
  11. Background
  12. ----------
  13. This quest started when I innocently tried to incorporate the libcurl library
  14. into my simple source code. I figured that a few easy steps would accomplish
  15. this without major headaches. I had no idea that I would be facing an almost
  16. insurmountable challenge.
  17. The main problem lies in two areas. First the bulk of support for libcurl
  18. exists for a Unix/linux command line environments. This is of little help when
  19. it comes to Windows O/S.
  20. Secondly the help that does exist for the Windows O/S focused around mingw
  21. through a command line argument environment.
  22. You may ask "Why is this a problem?"
  23. I'm using a Windows O/S with DevCpp. For those of you who are unfamiliar with
  24. DevCpp, it is a window shell GUI that replaces the command line environment
  25. for gcc. A definite improvement that I am unwilling to give up. However using
  26. DevCpp presented its own set of issues. Inadvertently I also made some
  27. careless errors such as compiling the 7.14 version of Makefile with an older
  28. version of source code. Thanks to Dan Fandrich for picking this up.
  29. I did eventually with the help of Daniel, Phillipe and others manage to
  30. implement successfully (the only mingw available version)
  31. curl-7.13.0-win32-ssl-devel-mingw32 into the DevCpp environment. Only the
  32. dynamic libcurl.dll libcurldll.a libraries worked. The static library which I
  33. was interested in did not. Furthermore when I tried to implement one of the
  34. examples included with the curl package (get info.c) it caused the executable
  35. to crash. Tracing the bug I found it in the code and function res =
  36. curl_easy_perform(curl);.
  37. At this point I had to make a choice as to whether invest my limited
  38. time-energy resource to fixing the bug or to compile the new version
  39. available. After searching the archives I found a very similar or the same bug
  40. reported from version 7.12x on. Daniel did inform me that he thought that this
  41. bug had been fixed with the latest version. So I proceeded to compile the
  42. latest SSL version where I faced other challenges.
  43. In order to make this process unremarkable for others using the same
  44. environment I decided to document the process so that others will find it
  45. routine. It would be a shame if newbies could not implement this excellent
  46. package for their use.
  47. I would like to thank the many others in this forum and in the DevCpp forum
  48. for their help. Without your help I may either have given up or it would have
  49. taken me many times longer to achieve success.
  50. The Cookbook Approach
  51. ---------------------
  52. This discussion will be confined to a SSL static library compilation and
  53. installation. Limited mention and comments will be inserted where appropriate
  54. to help with non-SSL, dynamic libraries and executables.
  55. Using Makefile from DevCpp to compile Libcurl libraries
  56. Preamble
  57. --------
  58. Using the latest version release - curl-7.14.0.tar.gz. Curl source code is
  59. platform independent. This simply means that the source code can be compiled
  60. for any Operating System (Linux/Unix Windows etc. and variations of thereof).
  61. The first thing to note is that inside curl-7.14.0 you will find two folders
  62. lib and src. Both contain Makefile.m32 (required for win mingw library or exe
  63. compilation) files which are different. The main difference between these two
  64. folders and the makefiles is that the src folder contents are used to compile
  65. an executable file(curl.exe) while the lib folder contents are used to compile
  66. a static (libcurl.a) and dynamic (libcurl.dll & libcurldll.a) file that can be
  67. used to compile libcurl with your own source code so that one can use and
  68. access all libcurl functions.
  69. Before we start please make sure that DevCpp is installed properly. In
  70. particular make sure you have no spaces in the name of any of the directories
  71. and subdirectories where DevCpp is installed. Failure to comply with the
  72. install instructions may produce erratic behaviour in DevCpp. For further info
  73. check the following sites
  74. http://aditsu.freeunixhost.com/dev-cpp-faq.html
  75. http://sourceforge.net/forum/message.php?msg_id=3252213
  76. As I have mentioned before I will confine this to the SSL Library compilations
  77. but the process is very similar for compilation of the executable - curl.exe;
  78. just substitute the src folder makefile in its stead.
  79. First use a text processor Notepad, or your own favourite text processor. To
  80. engage your favourite text processor, select Makefile.m32 click once with your
  81. mouse on file icon; icon turns blue, press the shift key and right-click on
  82. mouse, menu appears select "Open with", select your favourite text processor.
  83. Next read the contents of Makefile.m32. It includes instructions on its use.
  84. Method I - DOS Command Line
  85. ---------------------------
  86. Note - The only reason I have included this method is that Method II which is
  87. the preferred method for compiling does not allow for the setting of option
  88. switches (e.g. SSL = 1 or SSL =0). At least that's what they tell me at the
  89. Dev-Cpp forum.
  90. 1 - Make a copy of (D:\Dev-Cpp\bin) bin folder and name it "bin Original"
  91. place it in the Dev-Cpp installed directory (D:\Dev-Cpp\ for this example)
  92. 2 - Copy the entire contents of the LIB folder of curl-7.14.0.tar.gz or zip
  93. version into the bin folder above (D:\Dev-Cpp\bin). The reason being is that
  94. the make.exe file resides in this folder. Make.exe will use - Makefile.m32,
  95. Makefile.inc, and the source code included in the lib folder to compile the
  96. source code. There is a PATH issue with make.exe that remains unresolved at
  97. least for me. Unless the entire source code to be compiled is placed entirely
  98. within the directory of make.exe an error message will be generated - "file
  99. xxxx.yyy not available".
  100. 3- Go to Dev-Cpp\bin and double click on make .exe. You will see a DOS window
  101. quickly pop up and close very quickly. Not to worry! Please do not skip this
  102. step.
  103. 4- Click on the start button\Programs\MS-DOS Prompt.Once the DOS Window is up
  104. Type the disk drive letter (e.g. E: ) engage the enter button. The path should
  105. automatically take you to the directory of the make.exe file.
  106. 5- To compile the source code simply type at the DOS prompt make -f
  107. Makefile.m32 as per instructions contained in the Makefile.m32 file (use any
  108. text processor to read instructions). I don't believe that this makefile
  109. allows for the option of non SSL. Ignore any warnings.
  110. 6- Collect and make copies of libcurl.a, libcurl.dll, libcurldll.a and any *.o
  111. compilations you might need in another directory outside of the bin directory
  112. as you will need this files shortly to set up libcurl for use with
  113. Dev-cpp. For most apps *.o is not required. Later on we will show what to do
  114. with these files.
  115. 7- You are finished but before closing we need to do cleanup - erase the bin
  116. folder and rename the "bin Original" folder created in step 1 to bin.
  117. Note to compile a curl executable the process is probably similar but instead
  118. of using the LIB folder contents use the SRC folder contents and Makefiles in
  119. curl-7.14.0.tar.gz. File directories relative placements must be respected for
  120. compiling to take place successfully. This may not be possible with the PATH
  121. problem that make.exe experiences. If anyone has solved this PATH issue and
  122. please make sure it actually works on Win 9x/2000/XP before letting me
  123. know. Then please let me or Daniel in on the solution so that it can be
  124. included with these instructions. Thanks.
  125. or
  126. Method II - Dev-Cpp GUI
  127. -----------------------
  128. 1- Copy the entire contents of the LIB folder of curl-7.14.0.tar.gz or zip
  129. version into any folder outside of (Dev-Cpp\bin).
  130. 2- Drop the File/New/click on Project.
  131. 3- New Project Dialogue box appears. Double click on the Static Library.
  132. 4- Create Project Dialogue box appears. Select the LIB folder location to
  133. place and locate your Project File Name. Placing the Project File Name
  134. elsewhere may cause problems (PATH issue problem again).
  135. 5- Drop down the Project/Project Options. Project Options Dialogue box
  136. appears.
  137. 6- Select the Makefile tab in the Project Options Dialogue Box. Check Box -
  138. Use Custom Makefile. Click on the Folder icon at the extreme right of the
  139. Check Box. Select Makefile.m32 in the folder wherever you have placed the
  140. contents of the LIB Folder. Press OK and close the Dialogue Box.
  141. 7- Drop the Menu Project/Click on Add to Project. Open File Dialogue Box
  142. appears. The Dialogue Box should open in the folder wherever you have placed
  143. the contents of the LIB Folder. If not go there.
  144. 8- Select Crtl-A to select all files in the LIB folder. Click on open to add
  145. files and close box. Wait till all files are added. This may take 30 seconds
  146. or longer.
  147. 9- Drop the Menu Execute/Click on Compile.
  148. 10- That's it.
  149. The following steps must be completed if Curl is to work properly
  150. =================================================================
  151. LIB folder inclusions (*.a placement)
  152. -------------------------------------
  153. 1- Refer to Method I - DOS Command Line point # 6 Take libcurl.a, libcurldll.a
  154. and install it in the directory C( or whichever drive Dev is installed)
  155. :\Dev-Cpp\lib.
  156. Include Folder
  157. --------------
  158. 1- Create a new folder by the name of curl (do not change the name curl to
  159. some other name as it will cause major issues) in the directory
  160. C:\Dev-Cpp\include.
  161. 2- Copy the entire contents of the curl folder of curl-7.14.0.tar.gz or zip
  162. version into the newly created curl directory - C:\Dev-Cpp\include\curl.
  163. Links To Include And Lib Folder
  164. -------------------------------
  165. 1- Drop the Menu - Tools\Compiler Options\Directories\Libraries. Make sure
  166. that C( or whichever drive Dev is installed):\DEV-CPP\lib is included.
  167. 2- Next select the Menu - Tools\Compiler Options\Directories\C Includes. Make
  168. sure that C:\DEV-CPP\include and C:\Dev-Cpp\include\curl are included.
  169. 3- Next select the Menu - Tools\Compiler Options\Directories\C++
  170. Includes. Make sure that C:\DEV-CPP\include and C:\Dev-Cpp\include\curl are
  171. included.
  172. Linker Links
  173. ------------
  174. 1- Drop the Menu - Tools\Compiler Options\Directories\Compiler.
  175. 2- Make sure that the box "Add these commands to the linker command line" is
  176. checked.
  177. 3- Include in the white space immediately below the box referred in 2 -lcurl
  178. -lws2_32.
  179. SSL Files
  180. ---------
  181. 1- Get the latest openSSL (as of time of this writing)
  182. openssl-0.9.7e-win32-bin.zip for the minimalist package of the openssl-0.9.7e
  183. binaries ported to MS Windows 95/98/NT/XP using the MingW32/GCC-3.1
  184. development environment. The file may be downloaded at
  185. http://curl.haxx.se/download/.
  186. 2- Open the above zip file. You will find two files - SDL.dll,
  187. SDL_mixer.dll. Install them in the directory C:\WINDOWS\SYSTEM32 for Win 9x
  188. users and c:\winnt\system32 for NT-family users.
  189. Multithreading Files
  190. --------------------
  191. To be completed
  192. #define
  193. -------
  194. 1- Make sure that your program includes the following - #define CURL_STATICLIB
  195. must be declared FIRST before any other define functions may be
  196. added. Otherwise you may experience link errors.
  197. 2- Don't forget to include #include "curl/curl.h".
  198. e.g.
  199. #define CURL_STATICLIB
  200. #include <windows.h>
  201. #include "curl/curl.h"
  202. #include <fstream>
  203. #include <iostream>
  204. #include <vector>
  205. etc...
  206. Static or Dynamic Library
  207. -------------------------
  208. The above steps apply for the use by a static library. Should you choose to
  209. use a dynamic library you will be required to perform these additional steps.
  210. 1- Refer to Method I - DOS Command Line point # 6. Install libcurl.dll in the
  211. directory C:\WINDOWS\SYSTEM32 for Win 9x users and c:\winnt\system32 for
  212. NT-family users.
  213. 2- Refer to Linker Links point 3 - Replace -lcurl with -lcurldll.
  214. Voila you're done.
  215. The non-SSL static Library build may not be possible to use at least as of the
  216. time of this writing - v7.14. Check reference emails - Phillipe and I found it
  217. impossible to fully compile as certain files were missing for linking. No big
  218. loss as SSL is a major plus.
  219. Hope this Helps
  220. Tom