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