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