]> git.saurik.com Git - wxWidgets.git/blob - docs/gtk/install.txt
added GetSelection for wxMSW.
[wxWidgets.git] / docs / gtk / install.txt
1 wxWidgets 2.5 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 wxWidgets you are
13 using (including the beta) and what compiler on what system. One
14 example: wxGTK 2.4.0, gcc 2.95.4, Redhat 6.2
15
16 * The simplest case
17 -------------------
18
19 If you compile wxWidgets 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 wxWidgets 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 has support for the new version 2.0.X of GTK+ since version 2.4.0.
48 This means 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 need time
50 to stabilize, so be careful. Anyways, after installing a recent version of GTK+
51 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 wxWidgets,
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 wxWidgets - you may also want to create different versions of wxWidgets
75 and test them concurrently. Most typically, this would be a version configured
76 with --enable-debug 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
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 wxWidgets 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 wxWidgets 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 wxWidgets/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 wxWidgets/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, virtually all Linux distributions have
179 correct glibc 2 support.
180
181 You can disable thread support by running
182
183 ./configure --disable-threads
184 make
185 su <type root password>
186 make install
187 ldconfig
188 exit
189
190 * Building wxGTK on OS/2
191 ------------------------
192
193 Please send comments and question about the OS/2 installation
194 to Stefan Neis <Stefan.Neis@t-online.de> and patches to
195 the wxWidgets mailing list.
196
197 In the following list, the version numbers indicate the configuration that
198 was actually used by myself, newer version should cause no problems and
199 even older ones are expected to work most of the time.
200
201 You'll need OS/2 Warp (4.51) or eCS(1.0), X-Free86/2 (3.3.6 or newer),
202 GTK+ (1.2.5 or newer), emx (0.9d fix 4), flex (2.5.4), yacc (1.8) or
203 bison (1.25), a Unix like shell (pdksh-5.2.14 or ash), Autoconf (2.57),
204 GNU file utilities (3.13), GNU text utilities (1.19),
205 GNU shell utilites (1.12), m4 (1.4), sed (2.05), grep (2.0), Awk (3.0.3),
206 GNU Make (3.75).
207
208 Preferably, you should have Posix/2 installed and C(PLUS)_INCLUDE_PATH and
209 LIBRARY_PATH set up accordingly, however, wxGTK will even work without it.
210 Presence of Posix/2 will be auto-detected.
211
212 Open an OS/2 prompt and switch to the directory above.
213 Set MAKESHELL (and depending on your installation also INSTALL, for me
214 it tends to try to use the system's tcpip\pcomos\install.exe which causes
215 problems...) to a Unix like shell, e.g.
216 SET MAKESHELL=ash
217
218 Be warned that depending on the precise version of your make, the
219 variable that needs to be set might be MAKE_SHELL instead of MAKESHELL.
220 If you have a really deficient version of GNU make, it might even be
221 necessary to set SHELL or even COMSPEC to a unix like shell as well.
222
223 Notice that the delivered configure scripts are fully OS/2 aware, so you
224 can simply run
225 ash -c "configure --with-gtk"
226 and make and possibly make install as described above.
227
228 * Building wxGTK on SGI
229 -----------------------
230
231 Using the SGI native compilers, it is recommended that you
232 also set CFLAGS and CXXFLAGS before running configure. These
233 should be set to :
234
235 CFLAGS="-mips3 -n32"
236 CXXFLAGS="-mips3 -n32"
237
238 This is essential if you want to use the resultant binaries
239 on any other machine than the one it was compiled on. If you
240 have a 64bit machine (Octane) you should also do this to ensure
241 you don't accidently build the libraries as 64bit (which is
242 untested).
243
244 The SGI native compiler support has only been tested on Irix 6.5.
245
246 * Create your configuration
247 ---------------------------
248
249 Usage:
250 ./configure options
251
252 If you want to use system's C and C++ compiler,
253 set environment variables CC and CCC as
254
255 % setenv CC cc
256 % setenv CXX CC
257 % ./configure [options]
258
259 to see all the options please use:
260
261 ./configure --help
262
263 It is recommended to build wxWidgets in another directory (maybe a
264 subdirectory of your wxWidgets installation) as this allows you to
265 have multiple configurations (for example, debug and release or GTK
266 and Motif) simultaneously.
267
268
269 * General options
270 -----------------
271
272 Given below are the commands to change the default behaviour,
273 i.e. if it says "--disable-threads" it means that threads
274 are enabled by default.
275
276 Normally, you won't have to choose a toolkit, because when
277 you download wxGTK, it will default to --with-gtk etc. But
278 if you use all of our CVS repository you have to choose a
279 toolkit. You must do this by running configure with either of:
280
281 --with-gtk Use the GIMP ToolKit (GTK). Default.
282
283 --with-motif Use either Motif or Lesstif
284 Configure will look for both.
285
286 The following options handle the kind of library you want to build.
287
288 --disable-threads Compile without thread support.
289
290 --disable-shared Do not create shared libraries, but
291 build static libraries instead.
292
293 --enable-monolithic Build wxWidgets as single library instead
294 of as several smaller libraries (which is
295 the default since wxWidgets 2.5.0).
296
297 --disable-optimise Do not optimise the code. Can
298 sometimes be useful for debugging
299 and is required on some architectures
300 such as Sun with gcc 2.8.X which
301 would otherwise produce segvs.
302
303 --enable-profile Add profiling info to the object
304 files. Currently broken, I think.
305
306 --enable-no_rtti Enable compilation without creation of
307 C++ RTTI information in object files.
308 This will speed-up compilation and reduce
309 binary size.
310
311 --enable-no_exceptions Enable compilation without creation of
312 C++ exception information in object files.
313 This will speed-up compilation and reduce
314 binary size. Also fewer crashes during the
315 actual compilation...
316
317 --enable-no_deps Enable compilation without creation of
318 dependency information.
319
320 --enable-permissive Enable compilation without checking for strict
321 ANSI conformance. Useful to prevent the build
322 dying with errors as soon as you compile with
323 Solaris' ANSI-defying headers.
324
325 --enable-mem_tracing Add built-in memory tracing.
326
327 --enable-dmalloc Use the dmalloc memory debugger.
328 Read more at www.letters.com/dmalloc/
329
330 --enable-debug_info Add debug info to object files and
331 executables for use with debuggers
332 such as gdb (or its many frontends).
333
334 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
335 compiling. This enable wxWidgets' very
336 useful internal debugging tricks (such
337 as automatically reporting illegal calls)
338 to work. Note that program and library
339 must be compiled with the same debug
340 options.
341
342 --enable-debug Same as --enable-debug_info and
343 --enable-debug_flag together. Unless you have
344 some very specific needs, you should use this
345 option instead of --enable-debug_info/flag ones
346 separately.
347
348 * Feature Options
349 -----------------
350
351 When producing an executable that is linked statically with wxGTK
352 you'll be surprised at its immense size. This can sometimes be
353 drastically reduced by removing features from wxWidgets that
354 are not used in your program. The most relevant such features
355 are
356
357 --with-odbc Enables ODBC code. This is disabled
358 by default because iODBC is under the
359 L-GPL license which is less liberal than
360 wxWidgets license.
361
362 --without-libpng Disables PNG image format code.
363
364 --without-libjpeg Disables JPEG image format code.
365
366 --without-libtiff Disables TIFF image format code.
367
368 --without-expat Disable XML classes based on Expat parser.
369
370 --disable-pnm Disables PNM image format code.
371
372 --disable-gif Disables GIF image format code.
373
374 --disable-pcx Disables PCX image format code.
375
376 --disable-iff Disables IFF image format code.
377
378 --disable-resources Disables the use of *.wxr type resources.
379
380 --disable-threads Disables threads. Will also disable sockets.
381
382 --disable-sockets Disables sockets.
383
384 --disable-dnd Disables Drag'n'Drop.
385
386 --disable-clipboard Disables Clipboard.
387
388 --disable-serial Disables object instance serialisation.
389
390 --disable-streams Disables the wxStream classes.
391
392 --disable-file Disables the wxFile class.
393
394 --disable-textfile Disables the wxTextFile class.
395
396 --disable-intl Disables the internationalisation.
397
398 --disable-validators Disables validators.
399
400 --disable-accel Disables accelerators support.
401
402 Apart from disabling certain features you can very often "strip"
403 the program of its debugging information resulting in a significant
404 reduction in size.
405
406 Please see the output of "./configure --help" for comprehensive list
407 of all configurable options.
408
409
410 * Compiling
411 -----------
412
413 The following must be done in the base directory (e.g. ~/wxGTK
414 or ~/wxWin or whatever)
415
416 Now the makefiles are created (by configure) and you can compile
417 the library by typing:
418
419 make
420
421 make yourself some coffee, as it will take some time. On an old
422 386SX possibly two weeks. During compilation, you'll get a few
423 warning messages depending in your compiler.
424
425 If you want to be more selective, you can change into a specific
426 directory and type "make" there.
427
428 Then you may install the library and its header files under
429 /usr/local/include/wx and /usr/local/lib respectively. You
430 have to log in as root (i.e. run "su" and enter the root
431 password) and type
432
433 make install
434
435 You can remove any traces of wxWidgets by typing
436
437 make uninstall
438
439 If you want to save disk space by removing unnecessary
440 object-files:
441
442 make clean
443
444 in the various directories will do the work for you.
445
446 * Creating a new Project
447 --------------------------
448
449 1) The first way uses the installed libraries and header files
450 automatically using wx-config
451
452 g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo
453
454 Using this way, a make file for the minimal sample would look
455 like this
456
457 CC = gcc
458
459 minimal: minimal.o
460 $(CC) -o minimal minimal.o `wx-config --libs`
461
462 minimal.o: minimal.cpp mondrian.xpm
463 $(CC) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
464
465 clean:
466 rm -f *.o minimal
467
468 This is certain to become the standard way unless we decide
469 to stick to tmake.
470
471 If your application uses only some of wxWidgets libraries, you can
472 specify required libraries when running wx-config. For example,
473 `wx-config --libs=html,core` will only output link command to link
474 with libraries required by core GUI classes and wxHTML classes. See
475 the manual for more information on the libraries.
476
477 2) The other way creates a project within the source code
478 directories of wxWidgets. For this endeavour, you'll need
479 GNU autoconf version 2.14 and add an entry to your Makefile.in
480 to the bottom of the configure.in script and run autoconf
481 and configure before you can type make.
482
483 ----------------------
484
485 In the hope that it will be useful,
486
487 Robert Roebling
488