Made the RTTI thing an option.
[wxWidgets.git] / docs / gtk / install.txt
1
2   !!! When sending bug reports tell us what version of wxWindows you are 
3       using (including the beta) and what compiler on what system. One 
4       example: wxGTK 2.1 beta 6, egcs 1.1.1, Redhat 5.0 !!!
5
6 * The most simple case
7 -----------------------
8
9 If you compile wxWindows on Unix for the first time and don't like to read 
10 install instructions just do (in the base dir):
11
12 ./configure
13 make
14 su <type root password>
15 make install
16 ldconfig
17 exit
18
19 If you want to remove wxWindows on Unix you can do this:
20
21 su <type root password>
22 make uninstall
23 ldconfig
24 exit
25
26 * The expert case
27 -----------------
28
29 If you want to do some more serious cross-platform programming with wxWindows, 
30 such as for GTK and Motif, you can now build two complete libraries and use 
31 them concurretly. For this end, you have to create a directory for each build 
32 of wxWindows - you may also want to create different versions of wxWindows
33 and test them concurrently. Most typically, this would be a version configured 
34 with --enable-debug_flag and one without. Note, that only one build can currently 
35 be installed, so you'd have to use local version of the library for that purpose.
36 For building three versions (one GTK, one Motif and a debug version of the GTK 
37 source) you'd do this:
38
39 md buildmotif
40 cd buildmotif
41 ../configure --with-motif
42 make
43 cd ..
44
45 md buildgtk
46 cd buildgtk
47 ../configure --with-gtk
48 make
49 cd ..
50
51 md buildgtkd
52 cd buildgtkd
53 ../configure --with-gtk --enable-debug_flag
54 make
55 cd ..
56
57 * The most simple errors
58 ------------------------
59
60 configure reports, that you don't have GTK 1.X installed although you are 
61 very sure you have. Well, you have installed it, but you also have another 
62 version of the GTK installed, which you may need to remove including other 
63 versions of glib (and its headers). Also, look for the PATH variable and check 
64 if it includes the path to the correct gtk-config! The check your LDPATH if it 
65 points to the correct library. There is no way to compile wxGTK if configure 
66 doesn't pass this test as all this test does is compile and link a GTK program.
67
68 You get errors during compilation: The reason is that you probably have a broken 
69 compiler, which includes almost everything that is called gcc. If you use gcc 2.8 
70 you have to disable optimsation as the compiler will give up with an internal 
71 compiler error.
72
73 If there is just any way for you to use egcs, use egcs. We cannot fix gcc.
74
75 You get immediate segfault when starting any sample or application: This is either 
76 due to having compiled the library with different flags or options than your program - 
77 typically you might have the __WXDEBUG__ option set for the library but not for your 
78 program - or due to using a broken compiler (and its optimisation) such as GCC 2.8.
79
80 * The most simple program
81 -------------------------
82
83 Now create your super-application myfoo.app and compile anywhere with
84
85 g++ myfoo.cpp `wx-config --libs --cflags` -o myfoo
86
87 * General
88 -----------------------
89
90 The Unix variants of wxWindows use GNU configure. If you have problems with your 
91 make use GNU make instead.
92
93 If you have general problems with installation, read my homepage at 
94
95   http://wesley.informatik.uni-freiburg.de/~wxxt
96   
97 for newest information. If you still don't have any success, please send a bug 
98 report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF 
99 YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT DISTRIBUTION 
100 YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried...
101
102 * GUI libraries
103 -----------------------
104
105 wxWindows/GTK requires the GTK+ library to be installed on your system. It has to 
106 be a stable version, preferebly version 1.2.3. You can use GTK 1.0 in connection 
107 with wxWindows, albeit without Drag'n'Drop. wxWindows does work with the 1.1.X 
108 versions of the GTK+ library.
109
110 You can get the newest version of the GTK+ from the GTK homepage at:
111
112   http://www.gtk.org
113   
114 We also mirror GTK+ 1.0.6 at my ftp site. You'll find information about downloading 
115 at my homepage.
116   
117 * Additional libraries
118 -----------------------
119
120 wxWindows/Gtk requires a thread library and X libraries known to work with threads. 
121 This is the case on all commercial Unix-Variants and all Linux-Versions that are 
122 based on glibc 2 except RedHat 5.0 which is broken in many aspects. As of writing 
123 this, these Linux distributions have correct glibc 2 support:
124
125  - RedHat 5.1
126  - Debian 2.0
127  - Stampede
128  - DLD 6.0
129  - SuSE 6.0
130  
131 You can disable thread support by running 
132
133 ./configure "--disable-threads"
134 make
135 su <type root password>
136 make install
137 ldconfig
138 exit
139   
140 NB: DO NOT COMPILE WXGTK WITH GCC AND THREADS, SINCE ALL PROGRAMS WILL CRASH UPON 
141 START-UP! Just always use egcs and be happy.
142
143 * Building wxGTK on OS/2
144 --------------------------
145
146 Please send comments and question about the OS/2 installation
147 to Andrea Venturoli <a.ventu@flashnet.it> and patches to
148 make the installation work (better) to me (Robert Roebling).
149
150 You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3), 
151 gtk+ (?), emx (0.9d fix 1), flex (2.5.4), yacc (1.8), 
152 korn shell (5.2.13), Autoconf (?),  GNU file utilities (3.6), 
153 GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4), 
154 sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
155
156 Open an OS/2 prompt and switch to the directory above.
157 First set some global environment variables we need:
158
159 SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
160 SET OSTYPE=OS2X              
161 SET COMSPEC=sh
162
163 Notice you can choose whatever you want, if you don't like OS2X.
164
165 * Building wxGTK on SGI
166 --------------------------
167
168 Using the SGI native compilers, it is recommended that you
169 also set CFLAGS and CXXFLAGS before running configure. These 
170 should be set to :
171
172 CFLAGS="-mips3 -n32" 
173 CXXFLAGS="-mips3 -n32"
174
175 This is essential if you want to use the resultant binaries 
176 on any other machine than the one it was compiled on. If you 
177 have a 64bit machine (Octane) you should also do this to ensure 
178 you don't accidently build the libraries as 64bit (which is 
179 untested).
180
181 The SGI native compiler support has only been tested on Irix 6.5.
182
183 * Create your configuration
184 -----------------------------
185
186 Usage:
187         ./configure options
188
189 If you want to use system's C and C++ compiler,
190 set environment variables CC and CCC as
191
192         % setenv CC cc
193         % setenv CCC CC
194         % ./configure options
195
196 to see all the options please use:
197
198         ./configure --help
199
200 The basic philosophy is that if you want to use different
201 configurations, like a debug and a release version, 
202 or use the same source tree on different systems,
203 you have only to change the environment variable OSTYPE.
204 (Sadly this variable is not set by default on some systems
205 in some shells - on SGI's for example). So you will have to 
206 set it there. This variable HAS to be set before starting 
207 configure, so that it knows which system it tries to 
208 configure for.
209
210 Configure will complain if the system variable OSTYPE has 
211 not been defined. And Make in some circumstances as well...
212
213
214 * General options
215 -------------------
216
217 Given below are the commands to change the default behaviour,
218 i.e. if it says "--disable-threads" it means that threads
219 are enabled by default.
220
221 Many of the confiugre options have been thoroughly tested
222 in wxWindows snapshot 6, but not yet all (ODBC not).
223
224 Normally, you won't have to choose a toolkit, because when
225 you download wxGTK, it will default to --with-gtk etc. But
226 if you use all of our CVS repository you have to choose a 
227 toolkit. You must do this by running configure with either of:
228
229         --without-gtk            Don't use the GIMP ToolKit (GTK)
230         
231         --with-motif             Use either Motif or Lesstif
232                                  Configure will look for both. 
233
234 The following options handle the kind of library you want to build.
235
236         --disable-threads       Compile without thread support. Threads
237                                 support is also required for the
238                                 socket code to work.
239
240         --disable-shared        Do not create shared libraries.
241
242         --disable-optimise      Do not optimise the code. Can
243                                 sometimes be useful for debugging
244                                 and is required on some architectures
245                                 such as Sun with gcc 2.8.X which
246                                 would otherwise produce segvs.
247
248         --enable-profile        Add profiling info to the object 
249                                 files. Currently broken, I think.
250                                 
251         --enable-no_rtti        Enable compilation without creation of
252                                 C++ RTTI information in object files. 
253                                 This will speed-up compilation and reduce 
254                                 binary size.
255                                 
256         --enable-no_rtti        Enable compilation without creation of
257                                 C++ exception information in object files. 
258                                 This will speed-up compilation and reduce 
259                                 binary size. Also fewer crashes during the
260                                 actual compilation...
261                                 
262         --enable-mem_tracing    Add built-in memory tracing. 
263                                 
264         --enable-dmalloc        Use the dmalloc memory debugger.
265                                 Read more at www.letters.com/dmalloc/
266                                 
267         --enable-debug_info     Add debug info to object files and
268                                 executables for use with debuggers
269                                 such as gdb (or its many frontends).
270
271         --enable-debug_flag     Define __DEBUG__ and __WXDEBUG__ when
272                                 compiling. This enable wxWindows' very
273                                 useful internal debugging tricks (such
274                                 as automatically reporting illegal calls)
275                                 to work. Note that program and library
276                                 must be compiled with the same debug 
277                                 options.
278
279 * Feature Options
280 -------------------
281
282 Many of the confiugre options have been thoroughly tested
283 in wxWindows snapshot 6, but not yet all (ODBC not).
284
285 When producing an executable that is linked statically with wxGTK
286 you'll be surprised at its immense size. This can sometimes be
287 drastically reduced by removing features from wxWindows that 
288 are not used in your program. The most relevant such features
289 are
290
291         --without-libpng        Disables PNG image format code.
292         
293         --without-libjpeg       Disables JPEG image format code.
294         
295 {       --without-odbc          Disables ODBC code. Not yet. }
296         
297         --disable-resources     Disables the use of *.wxr type
298                                 resources.
299                 
300         --disable-threads       Disables threads. Will also
301                                 disable sockets.
302
303         --disable-sockets       Disables sockets.
304
305         --disable-dnd           Disables Drag'n'Drop.
306         
307         --disable-clipboard     Disables Clipboard.
308         
309         --disable-serial        Disables object instance serialiasation.
310         
311         --disable-streams       Disables the wxStream classes.
312         
313         --disable-file          Disables the wxFile class.
314         
315         --disable-textfile      Disables the wxTextFile class.
316         
317         --disable-intl          Disables the internationalisation.
318         
319         --disable-validators    Disables validators.
320         
321         --disable-accel         Disables accel.
322         
323 Apart from disabling certain features you can very often "strip"
324 the program of its debugging information resulting in a significant
325 reduction in size.
326
327 * Compiling
328 -------------
329
330 The following must be done in the base directory (e.g. ~/wxGTK
331 or ~/wxWin or whatever)
332
333 Now the makefiles are created (by configure) and you can compile 
334 the library by typing:
335
336         make
337
338 make yourself some coffee, as it will take some time. On an old
339 386SX possibly two weeks. During compilation, you'll get a few 
340 warning messages depending in your compiler.
341
342 If you want to be more selective, you can change into a specific
343 directiry and type "make" there.
344
345 Then you may install the library and it's header files under
346 /usr/local/include/wx and /usr/local/lib respectively. You
347 have to log in as root (i.e. run "su" and enter the root
348 password) and type
349
350         make install    
351
352 You can remove any traces of wxWindows by typing
353
354         make uninstall
355         
356 If you want to save disk space by removing unnecessary
357 object-files:
358
359          make clean
360
361 in the various directories will do the work for you.
362
363 * Creating a new Project
364 --------------------------
365
366 1) The first way uses the installed libraries and header files
367 automatically using wx-config
368
369 g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
370
371 Using this way, a make file for the minimal sample would look
372 like this
373
374 CC = g++
375
376 minimal: minimal.o
377     $(CC) -o minimal minimal.o `wx-config --libs` 
378
379 minimal.o: minimal.cpp mondrian.xpm
380     $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
381
382 clean: 
383         rm -f *.o minimal
384
385 This is certain to become the standard way unless we decide
386 to sitch to tmake.
387
388 2) The other way creates a project within the source code 
389 directories of wxWindows. For this endeavour, you'll need
390 the usual number of GNU tools, at least
391
392 GNU automake version 1.4
393 GNU autoheader version 2.14
394 GNU autoconf version 2.14
395 GNU libtool version 1.3
396
397 and quite possibly 
398
399 GNU make
400 GNU C++
401
402 and if you have all this then you probably know enough to
403 go ahead yourself :-)
404
405 ----------------------
406
407 In the hope that it will be useful,
408
409         Robert Roebling <roebling@sun2.ruf.uni-freiburg.de>
410         
411