Updated distribtion and docs.
[wxWidgets.git] / docs / gtk / install.txt
1
2   !!! When sending bug reports tell us what version of
3       wxWindows you are using (including the beta) and
4       what compiler on what system. One example:
5       wxGTK 2.1 beta 6, egcs 1.1.1, Redhat 5.0 !!!
6
7 * The most simple case
8 -----------------------
9
10 If you compile wxWindows on Unix for the first time and don't 
11 like to read install instructions just do (in the base dir):
12
13 ./configure
14 make
15 su <type root password>
16 make install
17 ldconfig
18 exit
19
20 If you want to remove wxWindows on Unix you can do this:
21
22 su <type root password>
23 make uninstall
24 ldconfif
25 exit
26
27 * The most simple errors
28 ------------------------
29
30 configure reports, that you don't have GTK 1.X installed
31 although you are certainly sure you have. Well, you have
32 installed it, but you also have another version of the
33 GTK installed, which you may need to removed including
34 other versions of glib (and its headers). Also, look
35 for the PATH variable and check if it includes the path
36 to the correct gtk-config! The check your LDPATH if 
37 it points to the correct library. There is no way to
38 compile wxGTK if configure doesn't pass this test as
39 all this test does is compile and link a GTK program.
40
41 You get errors during compilation: The reason is that you
42 probably have a broken compiler, which includes almost
43 everything that is called gcc. If you use gcc 2.8 you
44 have to disable optimsation as the compiler will give
45 up with an internal compiler error.
46
47 If there is just any way for you to use egcs, use egcs. 
48 We are sorry, but we cannot fix gcc.
49
50 You get immediate segfault when starting any sample
51 or application: This is _always_ due to having compiled
52 the library with different flags or options than your
53 program. Typically you might have the __WXDEBUG__ option
54 set for the library but not for your program.
55
56 * The most simple program
57 -------------------------
58
59 Now create your super-application myfoo.app and compile anywhere 
60 with
61
62 g++ myfoo.cpp `wx-config --libs --cflags` -o myfoo
63
64 * General
65 -----------------------
66
67 The Unix variants of wxWindows use GNU configure. If you have 
68 problems with your make use GNU make instead.
69
70 If you have general problems with installation, read my 
71 homepage at 
72
73   http://wesley.informatik.uni-freiburg.de/~wxxt
74   
75 for newest information. If you still don't have any success,
76 please send a bug report to one of our mailing lists (see
77 my homepage) INCLUDING A DESCRIPTION OF YOUR SYSTEM AND 
78 YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT
79 DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know 
80 this has no effect, but I tried...
81
82 * GUI libraries
83 -----------------------
84
85 wxWindows/GTK requires the GTK+ library to be installed on your system.
86 It has to be a stable version, preferebly version 1.2.3. You can use
87 GTK 1.0 in connection with wxWindows, but only without Drag'n'Drop.
88 wxWindows does work with the 1.1.X versions of the GTK+ library.
89
90 You can get the newest version of the GTK+ from the GTK homepage
91 at
92   http://www.gtk.org
93   
94 We also mirror GTK+ 1.2.1 at my ftp site soon. You'll find information
95 about downloading at my homepage.
96   
97 * Additional libraries
98 -----------------------
99
100 wxWindows/Gtk requires a thread library and X libraries
101 known to work with threads. This is the case on all
102 commercial Unix-Variants and all Linux-Versions that
103 are based on glibc 2 except RedHat 5.0 which is broken
104 in many aspects. As of writing this, these Linux 
105 distributions have correct glibc 2 support:
106
107  - RedHat 5.1
108  - Debian 2.0
109  - Stampede
110  - DLD 6.0
111  - SuSE 6.0
112  
113 You can disable thread support by running 
114
115 ./configure "--disable-threads"
116 make
117 su <type root password>
118 make install
119 ldconfig
120 exit
121   
122 NB: DO NOT COMPILE WXGTK WITH GCC AND THREADS, SINCE
123 ALL PROGRAMS WILL CRASH UPON START-UP! Just always
124 use egcs and be happy.
125
126 * Create your configuration
127 -----------------------------
128
129 Usage:
130         ./configure options
131
132 If you want to use system's C and C++ compiler,
133 set environment variables CC and CCC as
134
135         % setenv CC cc
136         % setenv CCC CC
137         % ./configure options
138
139 Using the SGI native compilers, it is recommended that you
140 also set CFLAGS and CXXFLAGS before running configure. These 
141 should be set to :
142
143 CFLAGS="-mips3 -n32" 
144 CXXFLAGS="-mips3 -n32"
145
146 This is essential if you want to use the resultant binaries 
147 on any other machine than the one it was compiled on. If you 
148 have a 64bit machine (Octane) you should also do this to ensure 
149 you don't accidently build the libraries as 64bit (which is 
150 untested).
151
152 The SGI native compiler support has only been tested on Irix 6.5.
153
154 to see all the options please use:
155
156         ./configure --help
157
158 The basic philosophy is that if you want to use different
159 configurations, like a debug and a release version, 
160 or use the same source tree on different systems,
161 you have only to change the environment variable OSTYPE.
162 (Sadly this variable is not set by default on some systems
163 in some shells - on SGI's for example). So you will have to 
164 set it there. This variable HAS to be set before starting 
165 configure, so that it knows which system it tries to 
166 configure for.
167
168 Configure will complain if the system variable OSTYPE has 
169 not been defined. And Make in some circumstances as well...
170
171
172 * General options
173 -------------------
174
175          !!  DON'T USE YET !!
176
177 Normally, you won't have to choose a toolkit, because when
178 you download wxGTK, it will default to --with-gtk etc. But
179 if you use all of our CVS repository you have to choose a 
180 toolkit. You must do this by running configure with either of:
181
182         --with-gtk               Use the GIMP ToolKit (GTK)
183         
184         --with-motif             Use either Motif or Lesstif
185                                  Configure will look for both. 
186
187 The following options handle the kind of library you want to build.
188
189         --with-threads          Compile with thread support. Threads
190                                 support is also required for the
191                                 socket code to work.
192
193         --without-shared        Do not create shared libraries.
194
195         --without-optimise      Do not optimise the code. Can
196                                 sometimes be useful for debugging
197                                 and is required on some architectures
198                                 such as Sun with gcc 2.8.X which
199                                 would otherwise produce segvs.
200
201         --with-profile          Add profiling info to the object 
202                                 files. Currently broken, I think.
203                                 
204         --with-mem_tracing      Add built-in memory tracing. 
205                                 
206         --with-dmalloc          Use the dmalloc memory debugger.
207                                 Read more at www.letters.com/dmalloc/
208                                 
209         --with-debug_info       Add debug info to object files and
210                                 executables for use with debuggers
211                                 such as gdb (or its many frontends).
212
213         --with-debug_flag       Define __DEBUG__ and __WXDEBUG__ when
214                                 compiling. This enable wxWindows' very
215                                 useful internal debugging tricks (such
216                                 as automatically reporting illegal calls)
217                                 to work. Note that program and library
218                                 must be compiled with the same debug 
219                                 options.
220
221 * Feature Options
222 -------------------
223
224          !!  DON'T USE YET !!
225
226 When producing an executable that is linked statically with wxGTK
227 you'll be surprised at its immense size. This can sometimes be
228 drastically reduced by removing features from wxWindows that 
229 are not used in your program. The most relevant such features
230 are
231
232         --without-libpng        Disables PNG image format code.
233         
234         --without-libjpeg       Disables JPEG image format code.
235         
236         --without-odbc          Disables ODBC code.
237         
238         --without-wxresources   Disables the use of *.wxr type
239                                 resources.
240                 
241         --without-threads       Disables threads. Will also
242                                 disable sockets.
243
244         --without-sockets       Disables sockets.
245
246         --without-dnd           Disables Drag'n'Drop.
247         
248         --without-clipboard     Disables Clipboard.
249         
250         --without-serial        Disables object instance serialiasation.
251         
252         --without-streams       Disables the wxStream classes.
253         
254 Apart from disabling certain features you can very often "strip"
255 the program of its debugging information resulting in a significant
256 reduction in size.
257
258 * Compiling
259 -------------
260
261 The following must be done in the base directory (e.g. ~/wxGTK
262 or ~/wxWin or whatever)
263
264 Now the makefiles are created (by configure) and you can compile 
265 the library by typing:
266
267         make
268
269 make yourself some coffee, as it will take some time. On an old
270 386SX possibly week. During compilation, you'll get a few 
271 warning messages depending in your compiler.
272
273 if you want to be more selective, you can change into a specific
274 directiry and type "make" there.
275
276 Then you may install the library and it's header files under
277 /usr/local/include/wx and /usr/local/lib respectively. You
278 have to log in as root (i.e. run "su" and enter the root
279 password) and type
280
281         make install    
282
283 You can remove any traces of wxWindows by typing
284
285         make uninstall
286         
287 If you want to save disk space by removing unnecessary
288 object-files:
289
290          make clean
291
292 in the various directories will do the work for you.
293
294 * Creating a new Project
295 --------------------------
296
297 There are two ways to create your own project:
298
299 1) The first way uses the installed libraries and header files
300 automatically using wx-config
301
302 g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
303
304 Using this way, a make file for the minimal sample would look
305 like this
306
307 CC = g++
308
309 minimal: minimal.o
310     $(CC) -o minimal minimal.o `wx-config --libs` 
311
312 minimal.o: minimal.cpp mondrian.xpm
313     $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
314
315 clean: 
316         rm -f *.o minimal
317
318 This is certain to become the standard way unless we decide
319 to sitch to tmake.
320
321 2) The other way creates a project within the source code 
322 directories of wxWindows. For this endeavour, you'll need
323 the usual number of GNU tools, at least
324
325 GNU automake version 1.4
326 GNU autoheader version 2.14
327 GNU autoconf version 2.14
328
329 and quite possibly 
330
331 GNU make
332 GNU cc
333
334 and if you have all this then you probably know enough to
335 go ahead yourself :-)
336
337 ** Something about Makefiles
338 ------------------------------
339
340 On general principle it should only contain ONE line, which is as follows:
341
342         include ../../setup/general/makeapp
343
344 this will include all the necessary definitions for creating the applications
345
346 the only case where you might want to add another line is the following:
347 this version of configure also supports creation of source archives of the
348 application for easy distribution and updates to newer version of wxWindows.
349     For this purpose all files in the application-directory will be put into
350 a gziped tar-file in the full notation user/<your application>/*
351 if you want to include some other files that you want "more visible", like
352 a README.<yourApp> or a shell script for easy 
353 compilation/installation/distribution, then you have to add a variable
354
355         DISTRIBUTE_ADDITIONAL=<your files>
356
357 to the Makefile.
358 So it would look like this:
359
360         DISTRIBUTE_ADDITIONAL=README.TheApp
361         include ../../setup/general/makeapp
362
363 As we have already talked about distribution the command to create a 
364 distribution is:
365
366         make distrib
367
368 NOTE: If you are in the base directory of wxWindows it will create 
369 distribution packages for wxWindows as well as for all packages in the
370 user directory.
371     So if you want to create only packages for the files in user,
372 then go to the directory other and type:
373
374         make distrib
375
376 or if you only want one application to be created then
377 enter the specific directory and type there:
378 make distrib
379
380 All the distribution files will be put in the directory
381 distrib at the base of the wxWindows-tree (where also configure
382 and template.mak can be found).
383
384 ** Something about Makefile.in
385 --------------------------------
386
387 As you have already seen with Makefile, configure makes a lot of use
388 if the include statement in make to keep the Makefiles as simple as 
389 possible.
390
391 So basically there are only variables to define and then a include command.
392 Exception to this rule is if you have special rules for some stuff...
393 These rules should go AFTER the include statement!!!
394
395 so the general header looks like this:
396
397         # wxWindows base directory
398         WXBASEDIR=@WXBASEDIR@
399         # set the OS type for compilation
400         OS=@OS@
401         # compile a library only
402         RULE=bin
403
404 and the general footer will look like this:
405
406         # include the definitions now
407         include ../../../template.mak
408
409 the key variable is RULE, which defines what make should create
410 in this directory.
411
412 here are some examples:
413
414   RULE    description              
415   ===========================================================================
416   bin     creates a local binary (for a global binary prefix bin with g)
417           additional variables needed:
418                 BIN_TARGET      this gives the name of your application
419                 BIN_OBJ         this gives the object files needed to
420                                 link the application
421           optional variables are:
422                 BIN_SRC         this gives the list of c/c++ files for
423                                 which dependencies will be checked.
424                                 (This can be achieved with: make depend)
425                 BIN_LINK        this gives commands for additional
426                                 libraries needed to link the application
427   ---------------------------------------------------------------------------
428   bin2    creates two local binaries (for global binaries prefix bin2 with g)
429           in addition to the variables specified above you MUST also
430           provide the same variables with BIN2_ instead of BIN_
431   ---------------------------------------------------------------------------
432   lib     creates a local library (for a global binary prefix bin with g)
433           additional variables needed:
434                 LIB_TARGET      this gives the name of your library
435                 LIB_OBJ         this gives the object files needed for
436                                 the library to be build.
437           optional variables are:
438                 LIB_SRC         this gives the list of c/c++ files for
439                                 which dependencies will be checked.
440           libbin and libgbin are also possible and will need in addition
441           the variables from bin
442   ---------------------------------------------------------------------------
443   gslib   is similar to lib, but it creates a shared library if the system
444           supports it.
445           additional variables needed:
446                 LIB_MAJOR       major number of the shared library
447                 LIB_MINOR       minor number of the shared library
448   ---------------------------------------------------------------------------
449   other additional variables:
450
451           ADD_COMPILE      define additional includes/defines that
452                            are needed to compile the object files
453                            (if you need to reference some directory
454                            utils - like wxGrid -, then please 
455                            reference them with the variables defined
456                            in template.mak - e.g.: $(SRCDIR),$(UTILS),
457                            $(SAMPLES),$(OTHERS))
458
459           NEEDED_DEFINES   lists all the defines that HAVE to be set in
460                            /include/wx/setup.h to compile correctly.
461
462           SRC_DIR          lists all directories that are needed to
463                            compile. (i.e: lists all the directories,
464                            where there are source-files.) But it is 
465                            also needed to clean an object and for 
466                            machines, for which make does not support 
467                            VPATH
468
469 currently there are the following compiling rules provided:
470 object files are created for the following file extensions:
471 .c .cc .cpp
472
473 Please have a closer look at the Makefiles in this distribution.
474
475 * Platforms configure is working with
476 ---------------------------------------
477
478 Please report build succes on any machine. Especially non-
479 Linux operating systems (which I don't have).
480
481 Original author of the autoconf system for wxxt-1.66 and for this INSTALL
482 file:
483
484         Martin Sperl    sperl@dsn.ast.univie.ac.at
485         
486 Ported to wxGTK 0.1:
487
488         Wolfram Gloger  wmglo@dent.med.uni-muenchen.de
489
490 Thanks alot to both of them.
491
492 In the hope that it will be useful,
493
494         Robert Roebling roebling@sun2.ruf.uni-freiburg.de
495         
496