]> git.saurik.com Git - wxWidgets.git/blob - docs/gtk/install.txt
e57ebdf5d115007567767d4f596e58f01635d88e
[wxWidgets.git] / docs / gtk / install.txt
1 wxWindows 2.3 for GTK installation
2 ----------------------------------
3
4 IMPORTANT NOTE:
5
6 If you experience problems installing, please re-read these
7 instructions and other related files (todo.txt, bugs.txt and
8 osname.txt for your platform if it exists) carefully before
9 mailing wxwin-users or the author. Preferably, try to fix the
10 problem first and then send a patch to the author.
11
12 When sending bug reports tell us what version of wxWindows you are
13 using (including the beta) and what compiler on what system. One
14 example: wxGTK 2.3.3, gcc 2.95.4, Redhat 6.2
15
16 * The simplest case
17 -------------------
18
19 If you compile wxWindows on Linux for the first time and don't like to read
20 install instructions just do (in the base dir):
21
22 > ./configure --with-gtk
23 > make
24 > su <type root password>
25 > make install
26 > ldconfig
27 > exit
28
29 Afterwards you can continue with
30
31 > make
32 > su <type root password>
33 > make install
34 > ldconfig
35 > exit
36
37 If you want to remove wxWindows on Unix you can do this:
38
39 > su <type root password>
40 > make uninstall
41 > ldconfig
42 > exit
43
44 * The GTK+ 2 case
45 -----------------
46
47 wxGTK 2.3.3 has support for the new version 2.0.X of GTK+. This means
48 that wxGTK apps can now make use Unicode as the underlying encoding
49 for all text operations. This is a very fundamental change and will
50 need time to stabilize, so be careful. Anyways, after installing a
51 recent version of GTK+ 2.0, do this
52
53 > ./configure --with-gtk --enable-gtk2 --enable-unicode
54 > make
55 > su <type root password>
56 > make install
57 > ldconfig
58 > exit
59
60 If you are adventurous, you can install the FcConfig 2.0 package
61 and the Pango library from CVS (or a very recent snapshot from
62 the upcoming 1.2 series) and set do "export GDK_USE_XFT=1" so
63 that the display as well as the printing code will use render
64 using the same FreeType code even for Far Eastern encodings.
65
66 Expect problems.
67
68 * The expert case
69 -----------------
70
71 If you want to do some more serious cross-platform programming with wxWindows,
72 such as for GTK and Motif, you can now build two complete libraries and use
73 them concurrently. For this end, you have to create a directory for each build
74 of wxWindows - you may also want to create different versions of wxWindows
75 and test them concurrently. Most typically, this would be a version configured
76 with --enable-debug_flag and one without. Note, that only one build can
77 currently be installed, so you'd have to use local version of the library for
78 that purpose.
79
80 For building three versions (one GTK, one Motif and a debug version of the GTK
81 source) you'd do this:
82
83 md buildmotif
84 cd buildmotif
85 ../configure --with-motif
86 make
87 cd ..
88
89 md buildgtk
90 cd buildgtk
91 ../configure --with-gtk
92 make
93 cd ..
94
95 md buildgtkd
96 cd buildgtkd
97 ../configure --with-gtk --enable-debug_flag
98 make
99 cd ..
100
101 * The simplest errors
102 ---------------------
103
104 For any configure errors: please look at config.log file which was generated
105 during configure run, it usually contains some useful information.
106
107 configure reports, that you don't have GTK 1.2 installed although you are
108 very sure you have. Well, you have installed it, but you also have another
109 version of the GTK installed, which you may need to remove including other
110 versions of glib (and its headers). Or maybe you installed it in non default
111 location and configure can't find it there, so please check that your PATH
112 variable includes the path to the correct gtk-config. Also check that your
113 LD_LIBRARY_PATH or equivalent variable contains the path to GTK+ libraries if
114 they were installed in a non default location.
115
116 You get errors from make: please use GNU make instead of the native make
117 program. Currently wxWindows can be built only with GNU make, BSD make and
118 Solaris make. Other versions might work or not (any which don't have VPATH
119 support definitely won't).
120
121 You get errors during compilation: The reason is that you probably have a
122 broken compiler. GCC 2.8 and earlier versions and egcs are likely to cause
123 problems due to incomplete support for C++ and optimisation bugs. Best to use
124 GCC 2.95 or later.
125
126 You get immediate segfault when starting any sample or application: This is
127 either due to having compiled the library with different flags or options than
128 your program - typically you might have the __WXDEBUG__ option set for the
129 library but not for your program - or due to using a compiler with optimisation
130 bugs.
131
132 Linker complains about missing PROIO_yy_flex_alloc and similar symbols: you
133 probably have an old version of flex, 2.5.4 is recommended.
134
135 * The simplest program
136 ----------------------
137
138 Now create your super-application myfoo.cpp and compile anywhere with
139
140 g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
141
142 * General
143 ---------
144
145 The Unix variants of wxWindows use GNU configure. If you have problems with
146 your make use GNU make instead.
147
148 If you have general problems with installation, read my homepage at
149
150 http://wesley.informatik.uni-freiburg.de/~wxxt/
151
152 for newest information. If you still don't have any success, please send a bug
153 report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF
154 YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT
155 DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect,
156 but I tried...
157
158 * GUI libraries
159 ---------------
160
161 wxWindows/GTK requires the GTK+ library to be installed on your system. It has
162 to be a stable version, preferably version 1.2.10 (at least 1.2.3 is required,
163 1.2.7 is strongly recommended).
164
165 You can get the newest version of the GTK+ from the GTK homepage at:
166
167 http://www.gtk.org
168
169 We also mirror GTK+ at my ftp site. You'll find information about downloading
170 at my homepage.
171
172 * Additional libraries
173 ----------------------
174
175 wxWindows/Gtk requires a thread library and X libraries known to work with
176 threads. This is the case on all commercial Unix-Variants and all
177 Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in
178 many aspects. As of writing this, these Linux distributions have correct glibc
179 2 support:
180
181 - RedHat 5.1
182 - Debian 2.0 and 3.0
183 - Stampede
184 - DLD 6.0
185 - SuSE 6.0
186
187 You can disable thread support by running
188
189 ./configure --disable-threads
190 make
191 su <type root password>
192 make install
193 ldconfig
194 exit
195
196 * Building wxGTK on OS/2
197 ------------------------
198
199 Please send comments and question about the OS/2 installation
200 to Andrea Venturoli <a.ventu@flashnet.it> and patches to
201 the wxWindows mailing list.
202
203 You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer),
204 GTK+ (1.2.5 or newer), emx (0.9d fix 1), flex (2.5.4), yacc (1.8),
205 korn shell (5.2.13), Autoconf (2.13), GNU file utilities (3.6),
206 GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4),
207 sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
208
209 Open an OS/2 prompt and switch to the directory above.
210 First set some global environment variables we need:
211
212 SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
213 SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__
214 SET OSTYPE=OS2X
215 SET COMSPEC=sh
216
217 Notice you can choose whatever you want, if you don't like OS2X.
218
219 Now, run autoconf in the main directory and in the samples, demos
220 and utils subdirectory. This will generate the OS/2 specific
221 versions of the configure scripts. Now run
222 configure --with-gtk
223 as described above.
224
225 If you have pthreads library installed, but have a gtk version
226 which does not yet support threading, you need to explicitly
227 disable threading by using the option --disable-threads.
228
229 Note that configure assumes your flex will generate files named
230 "lexyy.c", not "lex.yy.c". If you have a version which does
231 generate "lex.yy.c", you need to manually change the generated
232 makefile.
233
234 * Building wxGTK on SGI
235 -----------------------
236
237 Using the SGI native compilers, it is recommended that you
238 also set CFLAGS and CXXFLAGS before running configure. These
239 should be set to :
240
241 CFLAGS="-mips3 -n32"
242 CXXFLAGS="-mips3 -n32"
243
244 This is essential if you want to use the resultant binaries
245 on any other machine than the one it was compiled on. If you
246 have a 64bit machine (Octane) you should also do this to ensure
247 you don't accidently build the libraries as 64bit (which is
248 untested).
249
250 The SGI native compiler support has only been tested on Irix 6.5.
251
252 * Create your configuration
253 ---------------------------
254
255 Usage:
256 ./configure options
257
258 If you want to use system's C and C++ compiler,
259 set environment variables CC and CCC as
260
261 % setenv CC cc
262 % setenv CXX CC
263 % ./configure [options]
264
265 to see all the options please use:
266
267 ./configure --help
268
269 It is recommended to build wxWindows in another directory (maybe a
270 subdirectory of your wxWindows installation) as this allows you to
271 have multiple configurations (for example, debug and release or GTK
272 and Motif) simultaneously.
273
274
275 * General options
276 -----------------
277
278 Given below are the commands to change the default behaviour,
279 i.e. if it says "--disable-threads" it means that threads
280 are enabled by default.
281
282 Normally, you won't have to choose a toolkit, because when
283 you download wxGTK, it will default to --with-gtk etc. But
284 if you use all of our CVS repository you have to choose a
285 toolkit. You must do this by running configure with either of:
286
287 --with-gtk Use the GIMP ToolKit (GTK). Default.
288
289 --with-motif Use either Motif or Lesstif
290 Configure will look for both.
291
292 The following options handle the kind of library you want to build.
293
294 --disable-threads Compile without thread support.
295
296 --disable-shared Do not create shared libraries, but
297 build static libraries instead.
298
299 --disable-optimise Do not optimise the code. Can
300 sometimes be useful for debugging
301 and is required on some architectures
302 such as Sun with gcc 2.8.X which
303 would otherwise produce segvs.
304
305 --enable-profile Add profiling info to the object
306 files. Currently broken, I think.
307
308 --enable-no_rtti Enable compilation without creation of
309 C++ RTTI information in object files.
310 This will speed-up compilation and reduce
311 binary size.
312
313 --enable-no_exceptions Enable compilation without creation of
314 C++ exception information in object files.
315 This will speed-up compilation and reduce
316 binary size. Also fewer crashes during the
317 actual compilation...
318
319 --enable-no_deps Enable compilation without creation of
320 dependency information.
321
322 --enable-permissive Enable compilation without checking for strict
323 ANSI conformance. Useful to prevent the build
324 dying with errors as soon as you compile with
325 Solaris' ANSI-defying headers.
326
327 --enable-mem_tracing Add built-in memory tracing.
328
329 --enable-dmalloc Use the dmalloc memory debugger.
330 Read more at www.letters.com/dmalloc/
331
332 --enable-debug_info Add debug info to object files and
333 executables for use with debuggers
334 such as gdb (or its many frontends).
335
336 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
337 compiling. This enable wxWindows' very
338 useful internal debugging tricks (such
339 as automatically reporting illegal calls)
340 to work. Note that program and library
341 must be compiled with the same debug
342 options.
343
344 * Feature Options
345 -----------------
346
347 When producing an executable that is linked statically with wxGTK
348 you'll be surprised at its immense size. This can sometimes be
349 drastically reduced by removing features from wxWindows that
350 are not used in your program. The most relevant such features
351 are
352
353 --with-odbc Enables ODBC code. This is disabled
354 by default because iODBC is under the
355 L-GPL license which is less liberal than
356 wxWindows license.
357
358 --without-libpng Disables PNG image format code.
359
360 --without-libjpeg Disables JPEG image format code.
361
362 --without-libtiff Disables TIFF image format code.
363
364 --disable-pnm Disables PNM image format code.
365
366 --disable-gif Disables GIF image format code.
367
368 --disable-pcx Disables PCX image format code.
369
370 --disable-iff Disables IFF image format code.
371
372 --disable-resources Disables the use of *.wxr type resources.
373
374 --disable-threads Disables threads. Will also disable sockets.
375
376 --disable-sockets Disables sockets.
377
378 --disable-dnd Disables Drag'n'Drop.
379
380 --disable-clipboard Disables Clipboard.
381
382 --disable-serial Disables object instance serialisation.
383
384 --disable-streams Disables the wxStream classes.
385
386 --disable-file Disables the wxFile class.
387
388 --disable-textfile Disables the wxTextFile class.
389
390 --disable-intl Disables the internationalisation.
391
392 --disable-validators Disables validators.
393
394 --disable-accel Disables accelerators support.
395
396 Apart from disabling certain features you can very often "strip"
397 the program of its debugging information resulting in a significant
398 reduction in size.
399
400 * Compiling
401 -----------
402
403 The following must be done in the base directory (e.g. ~/wxGTK
404 or ~/wxWin or whatever)
405
406 Now the makefiles are created (by configure) and you can compile
407 the library by typing:
408
409 make
410
411 make yourself some coffee, as it will take some time. On an old
412 386SX possibly two weeks. During compilation, you'll get a few
413 warning messages depending in your compiler.
414
415 If you want to be more selective, you can change into a specific
416 directory and type "make" there.
417
418 Then you may install the library and its header files under
419 /usr/local/include/wx and /usr/local/lib respectively. You
420 have to log in as root (i.e. run "su" and enter the root
421 password) and type
422
423 make install
424
425 You can remove any traces of wxWindows by typing
426
427 make uninstall
428
429 If you want to save disk space by removing unnecessary
430 object-files:
431
432 make clean
433
434 in the various directories will do the work for you.
435
436 * Creating a new Project
437 --------------------------
438
439 1) The first way uses the installed libraries and header files
440 automatically using wx-config
441
442 g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo
443
444 Using this way, a make file for the minimal sample would look
445 like this
446
447 CC = gcc
448
449 minimal: minimal.o
450 $(CC) -o minimal minimal.o `wx-config --libs`
451
452 minimal.o: minimal.cpp mondrian.xpm
453 $(CC) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
454
455 clean:
456 rm -f *.o minimal
457
458 This is certain to become the standard way unless we decide
459 to stick to tmake.
460
461 2) The other way creates a project within the source code
462 directories of wxWindows. For this endeavour, you'll need
463 GNU autoconf version 2.14 and add an entry to your Makefile.in
464 to the bottom of the configure.in script and run autoconf
465 and configure before you can type make.
466
467 ----------------------
468
469 In the hope that it will be useful,
470
471 Robert Roebling
472