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